Error when running run_summarization.py

Hi,

I am trying to run this simple run_summarization.py following this page:

Below are the error messages that I obtained:

(base) smgailab@upfspr:~/Intel/optimum-intel/examples/neural_compressor/summarization$ python run_summarization.py
–model_name_or_path t5-small
–dataset_name=cnn_dailymail
–dataset_config “3.0.0”
–source_prefix "summarize: "
–apply_quantization
–apply_pruning
–target_sparsity 0.1
–num_train_epochs 4
–max_train_samples 100
–do_train
–do_eval
–verify_loading
–predict_with_generate
–per_device_train_batch_size=4
–per_device_eval_batch_size=4
–output_dir /tmp/test_summarization

run_summarization.py: error: the following arguments are required: --model_name_or_path, --output_dir
–model_name_or_path: command not found
–dataset_name=cnn_dailymail: command not found
–source_prefix: command not found

System info:
Distributor ID: Ubuntu
Description: Ubuntu 22.04 LTS
Release: 22.04
Python 3.11.4
Model name: Intel(R) Xeon(R) Platinum 8480+

Command arguments need two dashes (--) not one like you are using (-)

Also in the future, please try and use back-ticks for code blocks and commands, it makes things easier for the rest of us! (the (`) char)

Hi there,

I am using double dashes… i think something went wrong when i copy and paste from the terminal.

python run_summarization.py \
–model_name_or_path t5-small
–dataset_name=cnn_dailymail
–dataset_config “3.0.0”
–source_prefix "summarize: "
–apply_quantization
–apply_pruning
–target_sparsity 0.1
–num_train_epochs 4
–max_train_samples 100
–do_train
–do_eval
–verify_loading
–predict_with_generate
–per_device_train_batch_size=4
–per_device_eval_batch_size=4
–output_dir /tmp/test_summarization

1 Like

eventually i think something wrong with torch.quantization?

(base) smgailab@upfspr:~/Intel/optimum-intel/examples/neural_compressor/summarization$ ./run_summarization.sh
Traceback (most recent call last):
File “/home/smgailab/Intel/optimum-intel/examples/neural_compressor/summarization/run_summarization.py”, line 53, in
from optimum.intel.neural_compressor import INCModelForSeq2SeqLM, INCSeq2SeqTrainer
File “/home/smgailab/miniconda3/lib/python3.11/site-packages/optimum/intel/neural_compressor/init.py”, line 16, in
from .quantization import (
File “/home/smgailab/miniconda3/lib/python3.11/site-packages/optimum/intel/neural_compressor/quantization.py”, line 29, in
from torch.quantization import add_observer_, convert
ImportError: cannot import name ‘add_observer_’ from ‘torch.quantization’ (/home/smgailab/miniconda3/lib/python3.11/site-packages/torch/quantization/init.py)
./run_summarization.sh: line 2: --model_name_or_path: command not found
./run_summarization.sh: line 5: --source_prefix: command not found

This is my run_summarization.sh file

image

You may want to update your torch version then perhaps.