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