GithubHelp home page GithubHelp logo

yufengm / selfattentive Goto Github PK

View Code? Open in Web Editor NEW
109.0 109.0 26.0 23.32 MB

Implementation of A Structured Self-attentive Sentence Embedding

Jupyter Notebook 94.83% Python 5.17%
attention-mechanism deep-learning

selfattentive's People

Contributors

hane1818 avatar yufengm avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

selfattentive's Issues

TypeError: iteration over a 0-d tensor

Training data loaded.....
Start training...
# of Epochs: 30
Traceback (most recent call last):
  File "train.py", line 195, in <module>
    all_losses.append( train( lr, epoch )[0] )
  File "train.py", line 112, in train
    hidden = repackage_hidden( hidden )
  File "E:\WORK\SelfAttentive-master\Utility.py", line 25, in repackage_hidden
    return tuple( repackage_hidden( v ) for v in h )
  File "E:\WORK\SelfAttentive-master\Utility.py", line 25, in <genexpr>
    return tuple( repackage_hidden( v ) for v in h )
  File "E:\WORK\SelfAttentive-master\Utility.py", line 25, in repackage_hidden
    return tuple( repackage_hidden( v ) for v in h )
  File "E:\WORK\SelfAttentive-master\Utility.py", line 25, in <genexpr>
    return tuple( repackage_hidden( v ) for v in h )
  File "E:\WORK\SelfAttentive-master\Utility.py", line 25, in repackage_hidden
    return tuple( repackage_hidden( v ) for v in h )
  File "E:\WORK\SelfAttentive-master\Utility.py", line 25, in <genexpr>
    return tuple( repackage_hidden( v ) for v in h )
  File "E:\WORK\SelfAttentive-master\Utility.py", line 25, in repackage_hidden
    return tuple( repackage_hidden( v ) for v in h )
  File "E:\WORK\SelfAttentive-master\Utility.py", line 25, in <genexpr>
    return tuple( repackage_hidden( v ) for v in h )
  File "E:\WORK\SelfAttentive-master\Utility.py", line 25, in repackage_hidden
    return tuple( repackage_hidden( v ) for v in h )
  File "d:\Users\Matt\Anaconda3\lib\site-packages\torch\tensor.py", line 422, in __iter__
    raise TypeError('iteration over a 0-d tensor')
TypeError: iteration over a 0-d tensor

fc_features.pt

Hi yufeng,

Could you show me where is the fc_features.pt? Thanks a lot

Best Wishes

cannot visualize attention weights

I have successfully completed the training and also extracted the attention weights. I get the following error when I try to run the Attention Visualization notebook

     16 
     17     vector = weights.sum( 0 )
---> 18     vector = vector / vector.sum( 1 )[ 0,0 ]
     19     att, ids_to_show =  vector.sort( 1, descending=True )
     20 

RuntimeError: dimension out of range (expected to be in range of [-1, 0], but got 1)

Can you let me know what is wrong here?

froebnius norm

a slight doubt,

does P = torch.norm( AAT - I, 2 ) perform frobeinus norm ?
thanks

save sentence embeddings

Hi,
Can you kindly let me know how to / (where in the code) export the sentence embeddings of the training dataset ?

Thanks!

torch version

thank you for Implementation of A Structured Self-attentive Sentence Embedding,Do you have the torch
implementation version

the Performance

Hi,
Could you share the performance of this code on the tasks used in 'A Structured Self-Attentive Sentence Embedding'?

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.