Skip to content

Minor improvements of lm1b_nnx example #4745

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

vfdev-5
Copy link
Collaborator

@vfdev-5 vfdev-5 commented May 13, 2025

Description

  • Minor changes:
    • removed from flax import linen as nn and usage of linen
    • make workdir absolute path otherwise orbax can't save the checkpoint

Training logs on 2 GPUs: https://gist.github.com/vfdev-5/f75a2e32d231d892a6eee6cb1a451aa5

@vfdev-5 vfdev-5 requested a review from cgarciae May 13, 2025 19:59
@@ -48,9 +48,11 @@ def _get_datasets(self):
vocab_path = os.path.join(tempfile.mkdtemp(), 'sentencepiece_model')

# Go two directories up to the root of the flax directory.
flax_root_dir = pathlib.Path(__file__).parents[4]
try:
flax_root_dir = pathlib.Path(__file__).parents[4]
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If __file__ is /flax/examples/lm1b_nnx then parents[4] raises IndexError

@@ -34,7 +34,7 @@
'File path to the training hyperparameter configuration.',
lock_config=True,
)
flags.mark_flags_as_required(['config', 'workdir'])
flags.mark_flags_as_required(['workdir'])
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fixes a warning saying that config flag has a default value so it can't be strictly required.

@vfdev-5 vfdev-5 force-pushed the fix-lm1b-nnx-example branch from 1e1980a to c00f173 Compare May 14, 2025 08:53
@@ -75,9 +75,9 @@ tensorboard --logdir=$HOME/logs
You should expect to get numbers similar to these:


Hardware | config | Training time | Loss | TensorBoard.dev | Workdir
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed tensorboard.dev link as not usable

@vfdev-5 vfdev-5 force-pushed the fix-lm1b-nnx-example branch 3 times, most recently from 16677b3 to 84d82fb Compare May 15, 2025 14:01
@vfdev-5 vfdev-5 changed the title Fixed lm1b_nnx example training script Minor improvements of lm1b_nnx example May 15, 2025
@cgarciae
Copy link
Collaborator

Thanks @vfdev-5 !

@vfdev-5 vfdev-5 force-pushed the fix-lm1b-nnx-example branch from 92caa5f to 7def227 Compare May 19, 2025 10:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants