如何解决AttributeError: 'GPT2TokenizerFast' 对象没有属性 'max_len'
我只是使用了 Huggingface 变换器库,在运行 run_lm_finetuning.py 时得到以下消息: AttributeError: 'GPT2TokenizerFast' object has no attribute 'max_len'。其他人有这个问题或想法如何解决它?谢谢!
我的完整实验运行: mkdir 实验
对于 5 中的纪元
做
python run_lm_finetuning.py
--model_name_or_path distilgpt2
--model_type gpt2
--train_data_file small_dataset_train_preprocessed.txt
--output_dir 实验/epochs_$epoch
--do_train
--overwrite_output_dir
--per_device_train_batch_size 4
--num_train_epochs $epoch
完成
解决方法
"AttributeError: 'BertTokenizerFast' object has no attribute 'max_len'" Github issue 包含修复:
run_language_modeling.py
脚本已被弃用,取而代之的是 language-modeling/run_{clm,plm,mlm}.py
。
如果不是,解决方法是将 max_len
更改为 model_max_length
。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。