DeepRecommender
DeepRecommender copied to clipboard
Deprecation warnings migrating to 0.4
We see the following deprecation warnings when using PyTorch Version 0.4.0 with the DeepRecommender package. These deprecation warnings will result in errors in PyTorch Version 0.5.0. Specifically, the migration involves two changes:
- Changing
nn.init.xavier_uniformtonn.init.xavier_uniform_, - Instead of using
loss.data[0]syntax, useloss.item().
These changes are breaking; when using PyTorch Version 0.3.0, nn.init.xavier_uniform_ and loss.item() result in AttributeError: module 'torch.nn.init' has no attribute 'xavier_uniform_' and 'Variable' object has no attribute 'item' , respectively.
Deprecation warnings:
DeepRecommender/reco_encoder/model/model.py:60: UserWarning: nn.init.xavier_uniform is now deprecated in favor of nn.init.xavier_uniform_.
weight_init.xavier_uniform(w)
DeepRecommender/reco_encoder/model/model.py:72: UserWarning: nn.init.xavier_uniform is now deprecated in favor of nn.init.xavier_uniform_.
weight_init.xavier_uniform(w)
DeepRecommender/run.py:198: UserWarning: invalid index of a 0-dim tensor. This will be an error in PyTorch 0.5. Use tensor.item() to convert a 0-dim tensor to a Python number
t_loss += loss.data[0]
[0, 0] RMSE: 3.8345311
DeepRecommender/run.py:212: UserWarning: invalid index of a 0-dim tensor. This will be an error in PyTorch 0.5. Use tensor.item() to convert a 0-dim tensor to a Python number
total_epoch_loss += loss.data[0]
DeepRecommender/run.py:74: UserWarning: invalid index of a 0-dim tensor. This will be an error in PyTorch 0.5. Use tensor.item() to convert a 0-dim tensor to a Python number
total_epoch_loss += loss.data[0]
DeepRecommender/run.py:75: UserWarning: invalid index of a 0-dim tensor. This will be an error in PyTorch 0.5. Use tensor.item() to convert a 0-dim tensor to a Python number
denom += num_ratings.data[0]