1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
| from modelarts.session import Session from modelarts.estimatorV2 import Estimator from modelarts.train_params import OutputData from modelarts.train_params import InputData
session = Session(access_key='XXX',secret_key='YYY', project_id='ZZZ', region_name='cn-north-4')
estimator = Estimator(session=session, job_description='This is a basic training job', user_image_url="deep-learning-demo/mpi:3.0.0-cuda10.2", user_command="echo hello-world", outputs=[OutputData(obs_path="obs://zs-modelarts/pytorch/model/", name="model", local_path="/model", access_method="env")], log_url="obs://zs-modelarts/pytorch/log/", train_instance_type="modelarts.p3.large.public.free", train_instance_count=1 )
job_instance = estimator.fit(job_name="job-0")
print(job_instance.job_id)
|