在 Sagemaker 上开始训练任务时出现 ModuleNotFoundError

0

【以下的问题经过翻译处理】 我想在 sagemaker 上提交训练任务。我在笔记本上试过,效果很好。当我尝试以下操作时,我得到ModuleNotFoundError: No module named 'nltk'

我的代码是

import sagemaker  
from sagemaker.pytorch import PyTorch

JOB_PREFIX   = 'pyt-ic'
FRAMEWORK_VERSION = '1.3.1'

estimator = PyTorch(entry_point='finetune-T5.py',
                   source_dir='../src',
                   train_instance_type='ml.p2.xlarge' ,
                   train_instance_count=1,
                   role=sagemaker.get_execution_role(),
                   framework_version=FRAMEWORK_VERSION, 
                   debugger_hook_config=False,  
                   py_version='py3',
                   base_job_name=JOB_PREFIX)

estimator.fit()

finetune-T5.py 有许多其他未安装的库。如何安装缺少的库?或者有更好的方法来运行训练任务吗?

profile picture
专家
已提问 8 个月前28 查看次数
1 回答
0

【以下的回答经过翻译处理】 查看此 链接(使用第三方库部分)了解如何安装用于训练任务的第三方库。您需要在与训练脚本相同的目录中创建 requirement.txt 文件,以便在运行时安装其他依赖项。

profile picture
专家
已回答 8 个月前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则