transformers icon indicating copy to clipboard operation
transformers copied to clipboard

run run_language_modeling got bug

Open ucas010 opened this issue 2 years ago • 2 comments

System Info

  • transformers version: 4.26.0.dev0
  • Platform: Linux-3.10.0-1160.81.1.el7.x86_64-x86_64-with-glibc2.17
  • Python version: 3.9.15
  • Huggingface_hub version: 0.11.1
  • PyTorch version (GPU?): 1.13.1+cu116 (True)
  • Tensorflow version (GPU?): not installed (NA)
  • Flax version (CPU?/GPU?/TPU?): not installed (NA)
  • Jax version: not installed
  • JaxLib version: not installed
  • Using GPU in script?:
  • Using distributed or parallel set-up in script?:

Who can help?

@vanpelt @pvl @arfon @xeb @kashif @sgugger

Information

  • [X] The official example scripts
  • [ ] My own modified scripts

Tasks

  • [X] An officially supported task in the examples folder (such as GLUE/SQuAD, ...)
  • [ ] My own task or dataset (give details below)

Reproduction

link:https://github.com/huggingface/transformers/blob/main/examples/legacy/run_language_modeling.py

export TRAIN_FILE=/path/to/dataset/wiki.train.raw
export TEST_FILE=/path/to/dataset/wiki.test.raw

python run_language_modeling.py \
    --output_dir=output \
    --model_type=gpt2 \
    --model_name_or_path=gpt2 \
    --do_train \
    --train_data_file=$TRAIN_FILE \
    --do_eval \
    --eval_data_file=$TEST_FILE

error: Traceback (most recent call last): File "/data/transformers/examples/legacy/run_language_modeling.py", line 375, in main() File "/data/transformers/examples/legacy/run_language_modeling.py", line 291, in main data_args.block_size = tokenizer.max_len AttributeError: 'GPT2TokenizerFast' object has no attribute 'max_len'

Expected behavior

looking forward to kind reply and solve the problem

ucas010 avatar Feb 14 '23 03:02 ucas010

This is an unmaintained example that won't work with the last version of transformers.

sgugger avatar Feb 14 '23 14:02 sgugger

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the contributing guidelines are likely to be ignored.

github-actions[bot] avatar Mar 16 '23 15:03 github-actions[bot]