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

feat: add model artifact and registry info to huggingface examples #451

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 39 additions & 22 deletions colabs/huggingface/Huggingface_wandb.ipynb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"cells": [
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand All @@ -10,18 +9,16 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"# Hugging Face + W&B\n",
"Visualize your [Hugging Face](https://github.com/huggingface/transformers) model's performance quickly with a seamless [W&B](https://wandb.ai/site) integration.\n",
"\n",
"Compare hyperparameters, output metrics, and system stats like GPU utilization across your models. \n"
"Compare hyperparameters, output metrics, and system stats like GPU utilization across your models.\n"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand All @@ -31,7 +28,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand All @@ -52,7 +48,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand All @@ -63,15 +58,13 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"# 🚀 Install, Import, and Log in\n"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand Down Expand Up @@ -104,15 +97,13 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"## 🖊️ [Sign up for a free account →](https://app.wandb.ai/login?signup=true)"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand All @@ -131,7 +122,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand All @@ -144,12 +134,11 @@
"metadata": {},
"outputs": [],
"source": [
"# Optional: log both gradients and parameters\n",
"%env WANDB_WATCH=all"
"# Optional: log model checkpoints as W&B Artifacts\n",
"%env WANDB_LOG_MODEL=\"checkpoint\""
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand All @@ -164,6 +153,7 @@
"outputs": [],
"source": [
"%env WANDB_PROJECT=huggingface-demo\n",
"%env WANDB_LOG_MODEL=checkpoint\n",
"%env TASK_NAME=MRPC\n",
"\n",
"!python run_glue.py \\\n",
Expand All @@ -177,11 +167,13 @@
" --num_train_epochs 3 \\\n",
" --output_dir /tmp/$TASK_NAME/ \\\n",
" --overwrite_output_dir \\\n",
" --logging_steps 50"
" --logging_steps 50 \\\n",
" --save_steps 100 \\\n",
" --eval_steps 100 \\\n",
" --report_to \"wandb\""
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand All @@ -199,12 +191,39 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"## Model Artifacts\n",
"\n",
"### 📈 Track key information effortlessly by default\n",
"You will also be able to view your model checkpoints in the W&B [Artifacts](https://docs.wandb.ai/guides/artifacts) page of the run above. These artifacts store all the metadata associated with this model, the W&B runs consuming it, and the whole lineage of upstream and downstream artifacts!\n",
Copy link
Contributor

Choose a reason for hiding this comment

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

(see an example model checkpoint and its in the UI here)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated as suggested

"\n",
"Here's an example of the artifacts generated from the above run\n",
Copy link
Contributor

Choose a reason for hiding this comment

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

Change text to

This image shows a summary of all the checkpoints (artifact) generated from the above run.

We should embed the image rather than link to gdrive, but ideally can we just link to this view (if project is public) so people can see output summary in the UI?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added link to workspace artifacts page instead of image.

"\n",
"![run_artifacts](https://drive.google.com/uc?export=view&id=1janWuNXhxgIbNnSZjSON51dq-DVv8S0i)\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Model Registry\n",
"After logging a bunch of checkpoints across multiple runs during experimentation, now comes time to hand-off the best checkpoint to the next stage of the workflow (e.g. testing, deployment).\n",
"\n",
"The Model Registry is a central page that lives above individual W&B projects. It houses **Registered Models**, portfolios that store \"links\" to the valuable checkpoints living in individual W&B Projects.\n",
"\n",
"The model registry offers a centralized place to house the best checkpoints for all your model tasks. Any `model` artifact you log can be \"linked\" to a Registered Model. Please refer to the following [tutorial](https://colab.research.google.com/github/wandb/examples/blob/master/colabs/wandb-model-registry/Model_Registry_E2E.ipynb) for more information related to the model registry\n",
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we should link the Model Registry docs rather than jumping straight into the colab? https://docs.wandb.ai/guides/models:

Pleaser refer to [this](https://docs.wandb.ai/guides/models) guide where you can find a [walkthrough](https://docs.wandb.ai/guides/models/walkthrough) of the Model Registry to learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated as suggested.

"\n",
"<a href=\"https://colab.research.google.com/github/wandb/examples/blob/master/colabs/wandb-model-registry/Model_Registry_E2E.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"\n",
"## 📈 Track key information effortlessly by default\n",
"Weights & Biases saves a new run for each experiment. Here's the information that gets saved by default:\n",
"- **Hyperparameters**: Settings for your model are saved in Config\n",
"- **Model Metrics**: Time series data of metrics streaming in are saved in Log\n",
Expand All @@ -213,21 +232,19 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"## 🤓 Learn more!\n",
"- [Documentation](https://docs.wandb.com/huggingface): docs on the Weights & Biases and Hugging Face integration\n",
"- [Videos](http://wandb.me/youtube): tutorials, interviews with practitioners, and more on our YouTube channel\n",
"- Contact: Message us at [email protected] with questions "
"- Contact: Message us at [email protected] with questions"
]
}
],
"metadata": {
"accelerator": "GPU",
"colab": {
"include_colab_link": true,
"provenance": [],
"toc_visible": true
},
Expand All @@ -237,5 +254,5 @@
}
},
"nbformat": 4,
"nbformat_minor": 4
"nbformat_minor": 0
}