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

ValueError: too many values to unpack (expected 2) error in example script #34

Open
zafercavdar opened this issue May 16, 2020 · 3 comments

Comments

@zafercavdar
Copy link

zafercavdar commented May 16, 2020

Hi,

I have cloned the repository and downloaded weights with given script. Then I have tried to run examples/text_emojize.py with --text "Today is great'" --maxlen 30, but it gave ValueError with following traceback:

➜  torchMoji git:(master) python3 examples/text_emojize.py --text "Today is great!" --maxlen 30
Traceback (most recent call last):
  File "examples/text_emojize.py", line 55, in <module>
    prob = model(tokenized)[0]
  File "/Users/zafer/.pyenv/versions/3.6.7/lib/python3.6/site-packages/torch/nn/modules/module.py", line 547, in __call__
    result = self.forward(*input, **kwargs)
  File "/Users/repos/torchMoji/torchmoji/model_def.py", line 222, in forward
    lstm_0_output, _ = self.lstm_0(packed_input, hidden)
  File "/Users/zafer/.pyenv/versions/3.6.7/lib/python3.6/site-packages/torch/nn/modules/module.py", line 547, in __call__
    result = self.forward(*input, **kwargs)
  File "/Users/repos/torchMoji/torchmoji/lstm.py", line 78, in forward
    input, batch_sizes = input
ValueError: too many values to unpack (expected 2)

My torch version is 1.2.0 and Python version is 3.6.7

@ecowan
Copy link

ecowan commented May 20, 2020

I had the same problem, and solved it by using Python 3.5

Sorry, I meant using torch==1.0.1 instead of the current default (1.5)

@Nazieh
Copy link

Nazieh commented May 22, 2020

change
input, batch_sizes = input
to
input, batch_sizes ,_ ,_ = input

MikhailKazekin added a commit to MikhailKazekin/torchMoji that referenced this issue Jun 19, 2020
Fix original issue huggingface#34
@johnpaulbin
Copy link

change input, batch_sizes = input to input, batch_sizes ,_ ,_ = input

@Nazieh Thank you so much for this! Such an obscure fix that no one has talked about...

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

4 participants