-
Notifications
You must be signed in to change notification settings - Fork 660
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A wide pass on docs #657
A wide pass on docs #657
Conversation
1. Added an autoencoder example to README to showcase modules with multiple methods 2. Remove FAQ (it was all on the old API) -- we can consider bringing it back but best to just link to GitHub discussions if possible? 3. Mark `flax.nn` as deprecated in more places and make it less visible 4. Add deprecation notice in examples/README. (I will later remove the directory entirely but I wanted to separate those) 5. Small adjustments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, that's a great refresh
Codecov Report
@@ Coverage Diff @@
## master #657 +/- ##
==========================================
+ Coverage 80.59% 80.67% +0.08%
==========================================
Files 56 56
Lines 4241 4269 +28
==========================================
+ Hits 3418 3444 +26
- Misses 823 825 +2
Continue to review full report at Codecov.
|
|
||
## Official examples maintained by the Flax core team | ||
|
||
This folder contains a collection of examples of implementations of various architectures and training procedures. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @andsteing -- I noticed that much of the content from this README hasn't been ported to our new documentation. Specifically:
- The "example matrix" diagram
- The description of goals for our examples
- Links and suggestions from the broader ecosystem (we may want to reach out to the package authors linked to from here so that all the packages are ported to Linen).
Was there an intention to add linen_examples/README.md
, or to add back some of this content directly into RTD? Or something else? Happy to help, just wanted to see if there had been prior thinking about this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I will first update and move to linen_examples/README.md
. Not sure if we want to have it in RTD or keep it as a README. Let's discuss this and move it in a second step if we decide for RTD.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed in #669
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice change !
examples/README.md
Outdated
| [seq2seq](seq2seq/README.md) | LSTM encoder/decoder for completing `42+1234=` sequences | On the fly data generation, LSTM state handling, simple code | | ||
| [vae](vae/README.md) | Variational auto-encoder for binarized MNIST images | Tfds `binarized_mnist`, vmap, simple code | | ||
| [wmt](wmt/README.md) | Transformer for translating en/de | Multi host SPMD, tfds `wmt1{4,7}_translate`, SentencePiece tokenization, checkpointing, dynamic bucketing, attention cache, packed sequences, recipe for TPU training on GCP | | ||
You've caught us mid-way through our chrysallis! This directory |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:)
it's one "s", though
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one "l"!
README.md
Outdated
@@ -10,20 +10,18 @@ Please check our [full documentation](https://flax.readthedocs.io/) website to l | |||
|
|||
**NOTE**: Flax is in use by a growing community | |||
of researchers and engineers at Google who happily use Flax for their | |||
daily research. The new Flax ["Linen" module API](https://github.com/google/flax/tree/master/flax/linen) is now stable and we recommend it for all new projects. The old `flax.nn` API will be deprecated. Please report | |||
daily research. The new Flax ["Linen" module API](https://github.com/google/flax/tree/master/flax/linen/README.md) is now stable and we recommend it for all new projects. The old `flax.nn` API will be deprecated. Please report |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A general remark : I'm a big fan of wrapped paragraphs.
One of many advantages is that vscode
side by side review is much easier when paragraphs are wrapped (due to microsoft/vscode#11387 )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
We provide three examples using the Flax API: a simple multi-layer perceptron, a CNN and an auto-encoder. | ||
|
||
To learn more about the `Module` abstraction, please check our [docs](https://flax.readthedocs.io/), or visit our | ||
[patterns](https://flax.readthedocs.io/en/latest/patterns/flax_patterns.html) page for additional concrete demonstrations of best practices. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what about linking to
https://github.com/google/flax/blob/master/docs/notebooks/linen_intro.ipynb
people seem to have liked that notebook.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good point
README.md
Outdated
```py | ||
class AutoEncoder(Module): | ||
encoder_widths: Iterable | ||
decoder_widths: Iterable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MLP
expects Sequence[int]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch
README.md
Outdated
@@ -79,6 +76,30 @@ class CNN(nn.Module): | |||
return x | |||
``` | |||
|
|||
```py | |||
class AutoEncoder(Module): | |||
encoder_widths: Iterable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MLP
expects Sequence[int]
README.md
Outdated
class AutoEncoder(Module): | ||
encoder_widths: Iterable | ||
decoder_widths: Iterable | ||
input_shape: Tuple = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not Tuple[int]
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you're right
README.md
Outdated
return self.decode(self.encode(x)) | ||
|
||
def encode(self, x): | ||
assert x.shape[-len(self.input_shape):] == self.input_shape |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't we check
assert x.shape[1:] == self.input_shape
if there are more than 1 dimensions in front of the expected self.input_shape
, they will be flattened in the next line, and not maintained in the return value from decode()
(e.g. if input_shape=(3, 4)
and x.shape=(5,10,3,4)
then the return value from decode()
will have shape=(50,3,4)
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch.
@@ -3,7 +3,9 @@ flax.linen package | |||
================== | |||
|
|||
.. currentmodule:: flax.linen | |||
.. automodule:: flax.linen | |||
|
|||
Linen is the Flax Module system. Read more about our design goals in the `Linen README <https://github.com/google/flax/blob/master/flax/linen/README.md>`_. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
while reading through that file: what happened to the "various advanced use-cases" link?
https://github.com/google/flax/tree/master/linen_examples/core_design_test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's still there? see the bottom -- ""Design tests" used to ensure that our "functional core" supports various advanced use-cases, and that the mostly-syntactic-sugar Module abstraction doesn't get in the way"
docs/index.rst
Outdated
@@ -6,20 +6,12 @@ | |||
Flax documentation | |||
================== | |||
|
|||
Flax is a neural network library for JAX that is designed for flexibility and | |||
Flax is a neural network library and ecosystem for JAX that is designed for flexibility. Flax |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you reformat this paragraph?
(vscode
: install Rewrap and then Alt-Q
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done (I used Emacs alt-q for this, hope you're OK with that)
Added an autoencoder example to README to showcase modules with
multiple methods
Remove FAQ (it was all on the old API) -- we can consider bringing
it back but best to just link to GitHub discussions if possible?
Mark
flax.nn
as deprecated in more places and make it less visibleAdd deprecation notice in examples/README. (I will later remove the
directory entirely but I wanted to separate those)
Small adjustments