pytorch-sentiment-analysis
pytorch-sentiment-analysis copied to clipboard
migrating to the new API
Hi, could you migrate from the legacy API to the new API. Thanks a lot!
I'm working on this currently. Planning to completely re-do all of the tutorials -- change the order and models used -- now that the new API is stable.
Thanks a lot! Looking forward to it!
Tutorials with the new API are now available, see:
- https://github.com/bentrevett/pytorch-sentiment-analysis/blob/master/1_nbow.ipynb
- https://github.com/bentrevett/pytorch-sentiment-analysis/blob/master/2_lstm.ipynb
- https://github.com/bentrevett/pytorch-sentiment-analysis/blob/master/3_cnn.ipynb
- https://github.com/bentrevett/pytorch-sentiment-analysis/blob/master/4_transformer.ipynb
Only the code is available for now, need to add the text/images. Major changes are:
- using new torchtext API
- using HuggingFace Datasets to load data. I decided to use this instead of torchtext to load the data as the HuggingFace team are constantly adding new datasets pretty rapidly, whereas torchtext seems to be hesitant to add more.
- using tqdm instead of a custom timing function
- plotting the loss/acc per batch instead of just printing loss/acc per epoch
- order/models changed from rnn -> lstm -> nbow -> cnn -> transformer, to: nbow -> lstm -> cnn -> transformer. Decided it was better to start with the nbow model as it's the simplest, and nobody uses plain RNNs anymore and it was weird to start the tutorial with a model that didn't work.
- use FastText embeddings instead of GloVe. API is the same but I see more people use FastText so decided to switch.
Hie, is there a way to import custom data on the new torchtext API, as the data.TabularDatasets.splits is now retired. Thanks.