-
Notifications
You must be signed in to change notification settings - Fork 210
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
example中提供一下summarization微调的例子 #1854
Comments
调试代码: import numpy as np import mindspore 导入封神榜自己的tokenfrom tokenizers_pegasus import PegasusTokenizer from mindnlp.engine import Trainer, TrainingArguments from mindnlp.dataset import load_dataset from mindnlp.transformers import ( from mindnlp.engine.train_args.seq2seq import Seq2SeqTrainingArguments 处理数据import mindspore train_dataset = raw_datasets = load_dataset( def process_dataset(dataset: GeneratorDataset, tokenizer, max_seq_len=1024, batch_size=32, shuffle=False, take_len=None):
batch_size = 4 # Size of each batch 训练training_args = Seq2SeqTrainingArguments(
trainer = Trainer( checkpoint = '/home/holly-npu/work/script/checkpoint/checkpoint-20231217' metrics = train_result.metrics 报错信息:AttributeError Traceback (most recent call last) File /home/ma-user/anaconda3/envs/MindSpore/lib/python3.9/site-packages/mindnlp/engine/trainer/base.py:755, in Trainer.train(self, resume_from_checkpoint, ignore_keys_for_eval, **kwargs) File /home/ma-user/anaconda3/envs/MindSpore/lib/python3.9/site-packages/mindnlp/engine/trainer/base.py:1107, in Trainer._inner_training_loop(self, batch_size, args, resume_from_checkpoint, ignore_keys_for_eval) File /home/ma-user/anaconda3/envs/MindSpore/lib/python3.9/site-packages/mindnlp/engine/trainer/base.py:1382, in Trainer.training_step(self, model, inputs) File /home/ma-user/anaconda3/envs/MindSpore/lib/python3.9/site-packages/mindspore/ops/composite/base.py:625, in Grad.call..after_grad(*args, **kwargs) File /home/ma-user/anaconda3/envs/MindSpore/lib/python3.9/site-packages/mindspore/common/api.py:185, in _wrap_func..wrapper(*arg, **kwargs) File /home/ma-user/anaconda3/envs/MindSpore/lib/python3.9/site-packages/mindspore/ops/composite/base.py:600, in _Grad.call..after_grad(*args, **kwargs) File /home/ma-user/anaconda3/envs/MindSpore/lib/python3.9/site-packages/mindspore/ops/composite/base.py:650, in _Grad._pynative_forward_run(self, fn, grad, weights, args, kwargs) File /home/ma-user/anaconda3/envs/MindSpore/lib/python3.9/site-packages/mindnlp/engine/trainer/base.py:1374, in Trainer.training_step..forward(inputs) File /home/ma-user/anaconda3/envs/MindSpore/lib/python3.9/site-packages/mindnlp/engine/trainer/base.py:1396, in Trainer.compute_loss(self, model, inputs, return_outputs) File /home/ma-user/anaconda3/envs/MindSpore/lib/python3.9/site-packages/mindnlp/core/nn/modules/module.py:391, in Module._wrapped_call_impl(self, *args, **kwargs) File /home/ma-user/anaconda3/envs/MindSpore/lib/python3.9/site-packages/mindnlp/core/nn/modules/module.py:402, in Module._call_impl(self, *args, **kwargs) File /home/ma-user/anaconda3/envs/MindSpore/lib/python3.9/site-packages/mindnlp/transformers/models/pegasus/modeling_pegasus.py:1647, in PegasusForConditionalGeneration.forward(self, input_ids, attention_mask, decoder_input_ids, decoder_attention_mask, head_mask, decoder_head_mask, cross_attn_head_mask, encoder_outputs, past_key_values, inputs_embeds, decoder_inputs_embeds, labels, use_cache, output_attentions, output_hidden_states, return_dict) File /home/ma-user/anaconda3/envs/MindSpore/lib/python3.9/site-packages/mindnlp/transformers/models/pegasus/modeling_pegasus.py:55, in shift_tokens_right(input_ids, pad_token_id, decoder_start_token_id) AttributeError: 'StubTensor' object has no attribute 'clone' 没有data_collator、Seq2SeqTrainer。导致hg里面原始的训练无法迁移,提提供基础的训练摘要脚本。 |
Is your feature request related to a problem? Please describe.
案例最好是能够把hg中的微调案例同步一下,便于大家快速切换上手
Describe the solution you'd like
加速微调脚本
Additional context
现在迫切需要summarization的微调脚本。https://github.com/huggingface/transformers/tree/main/examples/pytorch/summarization
The text was updated successfully, but these errors were encountered: