flax icon indicating copy to clipboard operation
flax copied to clipboard

Updating examples/nlp_seq

Open andsteing opened this issue 5 years ago • 6 comments

This issue tracks updates the nlp_seq example to follow practices outlined in #231.

  • [ ] Port to linen API - once ported all subsequent changes should be done in linen_examples/nlp_seq
  • [ ] Update README.md (links to paper, command line, TensorBoard metrics)
  • [ ] Add requirements.txt
  • [ ] Update file structure (separate main.py, configs/ directory)
  • [ ] Use ml_collections.ConfigDict
  • [ ] Add benchmark test (optional)
  • [ ] Add unit test
  • [ ] Add Colab (optional)
  • [ ] Adhere to Google Python style
  • [ ] Shorten/beautify training loop (consider using clu for this)

andsteing avatar Oct 29 '20 06:10 andsteing

Note that "file structure" in #231 got changed (as part of #634):

  • To make it easier to test, maintain and reuse code structure the code as follows:

    • main.py contains the flags and calls a method from train.py to run the training loop. This should be the only file defining flags! This can be almost identical for all examples, please copy from linen_examples/wmt/main.py.
    • train.py contains classes and methods for training and evaluating the model.
    • train_test.py for test cases of the training code. At a minimum the test should run a single training step but more fine grained unit tests are a bonus. You can use tfds.testing.mock_data to avoid real data from disk.

andsteing avatar Nov 15 '20 07:11 andsteing

Anyone working on this? I can take it up.

rozeappletree avatar Sep 13 '21 01:09 rozeappletree

I commited to update it and promised to do it. However, I am on holiday for the next two weeks. What would you like to do? The config needs to be replaced and the optimizer updated.

bohnetbd avatar Sep 13 '21 06:09 bohnetbd

I commited to update it and promised to do it. However, I am on holiday for the next two weeks. What would you like to do? The config needs to be replaced and the optimizer updated.

Oh. I was looking to learn flax by sending some PRs. This issue seemed perfect to familiarise myself with flax way of doing things.

I can pick up the two tasks above. May need some help at some places.

rozeappletree avatar Sep 13 '21 10:09 rozeappletree

Cool. Sounds good to me. Personally, I would recommend to take on one task at a time :) so it is easier to review.

bohnetbd avatar Sep 13 '21 11:09 bohnetbd

One task at a time LGTM.

When doing non-trivial changes (e.g. updating to Optax), thanks for adding links to before/after metrics like in #1476

andsteing avatar Sep 20 '21 08:09 andsteing