ModelScope我把数据集文件下载到本地执行会报错这是什么情况?
def cfg_modify_fn(cfg):
cfg.merge_from_dict(
{'train':
{"dataloader":
{
"batch_size_per_gpu": 16,
"workers_per_gpu": 1
}
}
})
cfg.merge_from_dict(
{'train':
{"optimizer":
{
"type": "AdamW",
"lr": 5e-5,
"options": {
"grad_clip": {
"max_norm": 2.0
}
}
}
}
})
cfg.merge_from_dict(
{'train':
{"lr_scheduler": {
"type": "StepLR",
"step_size": 2,
"options": {
"warmup": {
"type": "LinearWarmup",
"warmup_iters": 2
}
}
}
}
})
cfg.merge_from_dict(
{'train':
{"evaluation": {
"dataloader": {
"batch_size_per_gpu": 16,
"workers_per_gpu": 1,
"shuffle": False
}
}
}
})
cfg.train.hooks.extend(
[{
"type": "CheckpointHook",
"interval": 1
}, {
"type": "TextLoggerHook",
"interval": 1
}, {
"type": "EvaluationHook",
"interval": 1
}]
)
return cfg
训练脚本中加上面代码,并在kwargs中加入cfg_modify_fn=cfg_modify_fn
参考了这里https://modelscope.cn/models/damo/nlp_structbert_siamese-aoe_chinese-base/file/view/master/configuration.json
site-packages/modelscope/trainers/nlp/siamese_uie_trainer.py evaluate方法中改一下pipeline参数device=self.device.type,此回答整理自钉群“魔搭ModelScope开发者联盟群 ①”