Skip to content
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

Improve and rework GPT-tfjs #654

Open
7 tasks done
JulienVig opened this issue Mar 27, 2024 · 0 comments · May be fixed by #807
Open
7 tasks done

Improve and rework GPT-tfjs #654

JulienVig opened this issue Mar 27, 2024 · 0 comments · May be fixed by #807
Assignees
Labels
discojs Related to Disco.js rework Code that needs to be improved

Comments

@JulienVig
Copy link
Collaborator

JulienVig commented Mar 27, 2024

Here is a list of potential improvements for gpt-tfjs in Disco:

  • Create a compile method to initialize the optimizer (rather than initializing it when fitDataset is called). This ensures the optimizer state is persisted across multiple calls to fitDataset
  • Implement save and load methods to save and re-use a trained model
  • Rename classes for better clarity and consistency, e.g. multiple classes and functions are called GPT
  • Assess whether we can use tf.CustomCallbackArgs rather than redefining an interface for TrainingCallbacks
  • Assess whenever we can use TFJS' native fitDataset method rather than overriding it with a custom training loop
    -> tfjs only implements Adam while GPT2 uses AdamW. Additionally, the custom optimizer allows having weight decay which is used in the original GPT2.
  • Reading a text file with TF.js only supports reading line by line which is not ideal for LLM inputs, try implementing a file reader chunk by chunk rather than by lines
  • Training with gpt2 has NaN loss after the first epoch step

#656 and #657 should be addressed first

@JulienVig JulienVig added rework Code that needs to be improved discojs Related to Disco.js labels Mar 27, 2024
@JulienVig JulienVig self-assigned this Mar 27, 2024
@JulienVig JulienVig linked a pull request Oct 16, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discojs Related to Disco.js rework Code that needs to be improved
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant