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

Any solution for 'TypeError: _conv_forward() takes 3 positional arguments but 4 were given'? #20

Open
raidria opened this issue Oct 18, 2021 · 3 comments

Comments

@raidria
Copy link

raidria commented Oct 18, 2021

Hi, thank you for your nice code.
I tried to run your code but here's an issue

    python train.py /path/to/data --dataset omniglot --num-ways 5 --num-shots 1 --use-cuda --step-size 0.4 --batch-size 32 --num-workers 8 --num-epochs 600 --output-folder /path/to/results


    INFO:root:Saving configuration file in `/path/to/results/2021-10-18_160408/config.json
    Traceback (most recent call last):
      File "train.py", line 155, in <module>
        main(args)
      File "train.py", line 72, in main
        leave=False)
      File "/root/project/pytorch-maml/maml/metalearners/maml.py", line 172, in train
        for results in self.train_iter(dataloader, max_batches=max_batches):
      File "/root/project/pytorch-maml/maml/metalearners/maml.py", line 200, in train_iter
        outer_loss, results = self.get_outer_loss(batch)
      File "/root/project/pytorch-maml/maml/metalearners/maml.py", line 125, in get_outer_loss
        step_size=self.step_size, first_order=self.first_order)
      File "/root/project/pytorch-maml/maml/metalearners/maml.py", line 156, in adapt
        logits = self.model(inputs, params=params)
      File "/opt/conda/lib/python3.6/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
        result = self.forward(*input, **kwargs)
      File "/root/project/pytorch-maml/maml/model.py", line 60, in forward
        features = self.features(inputs, params=self.get_subdict(params, 'features'))
      File "/opt/conda/lib/python3.6/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
        result = self.forward(*input, **kwargs)
      File "/opt/conda/lib/python3.6/site-packages/torchmeta/modules/container.py", line 12, in forward
        input = module(input, params=self.get_subdict(params, name))
      File "/opt/conda/lib/python3.6/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
        result = self.forward(*input, **kwargs)
      File "/opt/conda/lib/python3.6/site-packages/torchmeta/modules/container.py", line 12, in forward
        input = module(input, params=self.get_subdict(params, name))
      File "/opt/conda/lib/python3.6/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
        result = self.forward(*input, **kwargs)
      File "/opt/conda/lib/python3.6/site-packages/torchmeta/modules/conv.py", line 25, in forward
        return self._conv_forward(input, params['weight'], bias)
    TypeError: _conv_forward() takes 3 positional arguments but 4 were given

I just copy&pasted your command and got this error.
Can you help me with this?

Thank you

@tristandeleu
Copy link
Owner

Hi! What is your version of PyTorch and Torchmeta? Looking at that stacktrace, it seems like you are using the latest version of Torchmeta (1.8.0) with PyTorch < 1.9.

@raidria
Copy link
Author

raidria commented Oct 18, 2021

You're right. My PyTorch version is 1.8.0. Can I ask what Torchmeta version is recommended for PyTorch 1.8.0?

@tristandeleu
Copy link
Owner

Try Torchmeta v1.7.0, this version should be compatible with PyTorch 1.8.0.

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