75 Star 383 Fork 232

GVPopenEuler/A-Tune

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
generate_models.py 2.29 KB
一键复制 编辑 原始数据 按行查看 历史
gentingmai 提交于 2023-09-13 21:30 . 修改python接口
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# Copyright (c) 2020 Huawei Technologies Co., Ltd.
# A-Tune is licensed under the Mulan PSL v2.
# You can use this software according to the terms and conditions of the Mulan PSL v2.
# You may obtain a copy of Mulan PSL v2 at:
# http://license.coscl.org.cn/MulanPSL2
# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
# PURPOSE.
# See the Mulan PSL v2 for more details.
# Create: 2020-07-14
"""
The tool to generate the AI models.
Usage: python3 generate_models.py [-h] [-d] [-m] [-s]
"""
import argparse
import ast
import os
import sys
FILE_PATH = os.path.realpath(os.path.dirname(__file__))
sys.path.insert(0, FILE_PATH + "/../")
# from analysis.optimizer.workload_characterization import WorkloadCharacterization
from analysis.optimizer.app_characterization import AppCharacterization
def main(csv_path, model_path, feature_selection, search):
"""
generate AI models
:param csv_path: csv path
:param model_path: model path
:param feature_selection: select feature model, default value is False
:param search: enable the grid search for model train, default value is False
:return: None
"""
processor = AppCharacterization(model_path, mode="train")
processor.train(csv_path, feature_selection, search)
if __name__ == '__main__':
ARG_PARSER = argparse.ArgumentParser(description="generate AI models")
ARG_PARSER.add_argument('-d', '--csv_path', metavar='DATA',
default=FILE_PATH + "/../analysis/dataset", help='input csv path')
ARG_PARSER.add_argument('-m', '--model_path', metavar='MODEL',
default=FILE_PATH + "/../analysis/models", help='input model path')
ARG_PARSER.add_argument('-s', '--select', metavar='SELECT',
type=ast.literal_eval, default=False,
help='whether feature models to be generate, True or False')
ARG_PARSER.add_argument('-g', '--search', metavar='SEARCH',
default=False, help='wether enable the parameter space search')
ARGS = ARG_PARSER.parse_args()
main(ARGS.csv_path, ARGS.model_path, ARGS.select, ARGS.search)
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/openeuler/A-Tune.git
git@gitee.com:openeuler/A-Tune.git
openeuler
A-Tune
A-Tune
master

搜索帮助