Coder Social home page Coder Social logo

andreacossu / relation-network-pytorch Goto Github PK

View Code? Open in Web Editor NEW
19.0 19.0 7.0 150 KB

Implementation of Relation Network and Recurrent Relational Network using PyTorch v1.3. Original papers: (RN) https://arxiv.org/abs/1706.01427 (RRN): https://arxiv.org/abs/1711.08028

License: MIT License

Python 100.00%
machine-learning neural-reasoning python pytorch pytorch-implementation relation-network

relation-network-pytorch's Introduction

Hi there ๐Ÿ‘‹

I am an assistant professor (RTD-A in Italy) at University of Pisa.
My research focuses on Continual Learning, with applications to Recurrent Neural Networks models and sequential data processing.

relation-network-pytorch's People

Contributors

alberto15romero avatar andreacossu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

relation-network-pytorch's Issues

The accuracy is very low

I cloned the repo and finished the preliminary work (in Prerequisites), then simply used the following command to run the code:
python launch_rrn_babi.py --epochs=50000 --cuda

and here is part of the log:

......

Epoch  49000  /  50000
Train loss:  2.410700951099396 . Validation loss:  1.8214629411697387
Train accuracy:  0.16200000000000014 . Validation accuracy:  0.17250000000000024

Epoch  49500  /  50000
Train loss:  2.3995521495342254 . Validation loss:  1.8207665807008744
Train accuracy:  0.16660000000000014 . Validation accuracy:  0.17250000000000024

Epoch  50000  /  50000
Train loss:  2.405573818922043 . Validation loss:  1.8204271459579469
Train accuracy:  0.16240000000000024 . Validation accuracy:  0.16099999999999998

End training!
Testing...
Test accuracy:  0.15699999999999983
Test loss:  1.8213920128345489

What can I do to improve the accuracy?
Thanks in advance for any info you can provide!

Activation in RRN

Hi Andrea,
Thanks for this neat implementation!

I've noticed the MLP consists of linear layers followed by a tanh layer (code). However, in the RRN paper the authors mention using ReLu layers followed by a linear layer. Is this variation intentional?

Index Out of Range Error

I am trying to run the network using the tag --babi_tasks to execure only one task. I realised that to do so I have to download the full dataset and I did so. Nevertheless, I am getting this error:

Done reading babi!
Start training
Traceback (most recent call last):
File "D:\Documentos\Classroom_Activity_Recognition\Relation-Network-PyTorch\launch_rrn_babi.py", line 141, in
avg_train_losses, avg_train_accuracies, val_losses, val_accuracies = train(train_stories, validation_stories, args.epochs, lstm, rrn, criterion, optimizer, args.batch_size, args.no_save, device, result_folder)
File "D:\Documentos\Classroom_Activity_Recognition\Relation-Network-PyTorch\task\babi_task\rrn\train.py", line 48, in train
facts_emb, one_of_k, h_f = lstm.process_facts_rrn(facts_batch, h_f)
File "D:\Documentos\Classroom_Activity_Recognition\Relation-Network-PyTorch\src\models\LSTM.py", line 40, in process_facts_rrn
emb = self.embeddings(x) # (n_facts, n_words_facts, dim_emb)
File "C:\Users\alber\AppData\Local\Programs\Python\Python39\lib\site-packages\torch\nn\modules\module.py", line 1071, in _call_impl
result = forward_call(*input, **kwargs)
File "C:\Users\alber\AppData\Local\Programs\Python\Python39\lib\site-packages\torch\nn\modules\sparse.py", line 158, in forward
return F.embedding(
File "C:\Users\alber\AppData\Local\Programs\Python\Python39\lib\site-packages\torch\nn\functional.py", line 2043, in embedding
return torch.embedding(weight, input, padding_idx, scale_grad_by_freq, sparse)
IndexError: index out of range in self

is this an error in the code or am I doing something wrong?

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.