云服务器内容精选

  • 示例代码 创建训练作业 1 2 3 4 5 6 7 8 9101112131415161718192021 from modelarts.session import Sessionfrom modelarts.estimator import Estimatorsession = Session()estimator = Estimator( modelarts_session=session, framework_type='PyTorch', # AI引擎名称 framework_version='PyTorch-1.0.0-python3.6', # AI引擎版本 code_dir='/obs-bucket-name/src/', # 训练脚本目录 boot_file='/obs-bucket-name/src/pytorch_sentiment.py', # 训练启动脚本目录 log_url='/obs-bucket-name/log/', # 训练日志目录 hyperparameters=[ {"label":"classes", "value": "10"}, {"label":"lr", "value": "0.001"} ], output_path='/obs-bucket-name/output/', # 训练输出目录 train_instance_type='modelarts.vm.gpu.p100', # 训练环境规格 train_instance_count=1, # 训练节点个数 job_description='pytorch-sentiment with ModelArts SDK') # 训练作业描述job_instance = estimator.fit(inputs='/obs-bucket-name/data/train/', wait=False, job_name='my_training_job') 查询模型列表 1234 from modelarts.session import Session from modelarts.model import Modelsession = Session() model_list_resp = Model.get_model_list(session, model_status="published", model_name="digit", order="desc") 查询服务详情 12345 from modelarts.session import Sessionfrom modelarts.model import Predictorsession = Session()predictor_instance = Predictor(session, service_id="input your service_id")predictor_info_resp = predictor_instance.get_service_info()