Weekly blog #5 (week 10): 29/07 to 04/08

Published: 08/05/2019

Hey. It looks like we’re in August now. Summer is coming to an end fast!


What happened this week? One of my mentors came back from holidays and we had a sync up call on Monday, and another one on Thursday (which should’ve been on Wednesday but I overslept. Set your alarms students!). We discussed the state of the project and what else can we do before GSoC ends.


At the start of the week I opened a PyTorch PR that supports both image and text explanations.


One thing that I was stuck on was saving and loading PyTorch models. Unlike in Keras where you can use one function call to load a model, in PyTorch there are multiple steps: get the class for the model, instantiate a model object, load the saved “state dict” into that new instance. In my case I was stuck on instantiating the model object, which required passing pre-trained word embeddings. My workaround was passing a tensor of zeros (instead of for example passing glove vectors, which were in the “state dict” anyways).


For the rest of the week I worked on the text PR. The first major progression was in adding integration tests. It took me some time to train and prepare two quality models from scratch, one for sentiment classification and another for multi-class classification.


Another development was in the documentation - function docstrings, library docs for text, adding new packages to the index, etc.


Manually testing the text PR, everything looked good apart from a few things. There was an issue with explaining “1D” layers (dense/fully-connected and final recurrent layers) that I fixed by adding special case code.


A remaining issue is with multi-label classification (https://keras.io/datasets/#reuters-newswire-topics-classification), where the explanations do not explain anything. One of my mentor’s suggested solutions was starting with a simple model and building from there.


These were the major issues and solutions for week 10. For week 11 I hope to follow this rough schedule:



  • In the text PR, move changes to the image API to a new PR. This way we can merge PR’s faster and possibly get early feedback.


  • Text PR remaining unit tests.
  • Text PR tutorial (now that I have two good models from the integration tests).


  • Text PR ad hoc tasks (FIXME’s, look at other implementations).
  • PyTorch PR refactor code (^).


  • PyTorch PR tests (manual and automated?).
  • PyTorch PR docs, tutorial.


  • Contingency (^^^)


That’s all for the week. Thank you for reading!

Tomas Baltrunas

1000 characters left