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

Adding new intro colab for model logging one-liners #488

Merged
merged 2 commits into from
Dec 6, 2023

Conversation

kenleejr
Copy link
Contributor

@kenleejr kenleejr commented Dec 6, 2023

No description provided.

Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

Copy link

github-actions bot commented Dec 6, 2023

Thanks for contributing to wandb/examples!
We appreciate your efforts in opening a PR for the examples repository. Our goal is to ensure a smooth and enjoyable experience for you 😎.

Guidelines

The examples repo is regularly tested against the ever-evolving ML stack. To facilitate our work, please adhere to the following guidelines:

  • Notebook naming: You can use a combination of snake_case and CamelCase for your notebook name. Avoid using spaces (replace them with _) and special characters (&%$?). For example:
Cool_Keras_integration_example_with_weights_and_biases.ipynb 

is acceptable, but

Cool Keras Example with W&B.ipynb

is not. Avoid spaces and the & character. To refer to W&B, you can use: weights_and_biases or just wandb (it's our library, after all!)

  • Managing dependencies within the notebook: You may need to set up dependencies to ensure that your code works. Please avoid the following practices:

    • Docker-related activities. If Docker installation is required, consider adding a full example with the corresponding Dockerfile to the wandb/examples/examples folder (where non-Colab examples reside).
    • Using pip install as the primary method to install packages. When calling pip in a cell, avoid performing other tasks. We automatically filter these types of cells, and executing other actions might break the automatic testing of the notebooks. For example,
    pip install -qU wandb transformers gpt4
    

    is acceptable, but

    pip install -qU wandb
    import wandb

    is not.

    • Installing packages from a GitHub branch. Although it's acceptable 😎 to directly obtain the latest bleeding-edge libraries from GitHub, did you know that you can install them like this:
    !pip install -q git+https://github.com/huggingface/transformers

    You don't need to clone, then cd into the repo and install it in editable mode.

    • Avoid referencing specific Colab directories. Google Colab has a /content directory where everything resides. Avoid explicitly referencing this directory because we test our notebooks with pure Jupyter (without Colab). Instead, use relative paths to make the notebook reproducible.
  • The Jupyter notebook file .ipynb is nothing more than a JSON file with primarily two types of cells: markdown and code. There is also a bunch of other metadata specific to Google Colab. We have a set of tools to ensure proper notebook formatting. These tools can be found at wandb/nb_helpers.

Before merging, wait for a maintainer to clean and format the notebooks you're adding. You can tag @tcapelle.

Before marking the PR as ready for review, please run your notebook one more time. Restart the Colab and run all. We will provide you with links to open the Colabs below

The following colabs were changed
-colabs/wandb-model-registry/New_Model_Logging_in_W&B.ipynb

@ash0ts ash0ts self-assigned this Dec 6, 2023
@@ -0,0 +1,364 @@
{
Copy link
Contributor

@ash0ts ash0ts Dec 6, 2023

Choose a reason for hiding this comment

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

Would you like to add a tracker to capture who clicks on the notebook?


Reply via ReviewNB

Copy link
Contributor Author

Choose a reason for hiding this comment

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

How does one do this?

Copy link
Contributor

@ash0ts ash0ts Dec 6, 2023

Choose a reason for hiding this comment

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

<a href="https://colab.research.google.com/github/wandb/examples/blob/master/LOCATION/TO/REPLACE_NOTEBOOK.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
<!--- @wandbcode{REPLACE_THIS_WITH_NAME_FOR_TELEMETRY} -->

More or less replace the heavily capitalized parts in the above. This will just capture if people are clicking to the notebook. Not sure if its actually granular

@@ -0,0 +1,364 @@
{
Copy link
Contributor

@ash0ts ash0ts Dec 6, 2023

Choose a reason for hiding this comment

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

Line #1.    !pip install wandb einops

Add quiet flag or % capture


Reply via ReviewNB

@@ -0,0 +1,364 @@
{
Copy link
Contributor

@ash0ts ash0ts Dec 6, 2023

Choose a reason for hiding this comment

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

nit but I prefer import wandb and wandb.login() at top level cells as opposed to lower


Reply via ReviewNB

@@ -0,0 +1,364 @@
{
Copy link
Contributor

@ash0ts ash0ts Dec 6, 2023

Choose a reason for hiding this comment

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

nit: Super brief description of model and dataset


Reply via ReviewNB

@@ -0,0 +1,364 @@
{
Copy link
Contributor

@ash0ts ash0ts Dec 6, 2023

Choose a reason for hiding this comment

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

Line #6.    from torch.utils.data import DataLoader, Dataset

Separate cell for imports


Reply via ReviewNB

@@ -0,0 +1,364 @@
{
Copy link
Contributor

@ash0ts ash0ts Dec 6, 2023

Choose a reason for hiding this comment

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

Line #148.    num_samples = 100

Seperate cell for classes vs. global defined variables/code


Reply via ReviewNB

@@ -0,0 +1,364 @@
{
Copy link
Contributor

@ash0ts ash0ts Dec 6, 2023

Choose a reason for hiding this comment

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

Line #7.    import wandb

same thing with imports. nit: would be nice to consolidate all imports to the top


Reply via ReviewNB

@@ -0,0 +1,364 @@
{
Copy link
Contributor

@ash0ts ash0ts Dec 6, 2023

Choose a reason for hiding this comment

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

Line #11.                     entity="wandb",

I'd remove this so users don't accidentally hit an error


Reply via ReviewNB

@kenleejr
Copy link
Contributor Author

kenleejr commented Dec 6, 2023

@ash0ts made the appropriate changes

@ash0ts
Copy link
Contributor

ash0ts commented Dec 6, 2023

LGTM

@ash0ts ash0ts merged commit 4eed72f into master Dec 6, 2023
3 checks passed
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