Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: IntervenableModel.train() takes 1 positional argument but 2 were given #31

Closed
danikhan632 opened this issue Apr 6, 2024 · 4 comments

Comments

@danikhan632
Copy link

This occurs when copying the exact alpaca train cmd given on a new conda env, unsure why

Traceback (most recent call last):
  File "/home/green/code/nlp/pyreft/examples/alpaca/train.py", line 128, in <module>
    train()
  File "/home/green/code/nlp/pyreft/examples/alpaca/train.py", line 122, in train
    trainer.train()
  File "/home/green/miniconda3/envs/reft/lib/python3.11/site-packages/transformers/trainer.py", line 1780, in train
    return inner_training_loop(
           ^^^^^^^^^^^^^^^^^^^^
  File "/home/green/miniconda3/envs/reft/lib/python3.11/site-packages/transformers/trainer.py", line 2118, in _inner_training_loop
    tr_loss_step = self.training_step(model, inputs)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/green/miniconda3/envs/reft/lib/python3.11/site-packages/transformers/trainer.py", line 3028, in training_step
    model.train()
  File "/home/green/miniconda3/envs/reft/lib/python3.11/site-packages/torch/nn/modules/module.py", line 2430, in train
    module.train(mode)
TypeError: IntervenableModel.train() takes 1 positional argument but 2 were given
@frankaging
Copy link
Collaborator

hey! could you try:

  • python >=3.8, since pyvene requires that.
  • pip install -r requirements.txt to make sure versions of other libs are correct?
    Thanks!

@danikhan632
Copy link
Author

I fixed it by running 'export CUDA_VISIBLE_DEVICES=0' so looks like multi GPU is causing issues.

Also had a few question I wanted to ask, my discord is @danikhan632

@frankaging
Copy link
Collaborator

you are right! remembering this now. we will support multi-gpu, sharding etc.. soon. working on it.

@frankaging
Copy link
Collaborator

closing this for now, tracking multi-gpu support here: #25

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants