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

AttributeError: 'Tensor' object has no attribute 'uniform' #40

Open
PiercarloSlavazza opened this issue Sep 18, 2019 · 1 comment
Open

Comments

@PiercarloSlavazza
Copy link

Env

  • Windows 10 + Anaconda
  • pytorch 0.4.1

Everything installed as specified in the radme

Error

When executing:

python -m models.han --dataset Reuters --mode rand --batch-size 32 --lr 0.01 --epochs 30 --seed 3435

I get:

(castor) PS C:\Users\piercarlo\Documents\workspace\personal\hedwig\hedwig> python -m models.han --dataset Reuters --mode rand --batch-size 32 --lr 0.01 --epochs 30 --seed 3435
Note: You are using GPU for training
Dataset: Reuters
No. of target classes: 90
No. of train instances 5827
No. of dev instances 1943
No. of test instances 3019
Traceback (most recent call last):
  File "C:\tools\Anaconda3\envs\castor\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "C:\tools\Anaconda3\envs\castor\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\piercarlo\Documents\workspace\personal\hedwig\hedwig\models\han\__main__.py", line 117, in <module>
    model = HAN(config)
  File "C:\Users\piercarlo\Documents\workspace\personal\hedwig\hedwig\models\han\model.py", line 13, in __init__
    self.word_attention_rnn = WordLevelRNN(config)
  File "C:\Users\piercarlo\Documents\workspace\personal\hedwig\hedwig\models\han\word_level_rnn.py", line 15, in __init__
    rand_embed_init = torch.Tensor(words_num, words_dim).uniform(-0.25, 0.25)
AttributeError: 'Tensor' object has no attribute 'uniform'
@PiercarloSlavazza
Copy link
Author

Additional note: executing the same command with --mode static does not give the error.

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

1 participant