Skip to content
This repository was archived by the owner on Apr 2, 2025. It is now read-only.

TypeError: Trainer.__init__() got an unexpected keyword argument 'gpus' #19

@raphael10-collab

Description

@raphael10-collab

In the training phase I get this error :

(.jrexenv) raphy@raohy:~/jerex$ python3 ./jerex_train.py --config-path configs/docred_joint
/home/raphy/jerex/./jerex_train.py:12: UserWarning: 
The version_base parameter is not specified.
Please specify a compatability version level, or None.
Will assume defaults for version 1.1
  @hydra.main(config_name='train', config_path='configs/docred_joint')
sys:1: UserWarning: 
'train' is validated against ConfigStore schema with the same name.
This behavior is deprecated in Hydra 1.1 and will be removed in Hydra 1.2.
See https://hydra.cc/docs/1.2/upgrades/1.0_to_1.1/automatic_schema_matching for migration instructions.
/home/raphy/jerex/.jrexenv/lib/python3.12/site-packages/hydra/main.py:94: UserWarning: 
'train' is validated against ConfigStore schema with the same name.
This behavior is deprecated in Hydra 1.1 and will be removed in Hydra 1.2.
See https://hydra.cc/docs/1.2/upgrades/1.0_to_1.1/automatic_schema_matching for migration instructions.
  _run_hydra(
/home/raphy/jerex/.jrexenv/lib/python3.12/site-packages/hydra/_internal/hydra.py:119: UserWarning: Future Hydra versions will no longer change working directory at job runtime by default.
See https://hydra.cc/docs/1.2/upgrades/1.1_to_1.2/changes_to_job_working_dir/ for more information.
  ret = run_job(
datasets:
  train_path: ./data/datasets/docred_joint/train_joint.json
  valid_path: ./data/datasets/docred_joint/dev_joint.json
  test_path: null
  types_path: ./data/datasets/docred_joint/types.json
model:
  model_type: joint_multi_instance
  encoder_path: bert-base-cased
  tokenizer_path: bert-base-cased
  mention_threshold: 0.85
  coref_threshold: 0.85
  rel_threshold: 0.6
  prop_drop: 0.1
  meta_embedding_size: 25
  size_embeddings_count: 30
  ed_embeddings_count: 300
  token_dist_embeddings_count: 700
  sentence_dist_embeddings_count: 50
  position_embeddings_count: 700
sampling:
  neg_mention_count: 200
  neg_coref_count: 200
  neg_relation_count: 200
  max_span_size: 10
  sampling_processes: 8
  neg_mention_overlap_ratio: 0.5
  lowercase: false
loss:
  mention_weight: 1.0
  coref_weight: 1.0
  entity_weight: 0.25
  relation_weight: 1.0
inference:
  valid_batch_size: 1
  test_batch_size: 1
  max_spans: null
  max_coref_pairs: null
  max_rel_pairs: null
training:
  batch_size: 1
  min_epochs: 20
  max_epochs: 20
  lr: 5.0e-05
  lr_warmup: 0.1
  weight_decay: 0.01
  max_grad_norm: 1.0
  accumulate_grad_batches: 1
  max_spans: null
  max_coref_pairs: null
  max_rel_pairs: null
distribution:
  gpus: []
  accelerator: ''
  prepare_data_per_node: false
misc:
  store_predictions: true
  store_examples: true
  flush_logs_every_n_steps: 1000
  log_every_n_steps: 1000
  deterministic: false
  seed: null
  cache_path: null
  precision: 32
  profiler: null
  final_valid_evaluate: true

Parse dataset '/home/raphy/jerex/data/datasets/docred_joint/train_joint.json':  77%|█████████████████████████████████████████████████▉               | 2309/3008 [00:21<00:10, 65.20it/s]
Parse dataset '/home/raphy/jerex/data/datasets/docred_joint/train_joint.json': 100%|████████████████████████████████████████████████████████████████| 3008/3008 [00:28<00:00, 106.67it/s]
Parse dataset '/home/raphy/jerex/data/datasets/docred_joint/dev_joint.json': 100%|█████████████████████████████████████████████████████████████████████| 300/300 [00:03<00:00, 94.99it/s]
Some weights of JointMultiInstanceModel were not initialized from the model checkpoint at bert-base-cased and are newly initialized: ['coreference_resolution.coref_classifier.bias', 'coreference_resolution.coref_classifier.weight', 'coreference_resolution.coref_ed_embeddings.weight', 'coreference_resolution.coref_linear.bias', 'coreference_resolution.coref_linear.weight', 'entity_classification.entity_classifier.bias', 'entity_classification.entity_classifier.weight', 'entity_classification.linear.bias', 'entity_classification.linear.weight', 'mention_localization.linear.bias', 'mention_localization.linear.weight', 'mention_localization.mention_classifier.bias', 'mention_localization.mention_classifier.weight', 'mention_localization.size_embeddings.weight', 'relation_classification.entity_type_embeddings.weight', 'relation_classification.pair_linear.bias', 'relation_classification.pair_linear.weight', 'relation_classification.rel_classifier.bias', 'relation_classification.rel_classifier.weight', 'relation_classification.rel_linear.bias', 'relation_classification.rel_linear.weight', 'relation_classification.sentence_distance_embeddings.weight', 'relation_classification.token_distance_embeddings.weight']
You should probably TRAIN this model on a down-stream task to be able to use it for predictions and inference.
Error executing job with overrides: []
Traceback (most recent call last):
  File "/home/raphy/jerex/./jerex_train.py", line 20, in train
    model.train(cfg)
  File "/home/raphy/jerex/jerex/model.py", line 328, in train
    trainer = pl.Trainer(callbacks=[checkpoint_callback, LearningRateMonitor(logging_interval='step')],
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/raphy/jerex/.jrexenv/lib/python3.12/site-packages/pytorch_lightning/utilities/argparse.py", line 70, in insert_env_defaults
    return fn(self, **kwargs)
           ^^^^^^^^^^^^^^^^^^
TypeError: Trainer.__init__() got an unexpected keyword argument 'gpus'

python version: 3.12.3
OS: Ubuntu 24.04

How to make it work?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions