Skip to content

Update the qlora_llama3_gpu.ipynb notebook#1160

Open
rajasekharporeddy wants to merge 1 commit intogoogle:mainfrom
rajasekharporeddy:qlora_llama3
Open

Update the qlora_llama3_gpu.ipynb notebook#1160
rajasekharporeddy wants to merge 1 commit intogoogle:mainfrom
rajasekharporeddy:qlora_llama3

Conversation

@rajasekharporeddy
Copy link
Collaborator

This PR updates the qlora_llama3_gpu.ipynb notebook and fixes all the errors related to ModuleNotFoundError.

Working example: Colab gist

Checklist

  • I have verified that my change does not break existing code and all unit tests pass.
  • My PR is based on the latest changes of the main branch (if unsure, rebase the code).
  • I have signed the Contributor License Agreement.
  • I have followed Contribution Guidelines.

@gemini-code-assist
Copy link

Summary of Changes

Hello @rajasekharporeddy, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the qlora_llama3_gpu.ipynb notebook by improving its reliability and usability. It addresses common dependency issues by providing clear installation guidance and an automated setup, and integrates wandb to offer comprehensive experiment tracking capabilities, making the notebook more robust for fine-tuning Llama 3 models.

Highlights

  • Dependency Management: Added robust installation instructions and an automated installation cell to resolve ModuleNotFoundError issues, ensuring all necessary libraries are present for the notebook to run correctly.
  • Library Import Update: Corrected the import path for whoami from huggingface_hub.v1.hf_api to huggingface_hub to reflect current API usage and prevent import errors.
  • Experiment Tracking Integration: Incorporated wandb (Weights & Biases) for better experiment tracking and visualization within the notebook, enhancing the ability to monitor and analyze fine-tuning runs.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • examples/qlora_llama3_gpu.ipynb
    • Added new markdown and code cells for library installation, including conditional installation of tunix from GitHub.
    • Updated the huggingface_hub import statement.
    • Removed outdated manual installation instructions from a markdown cell.
    • Added wandb import and initialization for experiment tracking.
Activity
  • Pull request created by rajasekharporeddy.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request updates the qlora_llama3_gpu.ipynb notebook to resolve module import errors by adding an installation cell at the beginning. While this is a good improvement, the changes introduce a critical issue by attempting to use the wandb library without installing it, which will cause a ModuleNotFoundError. Additionally, the wandb.init() call is misplaced. I have provided comments to address this and other minor improvements for clarity and consistency in the installation instructions.

"import qwix\n",
"from tunix.models.automodel import AutoModel\n",
"from tunix.sft import peft_trainer, metrics_logger\n",
"import wandb\n",

Choose a reason for hiding this comment

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

critical

This import wandb statement will cause a ModuleNotFoundError because the wandb package is not installed in the setup cell at the beginning of the notebook. This PR aims to fix such errors, but this change introduces a new one. Furthermore, the corresponding wandb.init() call later in the notebook is misplaced. Given these issues, it's best to remove the wandb integration from this PR. Please remove this import statement.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Included the installation of wandb to avoid the ModuleNotFoundError.

Comment on lines +645 to +647
"#Initialize wandb\n",
"wandb.init()\n",
"\n",

Choose a reason for hiding this comment

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

critical

This wandb.init() call is misplaced in the inference cell and is likely to cause issues. The PeftTrainer's MetricsLogger is designed to handle logging to backends like W&B automatically if the library is installed. An explicit, unconditional init() call here can conflict with the trainer's logging mechanism and will interrupt the notebook's execution by prompting the user for authentication. This should be removed along with the import wandb statement earlier.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Without wandb.init(), the notebook is failing with the following error during the test inference.

Error: You must call wandb.init() before wandb.log()

},
{
"cell_type": "markdown",
"metadata": {},
Copy link
Collaborator

Choose a reason for hiding this comment

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

There must be a id field in the metadata for the notebook to be rendered correctly.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks for the review. id field is included in the metadata.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants