Summarisation example fails to run on given example. Missing positional argument TypeError
See original GitHub issueSystem Info
- `transformers` version: 4.21.0
- Platform: Linux-5.4.188+-x86_64-with-Ubuntu-18.04-bionic
- Python version: 3.7.13
- Huggingface_hub version: 0.8.1
- PyTorch version (GPU?): 1.12.0+cu113 (True)
- Tensorflow version (GPU?): 2.8.2 (True)
- Flax version (CPU?/GPU?/TPU?): not installed (NA)
- Jax version: not installed
- JaxLib version: not installed
- Using GPU in script?: Yes
- Using distributed or parallel set-up in script?: No
Who can help?
Information
- The official example scripts
- My own modified scripts
Tasks
- An officially supported task in the
examples
folder (such as GLUE/SQuAD, …) - My own task or dataset (give details below)
Reproduction
I am trying to fine tune my own summarisation model based on the example in transformers/examples/pytorch/summarization/run_summarization_no_trainer.py
but it when I first tried on the example given in the repository. link to Google Colab to reproduce error
!accelerate launch /content/transformers/examples/pytorch/summarization/run_summarization_no_trainer.py \
--model_name_or_path t5-small \
--dataset_name cnn_dailymail \
--dataset_config "3.0.0" \
--source_prefix "summarize: " \
--output_dir ~/tmp/tst-summarization
I’m getting the following error
Traceback (most recent call last):
File "/content/transformers/examples/pytorch/summarization/run_summarization_no_trainer.py", line 763, in <module>
main()
File "/content/transformers/examples/pytorch/summarization/run_summarization_no_trainer.py", line 493, in main
desc="Running tokenizer on dataset",
File "/usr/local/lib/python3.7/dist-packages/datasets/dataset_dict.py", line 790, in map
for k, dataset in self.items()
File "/usr/local/lib/python3.7/dist-packages/datasets/dataset_dict.py", line 790, in <dictcomp>
for k, dataset in self.items()
File "/usr/local/lib/python3.7/dist-packages/datasets/arrow_dataset.py", line 2405, in map
desc=desc,
File "/usr/local/lib/python3.7/dist-packages/datasets/arrow_dataset.py", line 557, in wrapper
out: Union["Dataset", "DatasetDict"] = func(self, *args, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/datasets/arrow_dataset.py", line 524, in wrapper
out: Union["Dataset", "DatasetDict"] = func(self, *args, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/datasets/fingerprint.py", line 480, in wrapper
out = func(self, *args, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/datasets/arrow_dataset.py", line 2779, in _map_single
offset=offset,
File "/usr/local/lib/python3.7/dist-packages/datasets/arrow_dataset.py", line 2655, in apply_function_on_filtered_inputs
processed_inputs = function(*fn_args, *additional_args, **fn_kwargs)
File "/usr/local/lib/python3.7/dist-packages/datasets/arrow_dataset.py", line 2347, in decorated
result = f(decorated_item, *args, **kwargs)
File "/content/transformers/examples/pytorch/summarization/run_summarization_no_trainer.py", line 474, in preprocess_function
labels = tokenizer(text_target=targets, max_length=max_target_length, padding=padding, truncation=True)
TypeError: __call__() missing 1 required positional argument: 'text'
Traceback (most recent call last):
File "/usr/local/bin/accelerate", line 8, in <module>
sys.exit(main())
File "/usr/local/lib/python3.7/dist-packages/accelerate/commands/accelerate_cli.py", line 43, in main
args.func(args)
File "/usr/local/lib/python3.7/dist-packages/accelerate/commands/launch.py", line 826, in launch_command
simple_launcher(args)
File "/usr/local/lib/python3.7/dist-packages/accelerate/commands/launch.py", line 358, in simple_launcher
raise subprocess.CalledProcessError(returncode=process.returncode, cmd=cmd)
subprocess.CalledProcessError: Command '['/usr/bin/python3', '/content/transformers/examples/pytorch/summarization/run_summarization_no_trainer.py', '--model_name_or_path', 't5-small', '--dataset_name', 'cnn_dailymail', '--dataset_config', '3.0.0', '--source_prefix', 'summarize: ', '--output_dir', '/root/tmp/tst-summarization']' returned non-zero exit status 1.
Expected behavior
The model should start training
Issue Analytics
- State:
- Created a year ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
missing 1 required positional argument, in model summary
In torchsummary.summary , you are providing only one input shape, so it is trying to pass only one input image to your model, ......
Read more >How to make a function - Python Morsels
If we pass an argument to the greet function, we'll get an error: ... line 1, in <module> TypeError: greet() takes 0 positional...
Read more >add() function missing 1 required positional argument: 'b ...
1. Topic:-------------- TypeError : add() missing 1 required positional argument : 'b' | Python Error 2 | Inventivearya-----------------------2 ...
Read more >store_data() takes 1 positional argument but 2 were given ...
I am hoping to use dcc.Store to resolve a significant problem. For some reason, my app is returning the output (final values) from...
Read more >TypeError Pandas Missing Argument – How to fix
Pandas TypeError - This annoying error means that Pandas can not find an argument in your function. Fix by listing all required arguments....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes, it looks like
evaluate
decided to break the rouge metric. Sending a fix!You need to use the main version of Transformers to use the main version of the example scripts. You can find the examples for v4.21.0 here.