Skip to content

No standard values for scale_axis and predict_batch_size in trainer.py #2

@jg-qbig

Description

@jg-qbig

I am trying to train the model on English ptb but I am running into a problem when loading the inner model after the initial training run. The output of the train.py script is:

2024-08-02 13:34:24.472 | INFO     | __main__:cli_main:90 - Training the inside model!
Downloading: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████| 481/481 [00:00<00:00, 351kB/s]
Downloading: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████| 478M/478M [00:04<00:00, 115MB/s]
Global seed set to 42
GPU available: True, used: True
TPU available: False, using: 0 TPU cores
IPU available: False, using: 0 IPUs
HPU available: False, using: 0 HPUs
Downloading: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████| 25.0/25.0 [00:00<00:00, 18.4kB/s]
Downloading: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████| 878k/878k [00:00<00:00, 10.3MB/s]
Downloading: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████| 446k/446k [00:00<00:00, 1.65MB/s]
Downloading: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████| 1.29M/1.29M [00:00<00:00, 6.72MB/s]
/opt/conda/lib/python3.8/site-packages/pytorch_lightning/trainer/trainer.py:2203: LightningDeprecationWarning: `Trainer.gpus` was deprecated in v1.6 and will be removed in v1.8. Please use `Trainer.num_devices` or `Trainer.device_ids` to get device information instead.
  rank_zero_deprecation(
LOCAL_RANK: 0 - CUDA_VISIBLE_DEVICES: [GPU-066a8ecc]
Epoch 4: 100%|██████████████████████████████████| 313/313 [03:52<00:00,  1.35it/s, loss=0.128, val_loss=0.264, val_accuracy=0.914, val_f1=0.926, val_mcc=0.829]
LOCAL_RANK: 0 - CUDA_VISIBLE_DEVICES: [GPU-066a8ecc]
Validation DataLoader 0: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████| 63/63 [00:03<00:00, 16.91it/s]
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
     Validate metric           DataLoader 0
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
      val_accuracy          0.9144999980926514
         val_f1             0.9258777499198914
        val_loss            0.2638140022754669
         val_mcc            0.8288361430168152
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
2024-08-02 13:39:22.960 | INFO     | __main__:cli_main:109 - Preparing data for self-training!
Traceback (most recent call last):
  File "/weakly-supervised-parsing/weakly_supervised_parser/train.py", line 182, in <module>
    cli_main()
  File "/weakly-supervised-parsing/weakly_supervised_parser/train.py", line 110, in cli_main
    train_self_trained, valid_self_trained = prepare_data_for_self_training(
TypeError: prepare_data_for_self_training() missing 2 required positional arguments: 'scale_axis' and 'predict_batch_size'

I used the standard arguments provided in the readme to start training:

python3 weakly-supervised-parsing/weakly_supervised_parser/train.py \
    --path_to_train_sentences ${TRAIN_SENTENCES_PATH} \
    --model_name_or_path roberta-base \
    --output_dir ${MODEL_PATH} \
    --max_epochs 10 \
    --lr 5e-6 \
    --train_batch_size 32 \
    --eval_batch_size 32 \
    --num_workers 16 \
    --inside_max_seq_length 256 \
    --outside_max_seq_length 64 \
    --num_labels 2 \
    --num_self_train_iterations 5 \
    --num_co_train_iterations 2 \
    --upper_threshold 0.995 \
    --lower_threshold 0.005 \
    --num_train_rows 100 \
    --num_valid_examples 100 \
    --seed 42

Digging further into the source code, the train.py file provides neither scale_axis nor predict_batch_size to the prepare_data_for_self_training_function call on line 110 although they are required arguments in the definition in prepare_data.py. Are scale_axis and predict_batch_size optional arguments? If not what values should they have?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions