开发者社区 > ModelScope模型即服务 > 正文

modelscope的mt5分类的训练过程中出现的错误,怎么解决?

"modelscope的mt5分类的训练过程中出现的错误,怎么解决? :Traceback (most recent call last):
File ""e:\2-workspace\python_workspaces\text_classification\src\model\train_all.py"", line 78, in
train_test(
File ""e:\2-workspace\python_workspaces\text_classification\src\model\train_all.py"", line 74, in train_test
trainer.train()
File ""D:\ProgramData.conda\envs\pymt5\Lib\site-packages\modelscope\trainers\trainer.py"", line 711, in train
self.train_loop(self.train_dataloader)
File ""D:\ProgramData.conda\envs\pymt5\Lib\site-packages\modelscope\trainers\trainer.py"", line 1233, in train_loop
self.train_step(self.model, data_batch)
File ""D:\ProgramData.conda\envs\pymt5\Lib\site-packages\modelscope\trainers\trainer.py"", line 878, in train_step
train_outputs = model.forward(inputs)
^^^^^^^^^^^^^^^^^^^^^^^
File ""D:\ProgramData.conda\envs\pymt5\Lib\site-packages\modelscope\models\nlp\T5\text2text_generation.py"", line 376, in forward
loss = loss_fct(
^^^^^^^^^
File ""D:\ProgramData.conda\envs\pymt5\Lib\site-packages\torch\nn\modules\module.py"", line 1511, in _wrapped_call_impl
return self._call_impl(*args,
kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File ""D:\ProgramData.conda\envs\pymt5\Lib\site-packages\torch\nn\modules\module.py"", line 1520, in _call_impl
return forward_call(args, *kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File ""D:\ProgramData.conda\envs\pymt5\Lib\site-packages\torch\nn\modules\loss.py"", line 1179, in forward
return F.cross_entropy(input, target, weight=self.weight,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File ""D:\ProgramData.conda\envs\pymt5\Lib\site-packages\torch\nn\functional.py"", line 3059, in cross_entropy
return torch._C._nn.cross_entropy_loss(input, target, weight, _Reduction.get_enum(reduction), ignore_index, label_smoothing)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: expected scalar type Long but found Int "

展开
收起
小小爱吃香菜 2024-04-16 20:52:57 43 0
1 条回答
写回答
取消 提交回答
  • 用最后一个checkpoint。此回答整理自钉群“魔搭ModelScope开发者联盟群 ①”

    2024-04-16 22:17:02
    赞同 2 展开评论 打赏

ModelScope旨在打造下一代开源的模型即服务共享平台,为泛AI开发者提供灵活、易用、低成本的一站式模型服务产品,让模型应用更简单!欢迎加入技术交流群:微信公众号:魔搭ModelScope社区,钉钉群号:44837352

相关电子书

更多
揭秘阿里机器翻译 立即下载
阿里巴巴机器翻译在跨境电商场景下的应用和实践 立即下载
Machine Translation at Alibaba 立即下载