按网上的例子,配置了train_config.yaml文件内容:
配置文件如下:
train:
work_dir: D:\GitHub\jupyter_notebook\forecast\ner\tmp
task: named-entity-recognition
dataset:
train: C:\Users\dingxn02\AppData\Local\Temp\tmpqt90wf17.jsonl
model: damo/nlp_raner_named-entity-recognition_chinese-base-cmeee
preprocessor: auto
trainer:
type: epoch_based
device: cpu
batch_size: 8
num_epochs: 3
learning_rate: 5e-5
logging_steps: 10
save_steps: 100
然后通过下述语句进行微调:
config_file = 'train_config.yaml' # 确保此路径正确指向你的配置文件
config_file = 'D:\GitHub\jupyter_notebook\forecast\ner\tmp\train_config.yaml'
cfg = Config.from_file(config_file)
trainer = build_trainer(default_args=cfg.to_dict())
trainer.train()
提示错误:
AssertionError: EpochBasedTrainer: Config file should not be None if model is not from pretrained!
看起来你在配置文件中没有指定预训练模型的具体路径或标识符。请确保在配置文件中的model
字段提供了正确的预训练模型地址或标识符,例如 damo/nlp_raner_named-entity-recognition_chinese-base-cmeee
。如果还是有问题,可以直接询问阿里云客服,或者提交工单给阿里云的技术顾问,回答不易,麻烦大佬给个采纳,谢谢。
ModelScope旨在打造下一代开源的模型即服务共享平台,为泛AI开发者提供灵活、易用、低成本的一站式模型服务产品,让模型应用更简单!欢迎加入技术交流群:微信公众号:魔搭ModelScope社区,钉钉群号:44837352
评论
全部评论 (0)