-Typical config parameters values include:
+Typical config parameter values include:
* Model name, version, architecture parameters, and hyperparameters.
* Dataset name, version, number of training or validation examples.
@@ -240,7 +248,7 @@ with wandb.init(..., config=config) as run:
### Update the run config
-If values are not available at initialization time, update the config later with `wandb.Run.config.update`. For example, you might want to add a model’s parameters after the model is instantiated:
+Some configuration values, such as model parameter counts, might not be known when you call `wandb.init()`. If values aren't available at initialization time, update the config later with `wandb.Run.config.update`. For example, you might want to add a model's parameters after you instantiate the model:
```python
with wandb.init(...) as run:
@@ -248,13 +256,15 @@ with wandb.init(...) as run:
run.config.update({"model_parameters": 3500})
```
-For details, see [Configure experiments](/models/track/config/).
+For more information, see [Configure experiments](/models/track/config/).
## Log metrics and data
+After you start and configure a run, you can begin logging metrics and other data so that W&B records them against the run.
+
### Log metrics
-Create a dictionary where the key value is the name of the metric. Pass this dictionary object to [`wandb.Run.log()`](/models/ref/python/experiments/run#method-run-log) to log it to W&B:
+To log scalar metrics such as loss or accuracy, create a dictionary where each key is the name of a metric. Pass this dictionary object to [`wandb.Run.log()`](/models/ref/python/experiments/run#method-run-log) to log it to W&B:
```python
NUM_EPOCHS = 10
@@ -269,7 +279,7 @@ for epoch in range(NUM_EPOCHS):
Use metric name prefixes to group related metrics in the W&B App. Common prefixes include `train/` and `val/` for training and validation metrics, respectively, but you can use any prefix that makes sense for your use case.
-This will create separate sections in your project's workspace for your training and validation metrics, or other metric types you'd like to separate:
+This creates separate sections in your project's workspace for your training and validation metrics, or other metric types you'd like to separate:
```python
with wandb.init(...) as run:
@@ -286,11 +296,11 @@ with wandb.init(...) as run:
-See [`wandb.Run.log()`](/models/ref/python/experiments/run#method-run-log) for more details.
+For more information, see [`wandb.Run.log()`](/models/ref/python/experiments/run#method-run-log).
### Control the x-axis
-If you perform multiple calls to `wandb.Run.log()` for the same training step, the wandb SDK increments an internal step counter for each call to `wandb.Run.log()`. This counter may not align with the training step in your training loop.
+By default, the `wandb` SDK manages its own step counter, which might not match the step semantics of your training loop. If you perform multiple calls to `wandb.Run.log()` for the same training step, the `wandb` SDK increments an internal step counter for each call to `wandb.Run.log()`. This counter might not align with the training step in your training loop.
To avoid this situation, define your x-axis step explicitly with `wandb.Run.define_metric()`, one time, immediately after you call `wandb.init()`:
@@ -299,7 +309,7 @@ with wandb.init(...) as run:
run.define_metric("*", step_metric="global_step")
```
-The glob pattern, `*`, means that every metric will use `global_step` as the x-axis in your charts. If you only want certain metrics to be logged against `global_step`, you can specify them instead:
+The glob pattern, `*`, means that every metric uses `global_step` as the x-axis in your charts. If you only want certain metrics logged against `global_step`, you can specify them instead:
```python
run.define_metric("train/loss", step_metric="global_step")
@@ -314,32 +324,34 @@ for step, (input, ground_truth) in enumerate(data):
run.log({"global_step": step, "eval/loss": 0.2})
```
-If you do not have access to the independent step variable, for example "global_step" is not available during your validation loop, the previously logged value for "global_step" is automatically used by wandb. In this case, ensure you log an initial value for the metric so it has been defined when it’s needed.
+If you don't have access to the independent step variable (for example, `global_step` isn't available during your validation loop), `wandb` automatically uses the previously logged value for `global_step`. In this case, ensure you log an initial value for the metric so that it's defined when it's needed.
### Log media and structured data
-In addition to scalars, you can log images, tables, text, audio, video, and more.
+In addition to scalars, you can log images, tables, text, audio, video, and more. Logging media alongside metrics helps users inspect qualitative model behavior over time.
Some considerations when logging data include:
* How often should the metric be logged? Should it be optional?
* What type of data could be helpful in visualizing?
- * For images, you can log sample predictions, segmentation masks, etc., to see the evolution over time.
+ * For images, you can log sample predictions and segmentation masks to see the evolution over time.
* For text, you can log tables of sample predictions for later exploration.
-See the [Log objects and media](/models/track/log) for examples.
+For more information, see [Log objects and media](/models/track/log).
## Support distributed training
-For frameworks supporting distributed environments, you can adapt any of the following workflows:
+If your library can run training across multiple processes or machines, decide how W&B should behave in that setting so that logs are coherent and not duplicated. For frameworks that support distributed environments, you can adapt any of the following workflows:
* Log only from the main process (recommended).
* Log from every process and group runs using a shared `group` name.
-See [Log Distributed Training Experiments](/models/track/log/distributed-training/) for more details.
+For more information, see [Log distributed training experiments](/models/track/log/distributed-training/).
## Track models and datasets with artifacts
+In addition to metrics, you can persist the models and datasets your library produces or consumes so that users can reproduce and compare runs.
+
Use [W&B Artifacts](/models/artifacts/) to track and version models and datasets. Artifacts provide storage and versioning for machine learning assets, and they automatically track lineage to show how data and models are related.
@@ -348,13 +360,13 @@ Use [W&B Artifacts](/models/artifacts/) to track and version models and datasets
Consider the following when integrating artifacts into your library:
-* Whether to log model checkpoints or datasets as artifacts (in case you want to make it optional).
+* Whether to log model checkpoints or datasets as artifacts (in case you want to make it optional).
* Artifact input references (for example, `entity/project/artifact`).
-* Logging frequency of model checkpoints or datasets. For example, every epoch, every 500 steps, and so on.
+* Logging frequency of model checkpoints or datasets. For example, every epoch or every 500 steps.
### Log model checkpoints
-Log model checkpoints to W&B. A common approach is to log checkpoints as artifacts using the unique run ID generated by W&B as part of the artifact name.
+Logging model checkpoints as artifacts lets users recover, version, and share trained weights. A common approach is to log checkpoints as artifacts using the unique run ID that W&B generates as part of the artifact name.
```python
metadata = {"eval/accuracy": 0.8, "train/steps": 800}
@@ -370,12 +382,12 @@ aliases = ["best", "epoch_10"]
run.log_artifact(artifact, aliases=aliases)
```
-The previous code snippet demonstrates how to log a model checkpoint as an artifact and add metadata such as evaluation accuracy and training steps. The artifact is given a name that includes the unique run ID, and it is tagged with [custom aliases](/models/artifacts/create-a-custom-alias/) for easy reference.
+The preceding snippet logs a model checkpoint as an artifact with metadata such as evaluation accuracy and training steps. The artifact's name includes the unique run ID, and it's tagged with [custom aliases](/models/artifacts/create-a-custom-alias/) for quick reference.
### Log input artifacts
-Log datasets or pretrained models used as inputs:
+To capture lineage between data and models, log the datasets or pretrained models that a run consumes as inputs:
```python
dataset = wandb.Artifact(name="flowers", type="dataset")
@@ -383,13 +395,13 @@ dataset.add_file("flowers.npy")
run.use_artifact(dataset)
```
-The previous code snippet creates an artifact for a dataset called "flowers" and adds a file to it. The artifact is then associated with the current run using `run.use_artifact()`, which allows W&B to track the lineage of the dataset used in the run.
+The preceding snippet creates an artifact for a dataset called "flowers" and adds a file to it. The `run.use_artifact()` call associates the artifact with the current run so that W&B can track the lineage of the dataset used in the run.
### Download artifacts
-Download previously logged artifacts from W&B to use in your training or inference code.
+After you log artifacts, your library (or its users) can download previously logged artifacts from W&B to use in training or inference code. The right approach depends on whether you already have an active run.
-If you have a run context, use [`wandb.Run.use_artifact()`](/models/ref/python/experiments/run) to reference an artifact in W&B and then call [`wandb.Artifact.download()`](/models/ref/python/experiments/artifact) to download it to a local directory.
+If you have a run context, use [`wandb.Run.use_artifact()`](/models/ref/python/experiments/run) to reference an artifact in W&B and then call [`wandb.Artifact.download()`](/models/ref/python/experiments/artifact) to download it to a local directory. Using `use_artifact()` also records the artifact as an input to the current run, preserving lineage.
```python
with wandb.init(...) as run:
@@ -397,7 +409,7 @@ with wandb.init(...) as run:
local_path = artifact.download()
```
-Use the [W&B Public API](/models/ref/python/public-api/) to reference and download an artifact without initializing a run. This is useful in scenarios such as distributed environments or when performing inference, where you may not want to create a new run.
+Use the [W&B Public API](/models/ref/python/public-api/) to reference and download an artifact without initializing a run. This is useful in scenarios such as distributed environments or when you perform inference, where you might not want to create a new run.
```python
import wandb
@@ -405,8 +417,8 @@ artifact = wandb.Api().artifact("user/project/artifact:latest")
local_path = artifact.download()
```
-See [Download and use artifacts](/models/artifacts/download-and-use-an-artifact/) for more information.
+For more information, see [Download and use artifacts](/models/artifacts/download-and-use-an-artifact/).
-## Tune hyper-parameters
+## Tune hyperparameters
-If your library supports hyperparameter tuning, you can integrate [W&B Sweeps](/models/sweeps/) to manage and visualize experiments.
+If your library supports hyperparameter tuning, you can integrate [W&B Sweeps](/models/sweeps/) to manage and visualize experiments. Sweeps coordinate multiple runs across a defined search space and surface the results in the W&B App so users can compare configurations side by side.
diff --git a/models/integrations/autotrain.mdx b/models/integrations/autotrain.mdx
index b102b99eee..54c847dedd 100644
--- a/models/integrations/autotrain.mdx
+++ b/models/integrations/autotrain.mdx
@@ -1,10 +1,13 @@
---
title: Hugging Face AutoTrain
description: "Use W&B experiment tracking with Hugging Face AutoTrain for no-code model training with a single CLI parameter."
+keywords: ["no-code NLP", "tabular AutoML", "AutoML training"]
---
-[Hugging Face AutoTrain](https://huggingface.co/docs/autotrain/index) is a no-code tool for training state-of-the-art models for Natural Language Processing (NLP) tasks, for Computer Vision (CV) tasks, and for Speech tasks and even for Tabular tasks.
+[Hugging Face AutoTrain](https://huggingface.co/docs/autotrain/index) is a no-code tool for training models for Natural Language Processing (NLP), Computer Vision (CV), Speech, and Tabular tasks.
-[W&B](https://wandb.com/) is directly integrated into Hugging Face AutoTrain, providing experiment tracking and config management. It's as easy as using a single parameter in the CLI command for your experiments.
+[W&B](https://wandb.com/) is directly integrated into Hugging Face AutoTrain, providing experiment tracking and config management. You only need a single parameter in the CLI command for your experiments.
+
+This page shows you how to enable W&B experiment tracking when you train a model with Hugging Face AutoTrain. You can capture metrics and configuration for every run without writing additional code. This page is for users who are already familiar with AutoTrain and want to add observability to their training workflows.
@@ -12,7 +15,7 @@ description: "Use W&B experiment tracking with Hugging Face AutoTrain for no-cod
## Install prerequisites
-Install `autotrain-advanced` and `wandb`.
+Before you can train a model and log results to W&B, install the AutoTrain CLI and the W&B client library. Install `autotrain-advanced` and `wandb`.
+After training starts, AutoTrain logs your run's metrics and configuration to W&B, where you can review them alongside any other runs in your project.
+
## More resources
* [AutoTrain Advanced now supports Experiment Tracking](https://huggingface.co/blog/rishiraj/log-autotrain) by [Rishiraj Acharya](https://huggingface.co/rishiraj).
diff --git a/models/integrations/azure-openai-fine-tuning.mdx b/models/integrations/azure-openai-fine-tuning.mdx
index 5127a72161..bbab44bd75 100644
--- a/models/integrations/azure-openai-fine-tuning.mdx
+++ b/models/integrations/azure-openai-fine-tuning.mdx
@@ -1,46 +1,64 @@
---
description: "Fine-tune Azure OpenAI models with W&B experiment tracking to log metrics, hyperparameters, and training progress."
-title: Azure OpenAI Fine-Tuning
+title: Azure OpenAI fine-tuning
+keywords: ["GPT-3.5", "GPT-4", "fine-tune job tracking"]
---
-## Introduction
-Fine-tuning GPT-3.5 or GPT-4 models on Microsoft Azure using W&B tracks, analyzes, and improves model performance by automatically capturing metrics and facilitating systematic evaluation through W&B's experiment tracking and evaluation tools.
+This guide shows you how to use W&B with Azure OpenAI to track and evaluate fine-tuning jobs for GPT-3.5 or GPT-4 models. When you integrate W&B, experiment tracking captures metrics, hyperparameters, and training artifacts so you can analyze and improve model performance. You can also use W&B's evaluation tools to make data-driven decisions about model selection.
+
+This guide is for machine learning practitioners who fine-tune Azure OpenAI models and want a systematic way to track and compare runs.
## Prerequisites
+
+Before you begin, complete the following:
+
- Set up Azure OpenAI service according to [official Azure documentation](https://wandb.me/aoai-wb-int).
- Configure a W&B account with an API key.
## Workflow overview
-### 1. Fine-tuning setup
+The following stages summarize how a typical Azure OpenAI fine-tuning job flows through W&B, from preparing the job through evaluating the resulting model.
+
+### Fine-tuning setup
+
+Fine-tuning setup involves the following steps:
+
- Prepare training data according to Azure OpenAI requirements.
- Configure the fine-tuning job in Azure OpenAI.
-- W&B automatically tracks the fine-tuning process, logging metrics and hyperparameters.
+- W&B automatically tracks the fine-tuning process and logs metrics and hyperparameters.
+
+### Experiment tracking
-### 2. Experiment tracking
During fine-tuning, W&B captures:
-- Training and validation metrics
-- Model hyperparameters
-- Resource utilization
-- Training artifacts
-### 3. Model evaluation
+- Training and validation metrics.
+- Model hyperparameters.
+- Resource usage.
+- Training artifacts.
+
+### Model evaluation
+
After fine-tuning, use [W&B Weave](https://weave-docs.wandb.ai) to:
-- Evaluate model outputs against reference datasets
-- Compare performance across different fine-tuning runs
-- Analyze model behavior on specific test cases
-- Make data-driven decisions for model selection
+
+- Evaluate model outputs against reference datasets.
+- Compare performance across different fine-tuning runs.
+- Analyze model behavior on specific test cases.
+- Make data-driven decisions for model selection.
## Real-world example
-* Explore the [medical note generation demo](https://wandb.me/aoai-ft-colab) to see how this integration facilitates:
- - Systematic tracking of fine-tuning experiments
- - Model evaluation using domain-specific metrics
-* Go through an [interactive demo of fine-tuning a notebook](https://colab.research.google.com/github/wandb/examples/blob/master/colabs/azure/azure_gpt_medical_notes.ipynb)
+
+To see the integration applied end-to-end, explore the following resources:
+
+- Explore the [medical note generation demo](https://wandb.me/aoai-ft-colab) to see how this integration facilitates:
+ - Systematic tracking of fine-tuning experiments.
+ - Model evaluation using domain-specific metrics.
+- Work through an [interactive fine-tuning notebook](https://colab.research.google.com/github/wandb/examples/blob/master/colabs/azure/azure_gpt_medical_notes.ipynb).
## Additional resources
+
- [Azure OpenAI W&B Integration Guide](https://wandb.me/aoai-wb-int)
- [Azure OpenAI Fine-tuning Documentation](https://learn.microsoft.com/azure/ai-services/openai/how-to/fine-tuning?tabs=turbo%2Cpython&pivots=programming-language-python)
\ No newline at end of file
diff --git a/models/integrations/catalyst.mdx b/models/integrations/catalyst.mdx
index fde72d6a96..3ab087ab3d 100644
--- a/models/integrations/catalyst.mdx
+++ b/models/integrations/catalyst.mdx
@@ -1,14 +1,15 @@
---
description: How to integrate W&B for Catalyst, a PyTorch framework.
title: Catalyst
+keywords: ["catalyst Runner", "SupervisedRunner", "experiment runner"]
---
[Catalyst](https://github.com/catalyst-team/catalyst) is a PyTorch framework for deep learning R&D that focuses on reproducibility, rapid experimentation, and codebase reuse so you can create something new.
Catalyst includes a W&B integration for logging parameters, metrics, images, and other artifacts.
-Check out their [documentation of the integration](https://catalyst-team.github.io/catalyst/api/loggers.html#catalyst.loggers.wandb.WandbLogger), which includes examples using Python and Hydra.
+For more information, including examples that use Python and Hydra, see the [Catalyst integration documentation](https://catalyst-team.github.io/catalyst/api/loggers.html#catalyst.loggers.wandb.WandbLogger).
## Interactive example
-Run an [example colab](https://colab.research.google.com/drive/1PD0LnXiADCtt4mu7bzv7VfQkFXVrPxJq?usp=sharing) to see Catalyst and W&B integration in action.
\ No newline at end of file
+To try the Catalyst and W&B integration, open the [example Colab notebook](https://colab.research.google.com/drive/1PD0LnXiADCtt4mu7bzv7VfQkFXVrPxJq?usp=sharing).
\ No newline at end of file
diff --git a/models/integrations/cohere-fine-tuning.mdx b/models/integrations/cohere-fine-tuning.mdx
index ed88213e37..a5f6feed6b 100644
--- a/models/integrations/cohere-fine-tuning.mdx
+++ b/models/integrations/cohere-fine-tuning.mdx
@@ -1,18 +1,19 @@
---
description: "Fine-tune Cohere models with W&B experiment tracking to log training metrics and monitor model performance."
title: Cohere fine-tuning
+keywords: ["command model", "rerank fine-tune", "Cohere train API"]
---
-With W&B you can log your Cohere model's fine-tuning metrics and configuration to analyze and understand the performance of your models and share the results with your colleagues.
+With W&B, you can log your Cohere model's fine-tuning metrics and configuration to analyze your models' performance and share results with your colleagues. This page shows you how to connect a Cohere fine-tuning run to a W&B project so that W&B captures training and validation metrics, hyperparameters, and run metadata automatically in your workspace. It's intended for users who are already fine-tuning Cohere models and want centralized experiment tracking.
-This [guide from Cohere](https://docs.cohere.com/page/convfinqa-finetuning-wandb) has a full example of how to kick off a fine-tuning run and you can find the [Cohere API docs here](https://docs.cohere.com/reference/createfinetunedmodel#request.body.settings.wandb)
+For a full example of how to start a fine-tuning run, see the [Cohere fine-tuning guide](https://docs.cohere.com/page/convfinqa-finetuning-wandb), and refer to the [Cohere API reference for the `wandb` setting](https://docs.cohere.com/reference/createfinetunedmodel#request.body.settings.wandb).
-## Log your Cohere fine-tuning results
+## Log Cohere fine-tuning results
-To add Cohere fine-tuning logging to your W&B workspace:
+To add Cohere fine-tuning logging to your W&B workspace, do the following:
-1. Create a `WandbConfig` with your W&B API key, W&B `entity` and `project` name. Create an API key at https://wandb.ai/settings
+1. Create a `WandbConfig` with your W&B API key, W&B `entity`, and `project` name. The API key authenticates the Cohere job with W&B, and the entity and project determine where W&B logs your runs. Create an API key in your [W&B user settings](https://wandb.ai/settings). Replace `[WANDB-API-KEY]` in the following example with your API key.
-2. Pass this config to the `FinetunedModel` object along with your model name, dataset and hyperparameters to kick off your fine-tuning run.
+2. Pass this config to the `FinetunedModel` object along with your model name, dataset, and hyperparameters to start your fine-tuning run. The `wandb` setting configures Cohere to stream metrics to your W&B project during the run.
```python
@@ -20,7 +21,7 @@ To add Cohere fine-tuning logging to your W&B workspace:
# create a config with your W&B details
wandb_ft_config = WandbConfig(
- api_key="
+
+After the run starts, your Cohere fine-tuning job reports metrics to W&B in real time, giving you a single place to compare runs and inspect training progress.
## Organize runs
-Your W&B runs are automatically organized and can be filtered/sorted based on any configuration parameter such as job type, base model, learning rate and any other hyper-parameter.
+W&B organizes your runs automatically. You can filter and sort them by any configuration parameter such as job type, base model, learning rate, and any other hyperparameter.
-In addition, you can rename your runs, add notes or create tags to group them.
+You can also rename your runs, add notes, or create tags to group them.
## Resources
-* [Cohere Fine-tuning Example](https://github.com/cohere-ai/notebooks/blob/kkt_ft_cookbooks/notebooks/finetuning/convfinqa_finetuning_wandb.ipynb)
+For a complete example, see the [Cohere fine-tuning example notebook](https://github.com/cohere-ai/notebooks/blob/kkt_ft_cookbooks/notebooks/finetuning/convfinqa_finetuning_wandb.ipynb).
diff --git a/models/integrations/composer.mdx b/models/integrations/composer.mdx
index b7f1113fea..04ee631129 100644
--- a/models/integrations/composer.mdx
+++ b/models/integrations/composer.mdx
@@ -1,17 +1,20 @@
---
-description: State of the art algorithms to train your neural networks
+description: State-of-the-art algorithms to train your neural networks
title: MosaicML Composer
+keywords: ["speed method", "Trainer.fit", "MPT training"]
---
import { ColabLink } from '/snippets/_includes/colab-link.mdx';
-The following image demonstrates how the provided configuration was enriched with useful metadata on the W&B Artifact. This information should help for reproducibility and maintenance. It would not be available without the integration.
+The following image demonstrates how the provided configuration is enriched with metadata on the W&B Artifact. This information helps with reproducibility and maintenance. It isn't available without the integration.
@@ -389,18 +412,19 @@ The following image demonstrates how the provided configuration was enriched wi
@@ -428,6 +452,9 @@ The integration does not allow for the materialization of multiple partitions wi
-Simple example
+Example:
+
```python
# add this to your config.yaml
# alternatively you can set the config in Dagit's Launchpad or JobDefinition.execute_in_process
@@ -893,20 +938,22 @@ def run_launch_agent_example():
```
### Launch jobs
+
The integration provides an importable `@op` called `run_launch_job`. It executes your Launch job.
-A Launch job is assigned to a queue in order to be executed. You can create a queue or use the default one. Make sure you have an active agent listening to that queue. You can run an agent inside your Dagster instance but can also consider using a deployable agent in Kubernetes.
+A Launch job is assigned to a queue to be executed. You can create a queue or use the default one. Make sure you have an active agent listening to that queue. You can run an agent inside your Dagster instance, or consider using a deployable agent in Kubernetes.
Refer to the [Launch page](/platform/launch).
-You can also view useful descriptions for all properties in Launchpad.
+You can also view descriptions for all properties in Launchpad.
-Simple example
+Example:
+
```python
# add this to your config.yaml
# alternatively you can set the config in Dagit's Launchpad or JobDefinition.execute_in_process
@@ -943,35 +990,45 @@ from dagster import job, make_values_resource
},
)
def run_launch_job_example():
- run_launch_job.alias("my_launched_job")() # we rename the job with an alias
+ run_launch_job.alias("my_launched_job")() # rename the job with an alias
```
## Best practices
-1. Use the IO Manager to read and write Artifacts.
-Avoid using [`Artifact.download()`](/models/ref/python/experiments/artifact#download) or [`Run.log_artifact()`](/models/ref/python/experiments/run#log_artifact) directly. Those methods are handled by integration. Instead, return the data you want to store in the Artifact and let the integration do the rest. This approach provides better lineage for the Artifact.
+The following recommendations help you get the most out of the integration once you have it working end to end.
+
+### Use the IO Manager to read and write Artifacts
+
+Avoid using [`Artifact.download()`](/models/ref/python/experiments/artifact#download) or [`Run.log_artifact()`](/models/ref/python/experiments/run#log_artifact) directly. The integration handles those methods. Instead, return the data you want to store in the Artifact and let the integration do the rest. This approach provides better lineage for the Artifact.
+
+### Only build an Artifact object yourself for complex use cases
+
+Return Python objects and W&B objects from your ops and assets. The integration handles bundling the Artifact.
+For complex use cases, you can build an Artifact directly in a Dagster job. Pass an Artifact object to the integration for metadata enrichment, such as the source integration name and version, the Python version used, the pickle protocol version, and more.
+
+### Add files, directories, and external references to your Artifacts through the metadata
+
+Use the integration `wandb_artifact_configuration` object to add any file, directory, or external references (Amazon S3, GCS, HTTP, and so on). See the advanced example in the [Artifact configuration section](#configuration-1) for more information.
-2. Only build an Artifact object yourself for complex use cases.
-Python objects and W&B objects should be returned from your ops/assets. The integration handles bundling the Artifact.
-For complex use cases, you can build an Artifact directly in a Dagster job. We recommend you pass an Artifact object to the integration for metadata enrichment such as the source integration name and version, the python version used, the pickle protocol version and more.
+### Use an @asset instead of an @op when an Artifact is produced
-3. Add files, directories and external references to your Artifacts through the metadata.
-Use the integration `wandb_artifact_configuration` object to add any file, directory or external references (Amazon S3, GCS, HTTP…). See the advanced example in the [Artifact configuration section](#configuration-1) for more information.
+Artifacts are assets. Use an asset when Dagster maintains that asset. This provides better observability in the Dagit Asset Catalog.
-4. Use an @asset instead of an @op when an Artifact is produced.
-Artifacts are assets. It is recommended to use an asset when Dagster maintains that asset. This will provide better observability in the Dagit Asset Catalog.
+### Use a SourceAsset to consume an Artifact created outside Dagster
-5. Use a SourceAsset to consume an Artifact created outside Dagster.
-This allows you to take advantage of the integration to read externally created Artifacts. Otherwise, you can only use Artifacts created by the integration.
+This lets you take advantage of the integration to read externally created Artifacts. Otherwise, you can only use Artifacts created by the integration.
-6. Use W&B Launch to orchestrate training on dedicated compute for large models.
-You can train small models inside your Dagster cluster and you can run Dagster in a Kubernetes cluster with GPU nodes. We recommend using W&B Launch for large model training. This will prevent overloading your instance and provide access to more adequate compute.
+### Use W&B Launch to orchestrate training on dedicated compute for large models
-7. When experiment tracking within Dagster, set your W&B Run ID to the value of your Dagster Run ID.
-We recommend that you both: make the [Run resumable](/models/runs/resuming) and set the W&B Run ID to the Dagster Run ID or to a string of your choice. Following this recommendation ensures your W&B metrics and W&B Artifacts are stored in the same W&B Run when you train models inside of Dagster.
+You can train small models inside your Dagster cluster, and you can run Dagster in a Kubernetes cluster with GPU nodes. Use W&B Launch for large model training. This prevents overloading your instance and provides access to more appropriate compute.
+### Set your W&B Run ID to the value of your Dagster Run ID when experiment tracking within Dagster
+
+Make the [Run resumable](/models/runs/resuming) and set the W&B Run ID to the Dagster Run ID or to a string of your choice. Following this recommendation ensures your W&B metrics and W&B Artifacts are stored in the same W&B Run when you train models inside Dagster.
+
+
+Either set the W&B Run ID to the Dagster Run ID:
-Either set the W&B Run ID to the Dagster Run ID.
```python
wandb.init(
id=context.run_id,
@@ -981,7 +1038,8 @@ wandb.init(
```
-Or choose your own W&B Run ID and pass it to the IO Manager configuration.
+Or choose your own W&B Run ID and pass it to the IO Manager configuration:
+
```python
wandb.init(
id="my_resumable_run_id",
@@ -998,10 +1056,12 @@ wandb.init(
)
```
-8. Only collect data you need with get or get_path for large W&B Artifacts.
-By default, the integration will download an entire Artifact. If you are using very large artifacts you might want to only collect the specific files or objects you need. This will improve speed and resource utilization.
+### Only collect data you need with get or get_path for large W&B Artifacts
+
+By default, the integration downloads an entire Artifact. If you're using large artifacts, you might want to collect only the specific files or objects you need. This improves speed and resource utilization.
+
+### For Python objects, adapt the pickling module to your use case
-9. For Python objects adapt the pickling module to your use case.
-By default, the W&B integration will use the standard [pickle](https://docs.python.org/3/library/pickle.html) module. But some objects are not compatible with it. For example, functions with yield will raise an error if you try to pickle them. W&B supports other Pickle-based serialization modules ([dill](https://github.com/uqfoundation/dill), [cloudpickle](https://github.com/cloudpipe/cloudpickle), [joblib](https://github.com/joblib/joblib)).
+By default, the W&B integration uses the standard [pickle](https://docs.python.org/3/library/pickle.html) module. But some objects aren't compatible with it. For example, functions with yield raise an error if you try to pickle them. W&B supports other Pickle-based serialization modules ([dill](https://github.com/uqfoundation/dill), [cloudpickle](https://github.com/cloudpipe/cloudpickle), [joblib](https://github.com/joblib/joblib)).
-You can also use more advanced serialization like [ONNX](https://onnx.ai/) or [PMML](https://en.wikipedia.org/wiki/Predictive_Model_Markup_Language) by returning a serialized string or creating an Artifact directly. The right choice will depend on your use case, refer to the available literature on this subject.
+You can also use more advanced serialization like [ONNX](https://onnx.ai/) or [PMML](https://en.wikipedia.org/wiki/Predictive_Model_Markup_Language) by returning a serialized string or creating an Artifact directly. The right choice depends on your use case. Refer to the available literature on this subject.
diff --git a/models/integrations/databricks.mdx b/models/integrations/databricks.mdx
index 63f2950e9c..a889829763 100644
--- a/models/integrations/databricks.mdx
+++ b/models/integrations/databricks.mdx
@@ -1,19 +1,22 @@
---
description: "Integrate W&B with Databricks for experiment tracking, metric logging, and model management on Spark clusters."
title: Databricks
+keywords: ["dbfs", "cluster init script", "notebook tracking"]
---
-W&B integrates with [Databricks](https://www.databricks.com/) by customizing the W&B Jupyter notebook experience in the Databricks environment.
+W&B integrates with [Databricks](https://www.databricks.com/) by customizing the W&B Jupyter notebook experience in the Databricks environment. This page shows you how to install and authenticate W&B on a Databricks cluster so that you can track experiments and log metrics from notebooks running on Spark.
## Configure Databricks
-1. Install wandb in the cluster
+To use W&B from a Databricks notebook, you must install the `wandb` package on the cluster and configure authentication so your notebooks can log to W&B.
- Navigate to your cluster configuration, choose your cluster, click **Libraries**. Click **Install New**, choose **PyPI**, and add the package `wandb`.
+1. Install `wandb` in the cluster
+
+ In your cluster configuration, choose your cluster, then click **Libraries** > **Install New** > **PyPI**, and add the package `wandb`.
2. Set up authentication
- To authenticate your W&B account you can add a Databricks secret which your notebooks can query.
+ To authenticate your W&B account, add a Databricks secret that your notebooks can query at runtime. This avoids hard-coding your API key in notebooks.
```bash
# install databricks cli
@@ -34,7 +37,9 @@ W&B integrates with [Databricks](https://www.databricks.com/) by customizing the
## Examples
-### Simple example
+The following examples show how to use the preceding secret to log in and begin logging from a Databricks notebook.
+
+### Basic example
```python
import os
@@ -49,12 +54,11 @@ with wandb.init() as run:
### Sweeps
-Setup required (temporary) for notebooks attempting to use wandb.sweep() or wandb.agent():
+Notebooks that use `wandb.sweep()` or `wandb.agent()` must set the entity and project as environment variables:
```python
import os
-# These will not be necessary in the future
os.environ["WANDB_ENTITY"] = "my-entity"
os.environ["WANDB_PROJECT"] = "my-project-that-exists"
```
diff --git a/models/integrations/deepchecks.mdx b/models/integrations/deepchecks.mdx
index 70f42f568c..991da6c6ac 100644
--- a/models/integrations/deepchecks.mdx
+++ b/models/integrations/deepchecks.mdx
@@ -1,18 +1,19 @@
---
description: "Integrate W&B with Deepchecks to validate ML models and datasets with automated testing and experiment tracking."
title: DeepChecks
+keywords: ["data integrity", "train test validation", "deepchecks suite"]
---
import { ColabLink } from '/snippets/_includes/colab-link.mdx';
-Any questions or issues about this W&B integration? Open an issue in the [DeepChecks github repository](https://github.com/deepchecks/deepchecks) and we'll catch it and get you an answer.
\ No newline at end of file
+If you have questions or issues about this W&B integration, open an issue in the [DeepChecks GitHub repository](https://github.com/deepchecks/deepchecks) and we'll get you an answer.
\ No newline at end of file
diff --git a/models/integrations/deepchem.mdx b/models/integrations/deepchem.mdx
index a53e6021c4..e8c712ee54 100644
--- a/models/integrations/deepchem.mdx
+++ b/models/integrations/deepchem.mdx
@@ -1,11 +1,14 @@
---
description: "Integrate W&B with the DeepChem library for experiment tracking and visualization of molecular ML models."
title: DeepChem
+keywords: ["cheminformatics", "molecular property prediction"]
---
import ApiKeyCreateStreamlined from "/snippets/_includes/api-key-create-streamlined.mdx";
-The [DeepChem library](https://github.com/deepchem/deepchem) provides open source tools that democratize the use of deep-learning in drug discovery, materials science, chemistry, and biology. This W&B integration adds simple and easy-to-use experiment tracking and model checkpointing while training models using DeepChem.
+The [DeepChem library](https://github.com/deepchem/deepchem) provides open source tools that democratize the use of deep learning in drug discovery, materials science, chemistry, and biology. This W&B integration adds experiment tracking and model checkpointing while training models with DeepChem.
+
+Use this page to add W&B logging to your DeepChem training workflow so that you can track training loss, evaluation metrics, and model checkpoints across experiments. This guide is for users who already train models with DeepChem and want to add experiment tracking with minimal code changes.
## DeepChem logging in 3 lines of code
@@ -15,18 +18,23 @@ model = TorchModel(…, wandb_logger=logger)
model.fit(…)
```
+Passing a `WandbLogger` instance into a DeepChem model attaches W&B logging to the training run, so metrics produced during `fit` automatically stream to your W&B project.
+
## Report and Google Colab
-Explore the Using [W&B with DeepChem: Molecular Graph Convolutional Networks](https://wandb.ai/kshen/deepchem_graphconv/reports/Using-W-B-with-DeepChem-Molecular-Graph-Convolutional-Networks--Vmlldzo4MzU5MDc?galleryTag=) article for an example charts generated using the W&B DeepChem integration.
+The following resources show the integration in practice before you wire it into your own code:
-To dive straight into working code, check out this [Google Colab](https://colab.research.google.com/github/wandb/examples/blob/master/colabs/deepchem/W%26B_x_DeepChem.ipynb).
+- Explore the [W&B with DeepChem: Molecular Graph Convolutional Networks](https://wandb.ai/kshen/deepchem_graphconv/reports/Using-W-B-with-DeepChem-Molecular-Graph-Convolutional-Networks--Vmlldzo4MzU5MDc?galleryTag=) article for example charts generated using the W&B DeepChem integration.
+- To dive straight into working code, check out this [Google Colab](https://colab.research.google.com/github/wandb/examples/blob/master/colabs/deepchem/W%26B_x_DeepChem.ipynb).
## Track experiments
+The remainder of this page walks through how to set up an API key, install the `wandb` library, and enable logging for either a `TorchModel` or `KerasModel`.
+
Set up W&B for DeepChem models of type [KerasModel](https://deepchem.readthedocs.io/en/latest/api_reference/models.html#keras-models) or [TorchModel](https://deepchem.readthedocs.io/en/latest/api_reference/models.html#pytorch-models).
### Sign up and create an API key
@@ -35,6 +43,8 @@ An API key authenticates your machine to W&B. You can generate an API key from y
-
+The following image shows an example of a Stable Diffusion XL + Refiner experiment:
+
+
+
+
## More resources
diff --git a/models/integrations/docker.mdx b/models/integrations/docker.mdx
index e382429670..e81b013e9d 100644
--- a/models/integrations/docker.mdx
+++ b/models/integrations/docker.mdx
@@ -1,24 +1,29 @@
---
description: "Run W&B inside Docker containers by configuring API keys, environment variables, and local file storage."
title: Docker
+keywords: ["WANDB_API_KEY", "container image", "volume mount"]
---
## Docker integration
-W&B can store a pointer to the Docker image that your code ran in, giving you the ability to restore a previous experiment to the exact environment it was run in. The wandb library looks for the **WANDB_DOCKER** environment variable to persist this state. We provide a few helpers that automatically set this state.
+W&B can store a pointer to the Docker image that your code ran in, letting you restore a previous experiment to the exact environment it ran in. The wandb library looks for the `WANDB_DOCKER` environment variable to persist this state. W&B provides a few helpers that automatically set this state.
+
+The following sections describe how to set the `WANDB_DOCKER` environment variable in different environments, from local development through Kubernetes-based training.
### Local development
-`wandb docker` is a command that starts a docker container, passes in wandb environment variables, mounts your code, and ensures wandb is installed. By default the command uses a docker image with TensorFlow, PyTorch, Keras, and Jupyter installed. You can use the same command to start your own docker image: `wandb docker my/image:latest`. The command mounts the current directory into the "/app" directory of the container, you can change this with the "--dir" flag.
+`wandb docker` is a command that starts a Docker container, passes in wandb environment variables, mounts your code, and ensures wandb is installed. By default, the command uses a Docker image with TensorFlow, PyTorch, Keras, and Jupyter installed. You can use the same command to start your own Docker image: `wandb docker my/image:latest`. The command mounts the current directory into the `/app` directory of the container. You can change this with the `--dir` flag.
### Production
-The `wandb docker-run` command is provided for production workloads. It's meant to be a drop in replacement for `nvidia-docker`. It's a simple wrapper to the `docker run` command that adds your credentials and the **WANDB_DOCKER** environment variable to the call. If you do not pass the "--runtime" flag and `nvidia-docker` is available on the machine, this also ensures the runtime is set to nvidia.
+The `wandb docker-run` command is provided for production workloads. It's a drop-in replacement for `nvidia-docker` that wraps the `docker run` command and adds your credentials and the `WANDB_DOCKER` environment variable to the call. If you don't pass the `--runtime` flag and `nvidia-docker` is available on the machine, this also ensures the runtime is set to nvidia.
### Kubernetes
-If you run your training workloads in Kubernetes and the k8s API is exposed to your pod \(which is the case by default\). wandb will query the API for the digest of the docker image and automatically set the **WANDB_DOCKER** environment variable.
+If you run your training workloads in Kubernetes and the Kubernetes API is exposed to your pod \(which is the case by default\), wandb queries the API for the digest of the Docker image and automatically sets the `WANDB_DOCKER` environment variable.
+
+## Restore the training environment
-## Restoring
+Once the `WANDB_DOCKER` environment variable is set during a run, you can use it to reproduce the original training environment later.
-If a run was instrumented with the **WANDB_DOCKER** environment variable, calling `wandb restore username/project:run_id` will checkout a new branch restoring your code then launch the exact docker image used for training pre-populated with the original command.
\ No newline at end of file
+If a run was instrumented with the `WANDB_DOCKER` environment variable, calling `wandb restore username/project:run_id` checks out a new branch restoring your code, then launches the exact Docker image used for training pre-populated with the original command.
\ No newline at end of file
diff --git a/models/integrations/dspy.mdx b/models/integrations/dspy.mdx
index 4b9d166603..c2f1279dcc 100644
--- a/models/integrations/dspy.mdx
+++ b/models/integrations/dspy.mdx
@@ -1,16 +1,18 @@
---
description: "Track and optimize DSPy programs with W&B to log prompts, evaluations, and compiled module performance."
title: DSPy
+keywords: ["BootstrapFewShot", "MIPRO optimizer", "signature tuning"]
---
+This guide shows how to use W&B with DSPy to track and optimize your language model programs, so you can monitor evaluation metrics, inspect how program signatures evolve during optimization, and version the resulting programs as reproducible artifacts. It's intended for DSPy users who want experiment tracking and observability for their compiled modules.
-Use W&B with DSPy to track and optimize your language model programs. W&B complements the [Weave DSPy integration](/weave/guides/integrations/dspy) by providing:
+W&B complements the [Weave DSPy integration](/weave/guides/integrations/dspy) by providing:
- Evaluation metrics tracking over time
- W&B Tables for program signature evolution
- Integration with DSPy optimizers like MIPROv2
-For comprehensive observability when optimizing DSPy modules, enable the integration in both W&B and Weave.
+For full observability when optimizing DSPy modules, enable the integration in both W&B and Weave.
+
-For comprehensive details about Weave tracing, evaluation, and optimization with DSPy, see the [Weave DSPy integration guide](/weave/guides/integrations/dspy).
+For details about Weave tracing, evaluation, and optimization with DSPy, see the [Weave DSPy integration guide](/weave/guides/integrations/dspy).
## Log predictions to W&B Tables
-Enable detailed prediction logging to inspect individual examples during optimization. The callback creates a W&B Tables for each evaluation step, which can help you to analyze specific successes and failures.
+In addition to aggregate metrics, you can enable detailed prediction logging to inspect individual examples during optimization. The callback creates a W&B Table for each evaluation step, which helps you analyze specific successes and failures.
```python
from wandb.integration.dspy import WandbDSPyCallback
@@ -149,7 +151,7 @@ optimized_program = optimizer.compile(program, trainset=train_data)
After optimization, find your prediction data in W&B:
1. Navigate to your run's **Overview** page.
-2. Look for Table panels named with a pattern like `predictions_0`, `predictions_1`, and so forth.
+2. Look for Table panels named with a pattern like `predictions_0` or `predictions_1`.
3. Filter by `is_correct` to analyze failures.
4. Compare tables across runs in the project workspace.
@@ -162,7 +164,7 @@ Learn more in the [W&B Tables guide](/models/tables/visualize-tables/).
## Save and version DSPy programs
-To reproduce and version your best DSpy programs, save them as W&B Artifacts. Choose between saving the complete program or only the state.
+Once you've identified a high-performing optimized program, save it as a W&B Artifact so you can reproduce results and track versions over time. Choose between saving the complete program or only the state, depending on whether you need the full architecture or a lighter-weight checkpoint.
```python
from wandb.integration.dspy import WandbDSPyCallback
diff --git a/models/integrations/farama-gymnasium.mdx b/models/integrations/farama-gymnasium.mdx
index c7bc990856..e953054111 100644
--- a/models/integrations/farama-gymnasium.mdx
+++ b/models/integrations/farama-gymnasium.mdx
@@ -1,14 +1,15 @@
---
description: "Integrate W&B with Farama Gymnasium to track reinforcement learning experiments and record episode videos."
title: Farama Gymnasium
+keywords: ["RL environment", "monitor_gym", "Atari wrapper"]
---
-If you're using [Farama Gymnasium](https://gymnasium.farama.org/#) we will automatically log videos of your environment generated by `gymnasium.wrappers.Monitor`. Just set the `monitor_gym` keyword argument to [`wandb.init()`](/models/ref/python/functions/init) to `True`.
+If you're using [Farama Gymnasium](https://gymnasium.farama.org/#), W&B automatically logs videos of your environment generated by `gymnasium.wrappers.Monitor`. To enable video logging, set the `monitor_gym` keyword argument to [`wandb.init()`](/models/ref/python/functions/init) to `True`.
-Our gymnasium integration is very light. We simply [look at the name of the video file](https://github.com/wandb/wandb/blob/c5fe3d56b155655980611d32ef09df35cd336872/wandb/integration/gym/__init__.py#LL69C67-L69C67) being logged from `gymnasium` and name it after that or fall back to `"videos"` if we don't find a match. If you want more control, you can always just manually [log a video](/models/track/log/media/).
+The Gymnasium integration is lightweight. W&B [reads the name of the video file](https://github.com/wandb/wandb/blob/c5fe3d56b155655980611d32ef09df35cd336872/wandb/integration/gym/__init__.py#LL69C67-L69C67) logged from `gymnasium` and uses that name. If no match is found, the integration falls back to `"videos"`. For more control, you can manually [log a video](/models/track/log/media/).
-Check out this [report](https://wandb.ai/raph-test/cleanrltest/reports/Mario-Bros-but-with-AI-Gymnasium-and-CleanRL---Vmlldzo0NTcxNTcw) to learn more on how to use Gymnasium with the CleanRL library.
+For more information about using Gymnasium with the CleanRL library, see the [Mario Bros, but with AI: Gymnasium and CleanRL](https://wandb.ai/raph-test/cleanrltest/reports/Mario-Bros-but-with-AI-Gymnasium-and-CleanRL---Vmlldzo0NTcxNTcw) report.
-
+
\ No newline at end of file
diff --git a/models/integrations/fastai.mdx b/models/integrations/fastai.mdx
index 4653b85822..b8ab7489eb 100644
--- a/models/integrations/fastai.mdx
+++ b/models/integrations/fastai.mdx
@@ -1,11 +1,12 @@
---
title: fastai
description: "Integrate W&B with fastai using the WandbCallback to track experiments, log metrics, and visualize model performance."
+keywords: ["Learner callback", "vision learner", "tabular learner"]
---
import ApiKeyCreateStreamlined from "/snippets/_includes/api-key-create-streamlined.mdx";
-You can integrate **fastai** with W&B using the `WandbCallback` class. Check out these [interactive docs with examples](https://app.wandb.ai/borisd13/demo_config/reports/Visualize-track-compare-Fastai-models--Vmlldzo4MzAyNA) for more details.
+You can integrate **fastai** with W&B using the `WandbCallback` class to track experiments, log metrics, and visualize model performance during training. This page shows how to set up authentication, add the callback to your training loop, and configure logging for both single-process and distributed training. Check out these [interactive docs with examples](https://app.wandb.ai/borisd13/demo_config/reports/Visualize-track-compare-Fastai-models--Vmlldzo4MzAyNA) for more details.
## Sign up and create an API key
@@ -25,7 +26,7 @@ To install the `wandb` library locally and log in:
1. Set the `WANDB_API_KEY` [environment variable](/models/track/environment-variables/) to your API key.
```bash
- export WANDB_API_KEY=False (default)True will log folder referenced by learn.dls.path.Note: subfolder "models" is always ignored.
| -| dataset_name | name of logged dataset (default to `folder name`). | -| valid_dl | `DataLoaders` containing items used for prediction samples (default to random items from `learn.dls.valid`. | -| n_preds | number of logged predictions (default to 36). | -| seed | used for defining random samples. | +| `log` | Whether to log the model's: `gradients`, `parameters`, `all`, or `None` (default). Losses and metrics are always logged. | +| `log_preds` | Whether to log prediction samples (default to `True`). | +| `log_preds_every_epoch` | Whether to log predictions every epoch or at the end (default to `False`). | +| `log_model` | Whether to log the model (default to `False`). This also requires `SaveModelCallback`. | +| `model_name` | The name of the `file` to save, overrides `SaveModelCallback`. | +| `log_dataset` |False (default).True logs the folder referenced by `learn.dls.path`.Note: subfolder "models" is always ignored.
| +| `dataset_name` | Name of the logged dataset (default to `folder name`). | +| `valid_dl` | `DataLoaders` containing items used for prediction samples (default to random items from `learn.dls.valid`). | +| `n_preds` | Number of logged predictions (default to 36). | +| `seed` | Used for defining random samples. | For custom workflows, you can manually log your datasets and models: * `log_dataset(path, name=None, metadata={})` * `log_model(path, name=None, metadata={})` -_Note: any subfolder "models" will be ignored._ +_Note: any subfolder "models" is ignored._ ## Distributed training -`fastai` supports distributed training by using the context manager `distrib_ctx`. W&B supports this automatically and enables you to track your Multi-GPU experiments out of the box. +`fastai` supports distributed training by using the context manager `distrib_ctx`. W&B supports this automatically and enables you to track your multi-GPU experiments without additional configuration. The following sections describe how to integrate W&B with distributed training and how to limit logging to the main process. Review this minimal example: @@ -136,13 +139,13 @@ if __name__ == "__main__": train() ``` -Then, in your terminal you will execute: +Then, in your terminal, execute: ```shell -$ torchrun --nproc_per_node 2 train.py +torchrun --nproc_per_node 2 train.py ``` -in this case, the machine has 2 GPUs. +In this case, the machine has 2 GPUs.
-- **Unified dashboard**: Central repository for all your model metrics and predictions
-- **Lightweight**: No code changes required to integrate with Hugging Face
-- **Accessible**: Free for individuals and academic teams
-- **Secure**: All projects are private by default
-- **Trusted**: Used by machine learning teams at OpenAI, Toyota, Lyft and more
+- **Unified dashboard**: Central repository for all your model metrics and predictions.
+- **Lightweight**: No code changes required to integrate with Hugging Face.
+- **Accessible**: Free for individuals and academic teams.
+- **Secure**: All projects are private by default.
+- **Trusted**: Used by machine learning teams at OpenAI, Toyota, Lyft, and more.
-Think of W&B like GitHub for machine learning models— save machine learning experiments to your private, hosted dashboard. Experiment quickly with the confidence that all the versions of your models are saved for you, no matter where you're running your scripts.
+W&B works like GitHub for machine learning models. Save machine learning experiments to your private, hosted dashboard. Experiment with the confidence that all versions of your models are saved for you, no matter where you run your scripts.
-W&B lightweight integrations works with any Python script, and all you need to do is sign up for a free W&B account to start tracking and visualizing your models.
+W&B lightweight integrations work with any Python script. Sign up for a free W&B account to start tracking and visualizing your models.
-In the Hugging Face Transformers repo, we've instrumented the Trainer to automatically log training and evaluation metrics to W&B at each logging step.
+In the Hugging Face Transformers repository, W&B has instrumented the Trainer to automatically log training and evaluation metrics to W&B at each logging step.
-Here's an in depth look at how the integration works: [Hugging Face + W&B Report](https://app.wandb.ai/jxmorris12/huggingface-demo/reports/Train-a-model-with-Hugging-Face-and-Weights-%26-Biases--VmlldzoxMDE2MTU).
+Here's an in-depth look at how the integration works: [Hugging Face + W&B Report](https://app.wandb.ai/jxmorris12/huggingface-demo/reports/Train-a-model-with-Hugging-Face-and-Weights-%26-Biases--VmlldzoxMDE2MTU).
## Install, import, and log in
+This section sets up the environment you need to run the tutorial. Install the Hugging Face and W&B libraries, and download the GLUE dataset and training script for this tutorial:
-
-Install the Hugging Face and W&B libraries, and the GLUE dataset and training script for this tutorial.
-- [Hugging Face Transformers](https://github.com/huggingface/transformers): Natural language models and datasets
-- [W&B](/): Experiment tracking and visualization
-- [GLUE dataset](https://gluebenchmark.com/): A language understanding benchmark dataset
-- [GLUE script](https://raw.githubusercontent.com/huggingface/transformers/refs/heads/main/examples/pytorch/text-classification/run_glue.py): Model training script for sequence classification
+- [Hugging Face Transformers](https://github.com/huggingface/transformers): Natural language models and datasets.
+- [W&B](/): Experiment tracking and visualization.
+- [GLUE dataset](https://gluebenchmark.com/): A language understanding benchmark dataset.
+- [GLUE script](https://raw.githubusercontent.com/huggingface/transformers/refs/heads/main/examples/pytorch/text-classification/run_glue.py): Model training script for sequence classification.
```notebook
@@ -51,11 +51,11 @@ Install the Hugging Face and W&B libraries, and the GLUE dataset and training sc
!pip install -q git+https://github.com/huggingface/transformers
```
-Before continuing, [sign up for a free account](https://app.wandb.ai/login?signup=true).
+Before continuing, you must [sign up for a free account](https://app.wandb.ai/login?signup=true). An account is required to send your run data to a W&B dashboard.
-## Put in your API key
+## Add your API key
-Once you've signed up, run the next cell and click on the link to get your API key and authenticate this notebook.
+Authenticating with your API key links this notebook to your W&B account so that runs are logged to your projects. After you sign up, run the next cell and click the link to get your API key and authenticate this notebook.
```python
@@ -63,7 +63,7 @@ import wandb
wandb.login()
```
-Optionally, we can set environment variables to customize W&B logging. See the [Hugging Face integration guide](/models/integrations/huggingface/).
+Optionally, you can set environment variables to customize what W&B logs during training. For example, you can log both gradients and parameters by setting `WANDB_WATCH=all`. See the [Hugging Face integration guide](/models/integrations/huggingface/) for the full list of options.
```python
@@ -72,7 +72,8 @@ Optionally, we can set environment variables to customize W&B logging. See the [
```
## Train the model
-Next, call the downloaded training script [run_glue.py](https://huggingface.co/transformers/examples.html#glue) and see training automatically get tracked to the W&B dashboard. This script fine-tunes BERT on the Microsoft Research Paraphrase Corpus— pairs of sentences with human annotations indicating whether they are semantically equivalent.
+
+With the environment configured and authentication complete, you're ready to start a training run. Call the downloaded training script [`run_glue.py`](https://huggingface.co/transformers/examples.html#glue) and see training automatically get tracked to the W&B dashboard. This script fine-tunes BERT on the Microsoft Research Paraphrase Corpus (pairs of sentences with human annotations indicating whether they're semantically equivalent).
```python
@@ -93,29 +94,35 @@ Next, call the downloaded training script [run_glue.py](https://huggingface.co/t
--logging_steps 50
```
-## Visualize results in dashboard
-Click the link printed out above, or go to [wandb.ai](https://app.wandb.ai) to see your results stream in live. The link to see your run in the browser will appear after all the dependencies are loaded. Look for the following output: "**wandb**: View run at [URL to your unique run]"
+## Visualize results in the dashboard
+
+After training starts, you can monitor metrics in real time. Click the link printed out by the preceding cell, or go to [wandb.ai](https://app.wandb.ai) to see your results stream in live. The link to see your run in the browser appears after all the dependencies are loaded. Look for the following output: "**wandb**: View run at [URL to your unique run]"
+
+### Visualize model performance
-**Visualize Model Performance**
-It's easy to look across dozens of experiments, zoom in on interesting findings, and visualize highly dimensional data.
+Look across experiments, zoom in on findings, and visualize high-dimensional data.
-**Compare Architectures**
-Here's an example comparing [BERT vs DistilBERT](https://app.wandb.ai/jack-morris/david-vs-goliath/reports/Does-model-size-matter%3F-Comparing-BERT-and-DistilBERT-using-Sweeps--VmlldzoxMDUxNzU). It's easy to see how different architectures effect the evaluation accuracy throughout training with automatic line plot visualizations.
+### Compare architectures
+
+Here's an example comparing [BERT versus DistilBERT](https://app.wandb.ai/jack-morris/david-vs-goliath/reports/Does-model-size-matter%3F-Comparing-BERT-and-DistilBERT-using-Sweeps--VmlldzoxMDUxNzU). The automatic line plot visualizations show how different architectures affect the evaluation accuracy throughout training.
-
+
-## Track key information effortlessly by default
-W&B saves a new run for each experiment. Here's the information that gets saved by default:
-- **Hyperparameters**: Settings for your model are saved in Config
-- **Model Metrics**: Time series data of metrics streaming in are saved in Log
-- **Terminal Logs**: Command line outputs are saved and available in a tab
-- **System Metrics**: GPU and CPU utilization, memory, temperature etc.
+## Track key information by default
+
+This section describes what W&B captures automatically so you know what data is available in your dashboard without additional configuration. W&B saves a new run for each experiment. Here's the information saved by default:
+
+- **Hyperparameters**: Settings for your model are saved in Config.
+- **Model metrics**: Time series data of metrics streaming in are saved in Log.
+- **Terminal logs**: Command line outputs are saved and available in a tab.
+- **System metrics**: GPU and CPU utilization, memory, and temperature.
## Learn more
+
- [Video walkthroughs on YouTube](http://wandb.me/youtube)
diff --git a/models/integrations/huggingface_transformers.mdx b/models/integrations/huggingface_transformers.mdx
index 33c8ab5181..8bd25e6c20 100644
--- a/models/integrations/huggingface_transformers.mdx
+++ b/models/integrations/huggingface_transformers.mdx
@@ -1,6 +1,7 @@
---
title: Hugging Face Transformers
description: "Use W&B with Hugging Face Transformers Trainer for experiment tracking, model checkpointing, and dataset versioning."
+keywords: ["TrainingArguments report_to", "Trainer callback", "HF Trainer wandb"]
---
import { ColabLink } from '/snippets/_includes/colab-link.mdx';
@@ -8,12 +9,14 @@ import ApiKeyCreateStreamlined from "/snippets/_includes/api-key-create-streamli
+
-### Finish your W&B Run (Notebook only)
+### Finish your W&B run (notebook only)
-If your training is encapsulated in a Python script, the W&B run will end when your script finishes.
+If your training is encapsulated in a Python script, the W&B run ends when your script finishes.
-If you are using a Jupyter or Google Colab notebook, you'll need to tell us when you're done with training by calling `run.finish()`.
+If you're using a Jupyter or Google Colab notebook, call `run.finish()` to signal that training is complete.
```python
run = wandb.init()
@@ -232,11 +239,16 @@ run.finish()
### Visualize your results
-Once you have logged your training results you can explore your results dynamically in the [W&B Dashboard](/models/track/workspaces/). It's easy to compare across dozens of runs at once, zoom in on interesting findings, and coax insights out of complex data with flexible, interactive visualizations.
+After you log your training results, you can explore them in the [W&B Dashboard](/models/track/workspaces/). You can compare runs, zoom in on findings, and explore your data with interactive visualizations.
+
+At this point you have a working integration: your `Trainer` logs metrics to a named project, optionally saves checkpoints to Artifacts, and surfaces evaluation outputs in the W&B Dashboard.
## Advanced features and FAQs
-### How do I save the best model?
+The following sections cover common follow-up tasks, such as saving the best model, resuming training from a checkpoint, customizing logging callbacks, and configuring W&B behavior through environment variables.
+
+### Save the best model
+
If you pass `TrainingArguments` with `load_best_model_at_end=True` to your `Trainer`, W&B saves the best performing model checkpoint to Artifacts.
If you save your model checkpoints as Artifacts, you can promote them to the [Registry](/models/registry/). In Registry, you can:
@@ -245,9 +257,9 @@ If you save your model checkpoints as Artifacts, you can promote them to the [Re
- Stage models for production or bookmark them for further evaluation.
- Trigger downstream CI/CD processes.
-### How do I load a saved model?
+### Load a saved model
-If you saved your model to W&B Artifacts with `WANDB_LOG_MODEL`, you can download your model weights for additional training or to run inference. You just load them back into the same Hugging Face architecture that you used before.
+If you saved your model to W&B Artifacts with `WANDB_LOG_MODEL`, you can download your model weights for more training or to run inference. Load them back into the same Hugging Face architecture that you used before.
```python
# Create a new run
@@ -268,8 +280,9 @@ with wandb.init(project="amazon_sentiment_analysis") as run:
# Do additional training, or run inference
```
-### How do I resume training from a checkpoint?
-If you had set `WANDB_LOG_MODEL='checkpoint'` you can also resume training by you can using the `model_dir` as the `model_name_or_path` argument in your `TrainingArguments` and pass `resume_from_checkpoint=True` to `Trainer`.
+### Resume training from a checkpoint
+
+If you set `WANDB_LOG_MODEL='checkpoint'`, you can resume training by using the `model_dir` as the `model_name_or_path` argument in your `TrainingArguments` and passing `resume_from_checkpoint=True` to `Trainer`.
```python
last_run_id = "xxxxxxxx" # fetch the run_id from your wandb workspace
@@ -289,9 +302,9 @@ with wandb.init(
# reinitialize your model and trainer
model = AutoModelForSequenceClassification.from_pretrained(
- "Log the model checkpoint as a W&B Artifact (`false` by default)
false (default): No model checkpointing checkpoint: A checkpoint will be uploaded every args.save_steps (set in the Trainer's TrainingArguments). end: The final model checkpoint will be uploaded at the end of training.Set whether you'd like to log your models gradients, parameters or neither
false (default): No gradient or parameter logging gradients: Log histograms of the gradients all: Log histograms of gradients and parametersLog the model checkpoint as a W&B Artifact (`false` by default)
false (default): No model checkpointing checkpoint: Upload a checkpoint every `args.save_steps` (set in the Trainer's `TrainingArguments`). end: Upload the final model checkpoint at the end of training.Set whether to log your model's gradients, parameters, or neither.
false (default): No gradient or parameter logging gradients: Log histograms of the gradients all: Log histograms of gradients and parameters
@@ -192,4 +201,4 @@ This code generates these visualizations::
-Refer to the [Ignite Docs](https://pytorch.org/ignite/contrib/handlers.html#module-ignite.contrib.handlers.wandb_logger) for more details.
\ No newline at end of file
+Refer to the [Ignite Docs](https://pytorch.org/ignite/contrib/handlers.html#module-ignite.contrib.handlers.wandb_logger) for more details.
\ No newline at end of file
diff --git a/models/integrations/keras.mdx b/models/integrations/keras.mdx
index 2e30e4c202..038da00c01 100644
--- a/models/integrations/keras.mdx
+++ b/models/integrations/keras.mdx
@@ -1,17 +1,18 @@
---
title: Keras
description: "Use W&B Keras callbacks to track experiments, checkpoint models, and visualize predictions during training."
+keywords: ["tf.keras callback", "WandbMetricsLogger", "model graph logging"]
---
import { ColabLink } from '/snippets/_includes/colab-link.mdx';
{/*
-### Via the web app UI
+### W&B web app UI
-The web app UI has the same content as the `Visualizations` tab in Kubeflow Pipelines, but with more space. Learn [more about the web app UI here](/models/app).
+The web app UI has the same content as the **Visualizations** tab in Kubeflow Pipelines, but with more space. For details, see the [W&B web app documentation](/models/app).
@@ -130,13 +133,13 @@ The web app UI has the same content as the `Visualizations` tab in Kubeflow Pipe
-### Via the Public API (for programmatic access)
+### Public API
-* For programmatic access, [see our Public API](/models/ref/python/public-api/).
+For programmatic access, [see the Public API](/models/ref/python/public-api/).
-### Concept mapping from Kubeflow Pipelines to W&B
+## Concept mapping from Kubeflow Pipelines to W&B
-Here's a mapping of Kubeflow Pipelines concepts to W&B
+The following table maps Kubeflow Pipelines concepts to W&B.
| Kubeflow Pipelines | W&B | Location in W&B |
| ------------------ | --- | --------------- |
@@ -147,11 +150,11 @@ Here's a mapping of Kubeflow Pipelines concepts to W&B
## Fine-grain logging
-If you want finer control of logging, you can sprinkle in `wandb.log()` and `wandb.log_artifact()` calls in the component.
+The `@wandb_log` decorator handles inputs and outputs automatically, but it doesn't capture intermediate values such as training metrics across epochs. If you want finer control of logging, you can add `wandb.log()` and `wandb.log_artifact()` calls in the component.
### With explicit `wandb.log_artifact()` calls
-In this example below, we are training a model. The `@wandb_log` decorator will automatically track the relevant inputs and outputs. If you want to log the training process, you can explicitly add that logging like so:
+In the following example, you train a model. The `@wandb_log` decorator automatically tracks the relevant inputs and outputs. If you want to log the training process, you can explicitly add that logging like so:
```python
@wandb_log
@@ -173,9 +176,9 @@ def train_model(
run.log_artifact(model_artifact)
```
-### With implicit wandb integrations
+### With implicit `wandb` integrations
-If you're using a [framework integration we support](/models/integrations), you can also pass in the callback directly:
+If you're using a [supported framework integration](/models/integrations), you can also pass in the callback directly:
```python
@wandb_log
diff --git a/models/integrations/lightgbm.mdx b/models/integrations/lightgbm.mdx
index 2515f221b5..bfdef151be 100644
--- a/models/integrations/lightgbm.mdx
+++ b/models/integrations/lightgbm.mdx
@@ -1,12 +1,15 @@
---
description: "Integrate W&B with LightGBM to log gradient boosting metrics, feature importance, and model performance automatically."
title: LightGBM
+keywords: ["LGBMClassifier", "lightgbm plot", "boosting rounds"]
---
import { ColabLink } from '/snippets/_includes/colab-link.mdx';
+
### Sign up and create an API key
@@ -57,8 +62,10 @@ An API key authenticates your machine to W&B. You can generate an API key from y
True: Log instance variables that are a datasetFalseTrue: Log instance variables that are a modelFalseTrue: Log anything else that is serializable as a pickleFalsewandb.Settings(...): Specify your own wandb settings for this step or flowNone: Equivalent to passing wandb.Settings()By default, if:
settings.run_group is None, it will be set to \{flow_name\}/\{run_id\}settings.run_job_type is None, it will be set to \{run_job_type\}/\{step_name\}wandb.Settings(...): Specify your own wandb settings for this step or flowNone: Equivalent to passing wandb.Settings()By default, if:
settings.run_group is None, it's set to \{flow_name\}/\{run_id\}settings.run_job_type is None, it's set to \{run_job_type\}/\{step_name\}dict, list, set, str, int, float, boolpd.DataFramepathlib.Pathnn.Modulesklearn.base.BaseEstimator
+
-2. Create this job in your project:
+2. Create this job in your project. This registers the deployment job code with your W&B project so Launch can run it.
```bash
wandb job create -n "deploy-to-nvidia-nemo-inference-microservice" \
@@ -41,27 +43,28 @@ Deployment time varies by model and machine type. The base Llama2-7b config take
git https://github.com/wandb/launch-jobs
```
-3. Launch an agent on your GPU machine:
+3. Launch an agent on your GPU machine. The agent polls the queue and executes the deployment job when you submit it.
```bash
wandb launch-agent -e $ENTITY -p $PROJECT -q $QUEUE
```
-4. Submit the deployment launch job with your desired configs from the [Launch UI](https://wandb.ai/launch)
- 1. You can also submit via the CLI:
- ```bash
- wandb launch -d gcr.io/playground-111/deploy-to-nemo:latest \
- -e $ENTITY \
- -p $PROJECT \
- -q $QUEUE \
- -c $CONFIG_JSON_FNAME
- ```
-
-
-
+4. Submit the deployment launch job with your desired configurations from the [Launch UI](https://wandb.ai/launch). You can also submit through the CLI.
+
+ ```bash
+ wandb launch -d gcr.io/playground-111/deploy-to-nemo:latest \
+ -e $ENTITY \
+ -p $PROJECT \
+ -q $QUEUE \
+ -c $CONFIG_JSON_FNAME
+ ```
+
+
+
+
5. You can track the deployment process in the Launch UI.
-
+
-6. Once complete, you can immediately curl the endpoint to test the model. The model name is always `ensemble`.
+6. After the deployment completes, the NIM/Triton endpoint serves the model and is ready for inference requests. To test the model, `curl` the endpoint. The model name is always `ensemble`.
```bash
#!/bin/bash
curl -X POST "http://0.0.0.0:9999/v1/completions" \
diff --git a/models/integrations/openai-api.mdx b/models/integrations/openai-api.mdx
index b96846cd43..993a93db55 100644
--- a/models/integrations/openai-api.mdx
+++ b/models/integrations/openai-api.mdx
@@ -1,41 +1,44 @@
---
description: "Use W&B with the OpenAI API to log and monitor chat completions, fine-tuning jobs, and token usage metrics."
title: OpenAI API
+keywords: ["completions API", "embeddings API", "usage tracking"]
---
import { ColabLink } from '/snippets/_includes/colab-link.mdx';
+
## Install OpenAI Python API library
-The W&B autolog integration works with OpenAI version 0.28.1 and below.
+The W&B autolog integration works with OpenAI version 0.28.1 and earlier, so you must install a compatible version before enabling autologging.
-To install OpenAI Python API version 0.28.1, run:
-```python
+To install OpenAI Python API version 0.28.1:
+```bash
pip install openai==0.28.1
```
## Use the OpenAI Python API
-### 1. Import autolog and initialise it
-First, import `autolog` from `wandb.integration.openai` and initialise it.
+The following steps walk you through enabling autologging, calling the OpenAI API, and viewing the resulting traces in W&B.
+
+### Import and initialize autolog
+
+First, import `autolog` from `wandb.integration.openai` and initialize it. This sets up the W&B run that captures every subsequent OpenAI API call.
```python
import os
@@ -45,10 +48,11 @@ from wandb.integration.openai import autolog
autolog({"project": "gpt5"})
```
-You can optionally pass a dictionary with argument that `wandb.init()` accepts to `autolog`. This includes a project name, team name, entity, and more. For more information about [`wandb.init()`](/models/ref/python/functions/init), see the API Reference Guide.
+You can optionally pass a dictionary with arguments that `wandb.init()` accepts to `autolog`. This includes a project name, team name, entity, and more. For more information, see the [`wandb.init()` API reference](/models/ref/python/functions/init).
+
+### Call the OpenAI API
-### 2. Call the OpenAI API
-Each call you make to the OpenAI API is now logged to W&B automatically.
+With autolog enabled, W&B logs each call you make to the OpenAI API automatically. You don't need to add any logging code to your existing API calls.
```python
os.environ["OPENAI_API_KEY"] = "XXX"
@@ -65,17 +69,18 @@ chat_request_kwargs = dict(
response = openai.ChatCompletion.create(**chat_request_kwargs)
```
-### 3. View your OpenAI API inputs and responses
+### View your OpenAI API inputs and responses
-Click on the W&B [run](/models/runs/) link generated by `autolog` in **step 1**. This redirects you to your project workspace in the W&B App.
+After making one or more API calls, you can inspect the captured data in the W&B App.
-Select a run you created to view the trace table, trace timeline and the model architecture of the OpenAI LLM used.
+Click the W&B [run](/models/runs/) link generated by `autolog`. This redirects you to your project workspace in the W&B App.
+
+Select a run you created to view the trace table, trace timeline, and the model architecture of the OpenAI LLM used.
## Turn off autolog
-W&B recommends that you call `disable()` to close all W&B processes when you are finished using the OpenAI API.
+
+Call `disable()` to close all W&B processes when you're finished using the OpenAI API. This ensures that W&B flushes any pending data and doesn't capture further API calls unintentionally.
```python
autolog.disable()
-```
-
-Now your inputs and completions will be logged to W&B, ready for analysis or to be shared with colleagues.
\ No newline at end of file
+```
\ No newline at end of file
diff --git a/models/integrations/openai-fine-tuning.mdx b/models/integrations/openai-fine-tuning.mdx
index 653bdecc3f..1dd0b65567 100644
--- a/models/integrations/openai-fine-tuning.mdx
+++ b/models/integrations/openai-fine-tuning.mdx
@@ -1,15 +1,16 @@
---
description: "Fine-tune OpenAI models with W&B to log training metrics, monitor jobs, and compare model performance over time."
-title: OpenAI Fine-Tuning
+title: OpenAI fine-tuning
+keywords: ["ft:gpt", "fine-tuning job events", "OpenAI evals"]
---
import { ColabLink } from '/snippets/_includes/colab-link.mdx';
@@ -99,7 +104,7 @@ The training and validation data that you upload to OpenAI for fine-tuning are a
### Visualization
-The datasets are visualized as W&B Tables, which allows you to explore, search, and interact with the dataset. Check out the training samples visualized using W&B Tables below.
+W&B visualizes the datasets as W&B Tables, which lets you explore, search, and interact with the dataset. The following image shows training samples visualized in W&B Tables.
@@ -108,9 +113,9 @@ The datasets are visualized as W&B Tables, which allows you to explore, search,
## The fine-tuned model and model versioning
-OpenAI gives you an id of the fine-tuned model. Since we don't have access to the model weights, the `WandbLogger` creates a `model_metadata.json` file with all the details (hyperparameters, data file ids, etc.) of the model along with the `fine_tuned_model`` id and is logged as a W&B Artifact.
+OpenAI doesn't expose the underlying weights of a fine-tuned model, so W&B tracks the model by capturing its metadata instead. OpenAI gives you an ID of the fine-tuned model. Since you don't have access to the model weights, the `WandbLogger` creates a `model_metadata.json` file with all the details (hyperparameters, data file IDs, and so on) of the model along with the `fine_tuned_model` ID, and logs it as a W&B Artifact.
-This model (metadata) artifact can further be linked to a model in the [W&B Registry](/models/registry/).
+You can link this model (metadata) artifact to a model in the [W&B Registry](/models/registry/).
@@ -119,58 +124,60 @@ This model (metadata) artifact can further be linked to a model in the [W&B Regi
## Frequently asked questions
-### How do I share my fine-tune results with my team in W&B?
+The following sections answer common questions about sharing, organizing, and recovering fine-tuning runs synced from OpenAI.
+
+### Share fine-tune results with your team
Log your fine-tune jobs to your team account with:
```python
-WandbLogger.sync(entity="YOUR_TEAM_NAME")
+WandbLogger.sync(entity="[YOUR-TEAM-NAME]")
```
-### How can I organize my runs?
+### Organize your runs
-Your W&B runs are automatically organized and can be filtered/sorted based on any configuration parameter such as job type, base model, learning rate, training filename and any other hyper-parameter.
+W&B automatically organizes your runs. You can filter and sort them based on any configuration parameter such as job type, base model, learning rate, training filename, and any other hyperparameter.
-In addition, you can rename your runs, add notes or create tags to group them.
+You can also rename your runs, add notes, or create tags to group them.
-Once you’re satisfied, you can save your workspace and use it to create report, importing data from your runs and saved artifacts (training/validation files).
+Once you're satisfied, save your workspace and use it to create a report, importing data from your runs and saved artifacts (training and validation files).
-### How can I access my fine-tuned model?
+### Access your fine-tuned model
-Fine-tuned model ID is logged to W&B as artifacts (`model_metadata.json`) as well config.
+W&B logs the fine-tuned model ID as artifacts (`model_metadata.json`) and as config.
```python
import wandb
-with wandb.init(project="OpenAI-Fine-Tune", entity="YOUR_TEAM_NAME") as run:
- ft_artifact = run.use_artifact("ENTITY/PROJECT/model_metadata:VERSION")
+with wandb.init(project="OpenAI-Fine-Tune", entity="[YOUR-TEAM-NAME]") as run:
+ ft_artifact = run.use_artifact("[ENTITY]/[PROJECT]/model_metadata:[VERSION]")
artifact_dir = ft_artifact.download()
```
-where `VERSION` is either:
+The `[VERSION]` placeholder is one of the following:
-* a version number such as `v2`
-* the fine-tune id such as `ft-xxxxxxxxx`
-* an alias added automatically such as `latest` or manually
+* A version number such as `v2`.
+* The fine-tune ID such as `ft-xxxxxxxxx`.
+* An alias added automatically such as `latest`, or added manually.
-You can then access `fine_tuned_model` id by reading the downloaded `model_metadata.json` file.
+You can then access the `fine_tuned_model` ID by reading the downloaded `model_metadata.json` file.
-### What if a fine-tune was not synced successfully?
+### Recover a fine-tune that didn't sync
-If a fine-tune was not logged to W&B successfully, you can use the `overwrite=True` and pass the fine-tune job id:
+If a fine-tune wasn't logged to W&B successfully, use `overwrite=True` and pass the fine-tune job ID:
```python
WandbLogger.sync(
- fine_tune_job_id="FINE_TUNE_JOB_ID",
+ fine_tune_job_id="[FINE-TUNE-JOB-ID]",
overwrite=True,
)
```
-### Can I track my datasets and models with W&B?
+### Track datasets and models with W&B
-The training and validation data are logged automatically to W&B as artifacts. The metadata including the ID for the fine-tuned model is also logged as artifacts.
+W&B logs the training and validation data automatically as artifacts. W&B also logs the metadata, including the ID for the fine-tuned model, as artifacts.
-You can always control the pipeline using low level wandb APIs like `wandb.Artifact`, `wandb.Run.log`, etc. This will allow complete traceability of your data and models.
+You can also control the pipeline with low-level `wandb` APIs like `wandb.Artifact`, `wandb.Run.log`, and so on. This gives you full traceability of your data and models.
@@ -178,6 +185,8 @@ You can always control the pipeline using low level wandb APIs like `wandb.Artif
## Resources
-* [OpenAI Fine-tuning Documentation](https://platform.openai.com/docs/guides/fine-tuning/) is very thorough and contains many useful tips
-* [Demo Colab](https://wandb.me/openai-colab)
-* [How to Fine-Tune Your OpenAI GPT-3.5 and GPT-4 Models with W&B](https://wandb.me/openai-report) report
\ No newline at end of file
+For deeper background and end-to-end examples, see the following resources.
+
+* [OpenAI Fine-tuning Documentation](https://platform.openai.com/docs/guides/fine-tuning/) for thorough guidance and tips.
+* [Demo Colab](https://wandb.me/openai-colab).
+* [How to Fine-Tune Your OpenAI GPT-3.5 and GPT-4 Models with W&B](https://wandb.me/openai-report) report.
\ No newline at end of file
diff --git a/models/integrations/openai-gym.mdx b/models/integrations/openai-gym.mdx
index baccd864a8..1cef5af40d 100644
--- a/models/integrations/openai-gym.mdx
+++ b/models/integrations/openai-gym.mdx
@@ -1,19 +1,22 @@
---
description: "Integrate W&B with OpenAI Gym to track reinforcement learning experiments and record episode performance videos."
title: OpenAI Gym
+keywords: ["classic gym", "gym Monitor", "RL episode video"]
---
diff --git a/models/integrations/paddledetection.mdx b/models/integrations/paddledetection.mdx
index 5770315782..b9bcc8c169 100644
--- a/models/integrations/paddledetection.mdx
+++ b/models/integrations/paddledetection.mdx
@@ -1,6 +1,7 @@
---
description: "Integrate W&B with PaddleDetection to track object detection model training, log metrics, and visualize results."
title: PaddleDetection
+keywords: ["PP-YOLO", "PaddlePaddle", "detection model zoo"]
---
import { ColabLink } from '/snippets/_includes/colab-link.mdx';
@@ -8,13 +9,13 @@ import ApiKeyCreateStreamlined from "/snippets/_includes/api-key-create-streamli
diff --git a/models/integrations/paddleocr.mdx b/models/integrations/paddleocr.mdx
index 2bc8851964..a936582e4b 100644
--- a/models/integrations/paddleocr.mdx
+++ b/models/integrations/paddleocr.mdx
@@ -1,15 +1,18 @@
---
description: "Integrate W&B with PaddleOCR to track OCR model training, log recognition metrics, and visualize predictions."
title: PaddleOCR
+keywords: ["PP-OCR", "text detection", "PaddlePaddle"]
---
import ApiKeyCreateStreamlined from "/snippets/_includes/api-key-create-streamlined.mdx";
-[PaddleOCR](https://github.com/PaddlePaddle/PaddleOCR) aims to create multilingual, awesome, leading, and practical OCR tools that help users train better models and apply them into practice implemented in PaddlePaddle. PaddleOCR support a variety of cutting-edge algorithms related to OCR, and developed industrial solution. PaddleOCR now comes with a W&B integration for logging training and evaluation metrics along with model checkpoints with corresponding metadata.
+[PaddleOCR](https://github.com/PaddlePaddle/PaddleOCR) provides multilingual, practical OCR tools that help users train models and apply them in production, implemented in PaddlePaddle. PaddleOCR supports a range of OCR algorithms and includes industrial solutions. PaddleOCR includes a W&B integration for logging training and evaluation metrics along with model checkpoints and corresponding metadata.
-## Example blog & Colab
+This page shows you how to enable the W&B integration in PaddleOCR so that your OCR training runs automatically stream metrics, validation results, and checkpoint metadata to a W&B dashboard. Use this integration to compare experiments, monitor training in real time, and keep a versioned history of your OCR models.
-[Read here](https://wandb.ai/manan-goel/text_detection/reports/Train-and-Debug-Your-OCR-Models-with-PaddleOCR-and-W-B--VmlldzoyMDUwMDIw) to see how to train a model with PaddleOCR on the ICDAR2015 dataset. This also comes with a [Google Colab](https://colab.research.google.com/drive/1id2VTIQ5-M1TElAkzjzobUCdGeJeW-nV?usp=sharing) and the corresponding live W&B dashboard is available [here](https://wandb.ai/manan-goel/text_detection). There is also a Chinese version of this blog here: [W&B对您的OCR模型进行训练和调试](https://wandb.ai/wandb_fc/chinese/reports/W-B-OCR---VmlldzoyMDk1NzE4)
+## Example blog and Colab
+
+See the [PaddleOCR and W&B training tutorial](https://wandb.ai/manan-goel/text_detection/reports/Train-and-Debug-Your-OCR-Models-with-PaddleOCR-and-W-B--VmlldzoyMDUwMDIw) for how to train a model with PaddleOCR on the ICDAR2015 dataset. This also comes with a [Google Colab](https://colab.research.google.com/drive/1id2VTIQ5-M1TElAkzjzobUCdGeJeW-nV?usp=sharing) and the corresponding live [W&B dashboard](https://wandb.ai/manan-goel/text_detection). A Chinese version of this blog is also available: [W&B对您的OCR模型进行训练和调试](https://wandb.ai/wandb_fc/chinese/reports/W-B-OCR---VmlldzoyMDk1NzE4).
## Sign up and create an API key
@@ -25,18 +28,18 @@ An API key authenticates your machine to W&B. You can generate an API key from y
To install the `wandb` library locally and log in:
@@ -98,7 +101,7 @@ Once you run your `train.py` file with W&B turned on, a link will be generated t
-
+
## Feedback or issues
diff --git a/models/integrations/prodigy.mdx b/models/integrations/prodigy.mdx
index bf74d1811e..6239e7c284 100644
--- a/models/integrations/prodigy.mdx
+++ b/models/integrations/prodigy.mdx
@@ -1,13 +1,14 @@
---
description: "Integrate W&B with Prodigy to track annotation workflows, log training metrics, and manage labeled datasets."
title: Prodigy
+keywords: ["annotation tool", "prodigy train", "W&B Tables"]
---
-[Prodigy](https://prodi.gy/) is an annotation tool for creating training and evaluation data for machine learning models, error analysis, data inspection & cleaning. [W&B Tables](/models/tables/tables-walkthrough/) allow you to log, visualize, analyze, and share datasets (and more!) inside W&B.
+[Prodigy](https://prodi.gy/) is an annotation tool for creating training and evaluation data for machine learning models, error analysis, and data inspection and cleaning. [W&B Tables](/models/tables/tables-walkthrough/) let you log, visualize, analyze, and share datasets (and more) inside W&B.
-The [W&B integration with Prodigy](https://github.com/wandb/wandb/blob/master/wandb/integration/prodigy/prodigy.py) adds simple and easy-to-use functionality to upload your Prodigy-annotated dataset directly to W&B for use with Tables.
+This guide shows you how to use the [W&B integration with Prodigy](https://github.com/wandb/wandb/blob/master/wandb/integration/prodigy/prodigy.py) to upload your Prodigy-annotated dataset directly to W&B so you can explore and share it as an interactive Table. Use this when you want to inspect annotation quality, compare versions of a labeled dataset, or share results with collaborators.
-Run a few lines of code, like these:
+With a few lines of code, like these:
```python
import wandb
@@ -17,7 +18,7 @@ with wandb.init(project="prodigy"):
upload_dataset("news_headlines_ner")
```
-and get visual, interactive, shareable tables like this one:
+you can produce visual, interactive, shareable tables like this one:
@@ -25,10 +26,10 @@ and get visual, interactive, shareable tables like this one:
## Quickstart
-Use `wandb.integration.prodigy.upload_dataset` to upload your annotated prodigy dataset directly from the local Prodigy database to W&B in our [Table](/models/ref/python/data-types/table) format. For more information on Prodigy, including installation & setup, please refer to the [Prodigy documentation](https://prodi.gy/docs/).
+Use `wandb.integration.prodigy.upload_dataset` to upload your annotated Prodigy dataset directly from the local Prodigy database to W&B in the [Table](/models/ref/python/data-types/table) format. For more information about Prodigy, including installation and setup, see the [Prodigy documentation](https://prodi.gy/docs/).
-W&B will automatically try to convert images and named entity fields to [`wandb.Image`](/models/ref/python/data-types/image) and [`wandb.Html`](/models/ref/python/data-types/html)respectively. Extra columns may be added to the resulting table to include these visualizations.
+When you upload a dataset, W&B automatically converts images and named entity fields to [`wandb.Image`](/models/ref/python/data-types/image) and [`wandb.Html`](/models/ref/python/data-types/html) respectively, so they render as interactive visualizations in your Table. W&B may add extra columns to the resulting table to include these visualizations.
## Read through a detailed example
-Explore the [Visualizing Prodigy Datasets Using W&B Tables](https://wandb.ai/kshen/prodigy/reports/Visualizing-Prodigy-Datasets-Using-W-B-Tables--Vmlldzo5NDE2MTc) for example visualizations generated with W&B Prodigy integration.
\ No newline at end of file
+To see what's possible with the integration, explore the [Visualizing Prodigy Datasets Using W&B Tables](https://wandb.ai/kshen/prodigy/reports/Visualizing-Prodigy-Datasets-Using-W-B-Tables--Vmlldzo5NDE2MTc) report for example visualizations generated with the W&B Prodigy integration.
\ No newline at end of file
diff --git a/models/integrations/pytorch-geometric.mdx b/models/integrations/pytorch-geometric.mdx
index 250a5c636a..01f02f755e 100644
--- a/models/integrations/pytorch-geometric.mdx
+++ b/models/integrations/pytorch-geometric.mdx
@@ -1,13 +1,16 @@
---
title: PyTorch Geometric
description: "Integrate W&B with PyTorch Geometric for graph visualization and experiment tracking in geometric deep learning."
+keywords: ["GNN", "PyG", "node embedding"]
---
import ApiKeyCreateStreamlined from "/snippets/_includes/api-key-create-streamlined.mdx";
-[PyTorch Geometric](https://github.com/pyg-team/pytorch_geometric) or PyG is one of the most popular libraries for geometric deep learning and W&B works extremely well with it for visualizing graphs and tracking experiments.
+[PyTorch Geometric](https://github.com/pyg-team/pytorch_geometric) (PyG) is a library for geometric deep learning, and W&B works with it for visualizing graphs and tracking experiments.
-After you have installed PyTorch Geometric, follow these steps to get started.
+This guide shows you how to authenticate to W&B, install the `wandb` library, visualize PyG graphs with PyVis or Plotly, and log training metrics from your PyG workflows. It's intended for PyG users who want to track experiments and share graph visualizations in W&B.
+
+After you install PyTorch Geometric, follow these steps to get started.
## Sign up and create an API key
@@ -27,14 +30,14 @@ To install the `wandb` library locally and log in:
1. Set the `WANDB_API_KEY` [environment variable](/models/track/environment-variables/) to your API key.
```bash
- export WANDB_API_KEY=
+With graph visualizations and training metrics logged to W&B, you can compare runs and share results from your PyG experiments in your W&B workspace.
+
## More resources
+The following W&B reports show PyG in action:
+
- [Recommending Amazon Products using Graph Neural Networks in PyTorch Geometric](https://wandb.ai/manan-goel/gnn-recommender/reports/Recommending-Amazon-Products-using-Graph-Neural-Networks-in-PyTorch-Geometric--VmlldzozMTA3MzYw#what-does-the-data-look-like?)
- [Point Cloud Classification using PyTorch Geometric](https://wandb.ai/geekyrakshit/pyg-point-cloud/reports/Point-Cloud-Classification-using-PyTorch-Geometric--VmlldzozMTExMTE3)
- [Point Cloud Segmentation using PyTorch Geometric](https://wandb.ai/wandb/point-cloud-segmentation/reports/Point-Cloud-Segmentation-using-Dynamic-Graph-CNN--VmlldzozMTk5MDcy)
diff --git a/models/integrations/pytorch.mdx b/models/integrations/pytorch.mdx
index bd5718c7e5..3f6116b605 100644
--- a/models/integrations/pytorch.mdx
+++ b/models/integrations/pytorch.mdx
@@ -1,6 +1,7 @@
---
title: PyTorch
description: "Integrate W&B with PyTorch for experiment tracking, dataset versioning, and logging of metrics, gradients, and models."
+keywords: ["torch training loop", "wandb.watch", "MNIST tutorial"]
---
import { ColabLink } from '/snippets/_includes/colab-link.mdx';
@@ -14,7 +15,7 @@ Use [W&B](https://wandb.ai) for machine learning experiment tracking, dataset ve
## What this notebook covers
-We show you how to integrate W&B with your PyTorch code to add experiment tracking to your pipeline.
+This tutorial walks you through integrating W&B with your PyTorch training code so you can track experiments, log metrics and gradients, and version models. It's intended for PyTorch users who want to add experiment tracking to an existing pipeline.
@@ -52,10 +53,11 @@ with wandb.init(project="new-sota-model", config=config) as run:
Follow along with a [video tutorial](https://wandb.me/pytorch-video).
-**Note**: Sections starting with _Step_ are all you need to integrate W&B in an existing pipeline. The rest just loads data and defines a model.
+Sections starting with _Step_ are all you need to integrate W&B in an existing pipeline. The rest loads data and defines a model.
## Install, import, and log in
+Before defining the experiment, set up the environment and authenticate with W&B.
```python
import os
@@ -85,24 +87,21 @@ torchvision.datasets.MNIST.mirrors = [mirror for mirror in torchvision.datasets.
### Step 0: Install W&B
-To get started, we'll need to get the library.
-`wandb` is easily installed using `pip`.
+To get started, you must install the `wandb` library with `pip`.
```python
!pip install wandb onnx -Uq
```
-### Step 1: Import W&B and Login
+### Step 1: Import W&B and log in
-In order to log data to our web service,
-you'll need to log in.
+To log data to the W&B service, you must log in.
-If this is your first time using W&B,
-you'll need to sign up for a free account at the link that appears.
+If this is your first time using W&B, sign up for a free account at the link that appears.
-```
+```python
import wandb
wandb.login()
@@ -110,23 +109,17 @@ wandb.login()
## Define the experiment and pipeline
+With W&B installed and your session authenticated, define the experiment configuration and the training pipeline that will use it.
+
### Track metadata and hyperparameters with `wandb.init()`
-Programmatically, the first thing we do is define our experiment:
-what are the hyperparameters? what metadata is associated with this run?
+Programmatically, define your experiment first. What are the hyperparameters? What metadata is associated with this run?
-It's a pretty common workflow to store this information in a `config` dictionary
-(or similar object)
-and then access it as needed.
+A common workflow is to store this information in a `config` dictionary (or similar object) and then access it as needed.
-For this example, we're only letting a few hyperparameters vary
-and hand-coding the rest.
-But any part of your model can be part of the `config`.
+This example varies only a few hyperparameters and hand-codes the rest. Any part of your model can be part of the `config`.
-We also include some metadata: we're using the MNIST dataset and a convolutional
-architecture. If we later work with, say,
-fully connected architectures on CIFAR in the same project,
-this will help us separate our runs.
+The example also includes metadata for the MNIST dataset and a convolutional architecture. If you later work with, say, fully connected architectures on CIFAR in the same project, this metadata helps you separate your runs.
```python
@@ -140,14 +133,13 @@ config = dict(
architecture="CNN")
```
-Now, let's define the overall pipeline,
-which is pretty typical for model-training:
+Next, define the overall pipeline, which is typical for model-training:
-1. we first `make` a model, plus associated data and optimizer, then
-2. we `train` the model accordingly and finally
+1. `make` a model, plus associated data and optimizer.
+2. `train` the model accordingly.
3. `test` it to see how training went.
-We'll implement these functions below.
+The following code implements these functions.
```python
@@ -171,26 +163,15 @@ def model_pipeline(hyperparameters):
return model
```
-The only difference here from a standard pipeline
-is that it all occurs inside the context of `wandb.init()`.
-Calling this function sets up a line of communication
-between your code and our servers.
+The only difference here from a standard pipeline is that it all occurs inside the context of `wandb.init()`. Calling this function sets up a line of communication between your code and W&B servers.
-Passing the `config` dictionary to `wandb.init()`
-immediately logs all that information to us,
-so you'll always know what hyperparameter values
-you set your experiment to use.
+Passing the `config` dictionary to `wandb.init()` immediately logs all that information to W&B, so you always know what hyperparameter values you set your experiment to use.
-To ensure the values you chose and logged are always the ones that get used
-in your model, we recommend using the `run.config` copy of your object.
-Check the definition of `make` below to see some examples.
+To ensure the values you chose and logged are always the ones used in your model, W&B recommends using the `run.config` copy of your object. Check the following definition of `make` to see some examples.
-> *Side Note*: We take care to run our code in separate processes,
-so that any issues on our end
-(such as if a giant sea monster attacks our data centers)
-don't crash your code.
-Once the issue is resolved, such as when the Kraken returns to the deep,
-you can log the data with `wandb sync`.
+With the pipeline defined, the next sections implement each of its steps in turn: data and model setup, training, and testing.
+
+> *Side Note*: W&B runs its code in separate processes so that any issues on the W&B side don't crash your code. Once the issue is resolved, you can log the data with `wandb sync`.
```python
@@ -213,11 +194,9 @@ def make(config):
### Define the data loading and model
-Now, we need to specify how the data is loaded and what the model looks like.
+Next, specify how the data is loaded and what the model looks like.
-This part is very important, but it's
-no different from what it would be without `wandb`,
-so we won't dwell on it.
+This part is important, but it's no different from what it would be without `wandb`.
```python
@@ -241,13 +220,7 @@ def make_loader(dataset, batch_size):
return loader
```
-Defining the model is normally the fun part.
-
-But nothing changes with `wandb`,
-so we're gonna stick with a standard ConvNet architecture.
-
-Don't be afraid to mess around with this and try some experiments --
-all your results will be logged on [wandb.ai](https://wandb.ai).
+Defining the model doesn't change with `wandb`, so this example uses a standard ConvNet architecture. Experiment freely with this code. W&B logs all your results on [wandb.ai](https://wandb.ai).
@@ -279,21 +252,17 @@ class ConvNet(nn.Module):
### Define training logic
-Moving on in our `model_pipeline`, it's time to specify how we `train`.
+Moving on in the `model_pipeline`, it's time to specify how to `train`. This is where the W&B integration tracks gradients, parameters, and metrics as training proceeds.
Two `wandb` functions come into play here: `watch` and `log`.
-## Track gradients with `run.watch()` and everything else with `run.log()`
+### Track gradients with `run.watch()` and everything else with `run.log()`
-`run.watch()` will log the gradients and the parameters of your model,
-every `log_freq` steps of training.
+`run.watch()` logs the gradients and the parameters of your model every `log_freq` steps of training.
All you need to do is call it before you start training.
-The rest of the training code remains the same:
-we iterate over epochs and batches,
-running forward and backward passes
-and applying our `optimizer`.
+The rest of the training code remains the same: iterate over epochs and batches, run forward and backward passes, and apply your `optimizer`.
```python
@@ -335,17 +304,11 @@ def train_batch(images, labels, model, optimizer, criterion):
return loss
```
-The only difference is in the logging code:
-where previously you might have reported metrics by printing to the terminal,
-now you pass the same information to `run.log()`.
+The only difference is in the logging code: where previously you might have reported metrics by printing to the terminal, now you pass the same information to `run.log()`.
-`run.log()` expects a dictionary with strings as keys.
-These strings identify the objects being logged, which make up the values.
-You can also optionally log which `step` of training you're on.
+`run.log()` expects a dictionary with strings as keys. These strings identify the objects being logged, which make up the values. You can also optionally log which `step` of training you're on.
-> *Side Note*: I like to use the number of examples the model has seen,
-since this makes for easier comparison across batch sizes,
-but you can use raw steps or batch count. For longer training runs, it can also make sense to log by `epoch`.
+> *Side Note*: Using the number of examples the model has seen makes for easier comparison across batch sizes, but you can use raw steps or batch count. For longer training runs, it can also make sense to log by `epoch`.
```python
@@ -359,25 +322,17 @@ def train_log(loss, example_ct, epoch):
### Define testing logic
-Once the model is done training, we want to test it:
-run it against some fresh data from production, perhaps,
-or apply it to some hand-curated examples.
+Once the model is done training, test it: run it against some fresh data from production, perhaps, or apply it to some hand-curated examples. Testing also gives you a natural point at which to save the trained model.
-## (Optional) Call `run.save()`
+### Optional: Call `run.save()`
-This is also a great time to save the model's architecture
-and final parameters to disk.
-For maximum compatibility, we'll `export` our model in the
-[Open Neural Network eXchange (ONNX) format](https://onnx.ai/).
+This is also a good time to save the model's architecture and final parameters to disk. For broad compatibility, `export` the model in the [Open Neural Network eXchange (ONNX) format](https://onnx.ai/).
-Passing that filename to `run.save()` ensures that the model parameters
-are saved to W&B's servers: no more losing track of which `.h5` or `.pb`
-corresponds to which training runs.
+Passing that filename to `run.save()` ensures that the model parameters are saved to W&B servers: no more losing track of which `.h5` or `.pb` corresponds to which training runs.
-For more advanced `wandb` features for storing, versioning, and distributing
-models, check out our [Artifacts tools](https://www.wandb.com/artifacts).
+For more advanced `wandb` features for storing, versioning, and distributing models, check out [Artifacts tools](https://www.wandb.com/artifacts).
```python
@@ -407,24 +362,18 @@ def test(model, test_loader):
### Run training and watch your metrics live on wandb.ai
-Now that we've defined the whole pipeline and slipped in
-those few lines of W&B code,
-we're ready to run our fully tracked experiment.
+Now that you've defined the whole pipeline and added those few lines of W&B code, you're ready to run your fully tracked experiment.
-We'll report a few links to you:
-our documentation,
-the Project page, which organizes all the runs in a project, and
-the Run page, where this run's results will be stored.
+W&B reports a few links to you: the documentation, the Project page (which organizes all the runs in a project), and the Run page (where this run's results are stored).
Navigate to the Run page and check out these tabs:
-1. **Charts**, where the model gradients, parameter values, and loss are logged throughout training
-2. **System**, which contains a variety of system metrics, including Disk I/O utilization, CPU and GPU metrics (watch that temperature soar), and more
-3. **Logs**, which has a copy of anything pushed to standard out during training
-4. **Files**, where, once training is complete, you can click on the `model.onnx` to view our network with the [Netron model viewer](https://github.com/lutzroeder/netron).
+1. **Charts**, where the model gradients, parameter values, and loss are logged throughout training.
+2. **System**, which contains system metrics including Disk I/O utilization and CPU and GPU metrics.
+3. **Logs**, which has a copy of anything pushed to standard out during training.
+4. **Files**, where, once training is complete, you can click the `model.onnx` to view your network with the [Netron model viewer](https://github.com/lutzroeder/netron).
-Once the run in finished, when the `with wandb.init()` block exits,
-we'll also print a summary of the results in the cell output.
+Once the run is finished, when the `with wandb.init()` block exits, W&B also prints a summary of the results in the cell output.
```python
@@ -432,25 +381,19 @@ we'll also print a summary of the results in the cell output.
model = model_pipeline(config)
```
-### Test Hyperparameters with Sweeps
+### Test hyperparameters with sweeps
-We only looked at a single set of hyperparameters in this example.
-But an important part of most ML workflows is iterating over
-a number of hyperparameters.
+This example only looked at a single set of hyperparameters. An important part of most ML workflows is iterating over several hyperparameters.
-You can use W&B Sweeps to automate hyperparameter testing and explore the space of possible models and optimization strategies.
+You can use W&B Sweeps to automate hyperparameter testing and explore the space of possible models and optimization strategies. This lets you scale beyond the preceding single-configuration run.
Check out a [Colab notebook demonstrating hyperparameter optimization using W&B Sweeps](https://wandb.me/sweeps-colab).
-Running a hyperparameter sweep with W&B is very easy. There are just 3 simple steps:
-
-1. **Define the sweep:** We do this by creating a dictionary or a [YAML file](/models/sweeps/define-sweep-configuration/) that specifies the parameters to search through, the search strategy, the optimization metric et all.
+Running a hyperparameter sweep with W&B takes three steps:
-2. **Initialize the sweep:**
-`sweep_id = wandb.sweep(sweep_config)`
-
-3. **Run the sweep agent:**
-`wandb.agent(sweep_id, function=train)`
+1. **Define the sweep:** Create a dictionary or a [YAML file](/models/sweeps/define-sweep-configuration/) that specifies the parameters to search through, the search strategy, the optimization metric, and more.
+2. **Initialize the sweep:** `sweep_id = wandb.sweep(sweep_config)`.
+3. **Run the sweep agent:** `wandb.agent(sweep_id, function=train)`.
That's all there is to running a hyperparameter sweep.
@@ -461,10 +404,12 @@ That's all there is to running a hyperparameter sweep.
## Example gallery
-Explore examples of projects tracked and visualized with W&B in our [Gallery →](https://app.wandb.ai/gallery).
+Explore examples of projects tracked and visualized with W&B in the [Gallery](https://app.wandb.ai/gallery).
## Advanced setup
-1. [Environment variables](/platform/hosting/env-vars/): Set API keys in environment variables so you can run training on a managed cluster.
-2. [Offline mode](/support/models/articles/can-i-run-wandb-offline): Use `dryrun` mode to train offline and sync results later.
-3. [On-prem](/platform/hosting/hosting-options/self-managed): Install W&B in a private cloud or air-gapped servers in your own infrastructure. We have local installations for everyone from academics to enterprise teams.
-4. [Sweeps](/models/sweeps/): Set up hyperparameter search quickly with our lightweight tool for tuning.
+
+The following options can extend the preceding basic workflow for production, offline, or managed environments:
+- [Environment variables](/platform/hosting/env-vars/): Set API keys in environment variables so you can run training on a managed cluster.
+- [Offline mode](/support/models/articles/can-i-run-wandb-offline): Use `dryrun` mode to train offline and sync results later.
+- [On-premises](/platform/hosting/hosting-options/self-managed): Install W&B in a private cloud or air-gapped servers in your own infrastructure.
+- [Sweeps](/models/sweeps/): Set up hyperparameter search quickly with a lightweight tool for tuning.
diff --git a/models/integrations/ray-tune.mdx b/models/integrations/ray-tune.mdx
index c0e742e5ba..b1fe0d25f5 100644
--- a/models/integrations/ray-tune.mdx
+++ b/models/integrations/ray-tune.mdx
@@ -1,36 +1,36 @@
---
description: "Integrate W&B with Ray Tune to track hyperparameter tuning trials, log metrics, and compare experiment results."
title: Ray Tune
+keywords: ["TuneCallback", "ASHA scheduler", "ray train"]
---
-W&B integrates with [Ray](https://github.com/ray-project/ray) by offering two lightweight integrations.
+This page describes how to use W&B with [Ray](https://github.com/ray-project/ray) Tune so you can track hyperparameter tuning trials, log metrics, and compare experiment results across runs. W&B offers two lightweight integrations with Ray, and you can choose the one that best fits your training workflow:
-- The`WandbLoggerCallback` function automatically logs metrics reported to Tune to the Wandb API.
-- The `setup_wandb()` function, which can be used with the function API, automatically initializes the Wandb API with Tune's training information. You can use the Wandb API as usual. such as by using `run.log()` to log your training process.
+- The `WandbLoggerCallback` function automatically logs metrics reported to Tune to the W&B API.
+- The `setup_wandb()` function, which you can use with the function API, automatically initializes the W&B API with Tune's training information. You can use the W&B API as usual, such as by calling `run.log()` to log your training process.
## Configure the integration
+This section describes how to configure the `WandbLoggerCallback`, which is the most direct way to send Tune trial metrics to W&B.
+
```python
from ray.air.integrations.wandb import WandbLoggerCallback
```
-Wandb configuration is done by passing a wandb key to the config parameter of `tune.run()` (see example below).
+To configure W&B, pass a wandb key to the config parameter of `tune.run()`. See the [example](#example) for usage.
-The content of the wandb config entry is passed to `wandb.init()` as keyword arguments. The exception are the following settings, which are used to configure the `WandbLoggerCallback` itself:
+The integration passes the content of the wandb config entry to `wandb.init()` as keyword arguments. The exceptions are the settings that configure the `WandbLoggerCallback` itself.
### Parameters
-`project (str)`: Name of the Wandb project. Mandatory.
-
-`api_key_file (str)`: Path to file containing the Wandb API KEY.
-
-`api_key (str)`: Wandb API Key. Alternative to setting `api_key_file`.
+The `WandbLoggerCallback` accepts the following parameters:
-`excludes (list)`: List of metrics to exclude from the log.
-
-`log_config (bool)`: Whether to log the config parameter of the results dictionary. Defaults to False.
-
-`upload_checkpoints (bool)`: If True, model checkpoints are uploaded as artifacts. Defaults to False.
+- `project (str)`: Name of the W&B project. Required.
+- `api_key_file (str)`: Path to file containing the W&B API key.
+- `api_key (str)`: W&B API key. Alternative to setting `api_key_file`.
+- `excludes (list)`: List of metrics to exclude from the log.
+- `log_config (bool)`: Whether to log the config parameter of the results dictionary. Defaults to `False`.
+- `upload_checkpoints (bool)`: If `True`, uploads model checkpoints as artifacts. Defaults to `False`.
### Example
@@ -53,7 +53,7 @@ tuner = tune.Tuner(
run_config=train.RunConfig(
callbacks=[
WandbLoggerCallback(
- project="
-Trains model on datasets of varying lengths and generates a plot of cross validated scores vs dataset size, for both training and test sets.
+Trains model on datasets of varying lengths and generates a plot of cross-validated scores versus dataset size, for both training and test sets.
`wandb.sklearn.plot_learning_curve(model, X, y)`
@@ -172,7 +181,7 @@ Trains model on datasets of varying lengths and generates a plot of cross valida
-ROC curves plot true positive rate (y-axis) vs false positive rate (x-axis). The ideal score is a TPR = 1 and FPR = 0, which is the point on the top left. Typically we calculate the area under the ROC curve (AUC-ROC), and the greater the AUC-ROC the better.
+ROC curves plot true positive rate (y-axis) versus false positive rate (x-axis). The ideal score is a TPR = 1 and FPR = 0, which is the point on the top left. You calculate the area under the ROC curve (AUC-ROC), and the greater the AUC-ROC the better.
`wandb.sklearn.plot_roc(y_true, y_probas, labels)`
@@ -202,7 +211,7 @@ Plots the distribution of target classes in training and test sets. Useful for d
Computes the tradeoff between precision and recall for different thresholds. A high area under the curve represents both high recall and high precision, where high precision relates to a low false positive rate, and high recall relates to a low false negative rate.
-High scores for both show that the classifier is returning accurate results (high precision), as well as returning a majority of all positive results (high recall). PR curve is useful when the classes are very imbalanced.
+High scores for both show that the classifier is returning accurate results (high precision), as well as returning a majority of all positive results (high recall). The precision-recall curve is useful when the classes are imbalanced.
`wandb.sklearn.plot_precision_recall(y_true, y_probas, labels)`
@@ -216,7 +225,7 @@ High scores for both show that the classifier is returning accurate results (hig
-Evaluates and plots the importance of each feature for the classification task. Only works with classifiers that have a `feature_importances_` attribute, like trees.
+Evaluates and plots the importance of each feature for the classification task. Only works with classifiers that have a `feature_importances_` attribute, such as trees.
`wandb.sklearn.plot_feature_importances(model, ['width', 'height, 'length'])`
@@ -231,7 +240,7 @@ Evaluates and plots the importance of each feature for the classification task.
Plots how well calibrated the predicted probabilities of a classifier are and how to calibrate an uncalibrated classifier. Compares estimated predicted probabilities by a baseline logistic regression model, the model passed as an argument, and by both its isotonic calibration and sigmoid calibrations.
-The closer the calibration curves are to a diagonal the better. A transposed sigmoid like curve represents an overfitted classifier, while a sigmoid like curve represents an underfitted classifier. By training isotonic and sigmoid calibrations of the model and comparing their curves we can figure out whether the model is over or underfitting and if so which calibration (sigmoid or isotonic) might help fix this.
+The closer the calibration curves are to a diagonal the better. A transposed sigmoid-like curve represents an overfitted classifier, while a sigmoid-like curve represents an underfitted classifier. By training isotonic and sigmoid calibrations of the model and comparing their curves, you can figure out whether the model is over or underfitting and, if so, which calibration (sigmoid or isotonic) might help fix this.
For more details, check out [sklearn's docs](https://scikit-learn.org/stable/auto_examples/calibration/plot_calibration_curve.html).
@@ -240,7 +249,7 @@ For more details, check out [sklearn's docs](https://scikit-learn.org/stable/aut
* model (clf): Takes in a fitted classifier.
* X (arr): Training set features.
* y (arr): Training set labels.
-* model_name (str): Model name. Defaults to 'Classifier'
+* model_name (str): Model name. Defaults to `"Classifier"`.
### Confusion matrix
@@ -248,7 +257,7 @@ For more details, check out [sklearn's docs](https://scikit-learn.org/stable/aut
-Computes the confusion matrix to evaluate the accuracy of a classification. It's useful for assessing the quality of model predictions and finding patterns in the predictions the model gets wrong. The diagonal represents the predictions the model got right, such as where the actual label is equal to the predicted label.
+Computes the confusion matrix to evaluate the accuracy of a classification. It's useful for assessing the quality of model predictions and finding patterns in incorrect predictions. The diagonal represents the predictions where the actual label is equal to the predicted label.
`wandb.sklearn.plot_confusion_matrix(y_true, y_pred, labels)`
@@ -270,7 +279,7 @@ Computes the confusion matrix to evaluate the accuracy of a classification. It's
* model (clf or reg): Takes in a fitted regressor or classifier.
* X (arr): Training set features.
* y (arr): Training set labels.
- * X_test (arr): Test set features.
+* X_test (arr): Test set features.
* y_test (arr): Test set labels.
### Elbow plot
@@ -292,17 +301,17 @@ Measures and plots the percentage of variance explained as a function of the num
-Measures & plots how close each point in one cluster is to points in the neighboring clusters. The thickness of the clusters corresponds to the cluster size. The vertical line represents the average silhouette score of all the points.
+Measures and plots how close each point in one cluster is to points in the neighboring clusters. The thickness of the clusters corresponds to the cluster size. The vertical line represents the average silhouette score of all the points.
-Silhouette coefficients near +1 indicate that the sample is far away from the neighboring clusters. A value of 0 indicates that the sample is on or very close to the decision boundary between two neighboring clusters and negative values indicate that those samples might have been assigned to the wrong cluster.
+Silhouette coefficients near +1 indicate that the sample is far away from the neighboring clusters. A value of 0 indicates that the sample is on or close to the decision boundary between two neighboring clusters, and negative values indicate that those samples might have been assigned to the wrong cluster.
-In general we want all silhouette cluster scores to be above average (past the red line) and as close to 1 as possible. We also prefer cluster sizes that reflect the underlying patterns in the data.
+You want all silhouette cluster scores to be above average (past the red line) and as close to 1 as possible. You also prefer cluster sizes that reflect the underlying patterns in the data.
`wandb.sklearn.plot_silhouette(model, X_train, ['spam', 'not spam'])`
* model (clusterer): Takes in a fitted clusterer.
* X (arr): Training set features.
- * cluster_labels (list): Names for cluster labels. Makes plots easier to read by replacing cluster indexes with corresponding names.
+* cluster_labels (list): Names for cluster labels. Makes plots easier to read by replacing cluster indexes with corresponding names.
### Outlier candidates plot
@@ -310,7 +319,7 @@ In general we want all silhouette cluster scores to be above average (past the r
-Measures a datapoint's influence on regression model via cook's distance. Instances with heavily skewed influences could potentially be outliers. Useful for outlier detection.
+Measures a datapoint's influence on regression model through Cook's distance. Instances with heavily skewed influences could be outliers. Useful for outlier detection.
`wandb.sklearn.plot_outlier_candidates(model, X, y)`
@@ -324,18 +333,18 @@ Measures a datapoint's influence on regression model via cook's distance. Instan
-Measures and plots the predicted target values (y-axis) vs the difference between actual and predicted target values (x-axis), as well as the distribution of the residual error.
+Measures and plots the predicted target values (y-axis) versus the difference between actual and predicted target values (x-axis), as well as the distribution of the residual error.
-Generally, the residuals of a well-fit model should be randomly distributed because good models will account for most phenomena in a data set, except for random error.
+The residuals of a well-fit model should be randomly distributed because good models account for most phenomena in a data set, except for random error.
`wandb.sklearn.plot_residuals(model, X, y)`
* model (regressor): Takes in a fitted classifier.
* X (arr): Training set features.
-* y (arr): Training set labels.
+* y (arr): Training set labels.
- If you have any questions, we'd love to answer them in our [slack community](https://wandb.me/slack).
+If you have any questions, ask them in the [Slack community](https://wandb.me/slack).
## Example
-* [Run in colab](https://wandb.me/scikit-colab): A simple notebook to get you started.
+[Run in colab](https://wandb.me/scikit-colab): A simple notebook to get you started.
diff --git a/models/integrations/simpletransformers.mdx b/models/integrations/simpletransformers.mdx
index e4e7a762df..28b7943f31 100644
--- a/models/integrations/simpletransformers.mdx
+++ b/models/integrations/simpletransformers.mdx
@@ -1,35 +1,38 @@
---
description: How to integrate W&B with the Transformers library by Hugging Face.
title: Hugging Face Simple Transformers
+keywords: ["classification model", "NER model", "question answering"]
---
-This library is based on the Transformers library by Hugging Face. Simple Transformers lets you quickly train and evaluate Transformer models. Only 3 lines of code are needed to initialize a model, train the model, and evaluate a model. It supports Sequence Classification, Token Classification \(NER\),Question Answering,Language Model Fine-Tuning, Language Model Training, Language Generation, T5 Model, Seq2Seq Tasks , Multi-Modal Classification and Conversational AI.
+This page shows how to integrate Weights & Biases (W&B) with Simple Transformers so you can visualize and track Transformer model training. By the end, you'll know how to enable W&B logging from a Simple Transformers model and where to find examples for common NLP tasks.
-To use W&B for visualizing model training. To use this, set a project name for W&B in the `wandb_project` attribute of the `args` dictionary. This logs all hyperparameter values, training losses, and evaluation metrics to the given project.
+Simple Transformers is based on the Transformers library by Hugging Face and lets you train and evaluate Transformer models. You need only three lines of code to initialize a model, train the model, and evaluate a model. It supports sequence classification, token classification (NER), question answering, language model fine-tuning, language model training, language generation, T5 model, Seq2Seq tasks, multi-modal classification, and conversational AI.
+
+To use W&B for visualizing model training, set a project name for W&B in the `wandb_project` attribute of the `args` dictionary. This logs all hyperparameter values, training losses, and evaluation metrics to the given project.
```python
model = ClassificationModel('roberta', 'roberta-base', args={'wandb_project': 'project-name'})
```
-Any additional arguments that go into `wandb.init()` can be passed as `wandb_kwargs`.
+You can pass any additional arguments that go into `wandb.init()` as `wandb_kwargs`.
## Structure
-The library is designed to have a separate class for every NLP task. The classes that provide similar functionality are grouped together.
+The following section outlines how Simple Transformers organizes its classes, so you know which module to import for a given task. The library is designed to have a separate class for every NLP task. The classes that provide similar functionality are grouped together.
-* `simpletransformers.classification` - Includes all Classification models.
+* `simpletransformers.classification` - Includes all classification models.
* `ClassificationModel`
* `MultiLabelClassificationModel`
-* `simpletransformers.ner` - Includes all Named Entity Recognition models.
+* `simpletransformers.ner` - Includes all named entity recognition models.
* `NERModel`
-* `simpletransformers.question_answering` - Includes all Question Answering models.
+* `simpletransformers.question_answering` - Includes all question answering models.
* `QuestionAnsweringModel`
-Here are some minimal examples
+The following sections describe minimal examples for two common tasks, demonstrating how to enable W&B logging through the `wandb_project` argument.
-## MultiLabel Classification
+## Multi-label classification
-```text
+```python
model = MultiLabelClassificationModel("distilbert","distilbert-base-uncased",num_labels=6,
args={"reprocess_input_data": True, "overwrite_output_dir": True, "num_train_epochs":epochs,'learning_rate':learning_rate,
'wandb_project': "simpletransformers"},
@@ -43,7 +46,7 @@ Here are some minimal examples
## Question answering
-```text
+```python
train_args = {
'learning_rate': wandb.config.learning_rate,
'num_train_epochs': 2,
@@ -60,10 +63,11 @@ model = QuestionAnsweringModel('distilbert', 'distilbert-base-cased', args=train
model.train_model(train_data)
```
+## Global arguments
-SimpleTransformers provides classes as well as training scripts for all common natural language tasks. Here is the complete list of global arguments that are supported by the library, with their default arguments.
+SimpleTransformers provides classes as well as training scripts for all common natural language tasks. The following is the complete list of global arguments that the library supports, with their default arguments. Refer to this list when you want to customize training behavior beyond the W&B-specific options shown earlier.
-```text
+```python
global_args = {
"adam_epsilon": 1e-8,
"best_model_dir": "outputs/best_model",
@@ -118,6 +122,8 @@ global_args = {
}
```
-Refer to [simpletransformers on github](https://github.com/ThilinaRajapakse/simpletransformers) for more detailed documentation.
+## Additional resources
+
+Refer to [simpletransformers on GitHub](https://github.com/ThilinaRajapakse/simpletransformers) for more detailed documentation.
-Checkout [this W&B report](https://app.wandb.ai/cayush/simpletransformers/reports/Using-simpleTransformer-on-common-NLP-applications---Vmlldzo4Njk2NA) that covers training transformers on some the most popular GLUE benchmark datasets. [Try it out yourself on colab](https://colab.research.google.com/drive/1oXROllqMqVvBFcPgTKJRboTq96uWuqSz?usp=sharing).
\ No newline at end of file
+See [Using simpleTransformer on common NLP applications](https://app.wandb.ai/cayush/simpletransformers/reports/Using-simpleTransformer-on-common-NLP-applications---Vmlldzo4Njk2NA), a W&B report that covers training transformers on some of the most popular GLUE benchmark datasets. [Try it yourself on Colab](https://colab.research.google.com/drive/1oXROllqMqVvBFcPgTKJRboTq96uWuqSz?usp=sharing).
\ No newline at end of file
diff --git a/models/integrations/skorch.mdx b/models/integrations/skorch.mdx
index a974308aae..2a72c1fbde 100644
--- a/models/integrations/skorch.mdx
+++ b/models/integrations/skorch.mdx
@@ -1,35 +1,38 @@
---
description: "Integrate W&B with Skorch to log scikit-learn compatible PyTorch model training metrics and hyperparameters."
title: Skorch
+keywords: ["NeuralNetClassifier", "skorch net", "epoch callback"]
---
-You can use W&B with Skorch to automatically log the model with the best performance, along with all model performance metrics, the model topology and compute resources after each epoch. Every file saved in `wandb_run.dir` is automatically logged to W&B.
+This page shows you how to use W&B with [Skorch](https://skorch.readthedocs.io/) so you can track Skorch model training without writing custom logging code. When you integrate the two, W&B automatically logs the model with the best performance, along with all model performance metrics, the model topology, and compute resources after each epoch. W&B automatically logs every file you save in `wandb_run.dir`.
-See [example run](https://app.wandb.ai/borisd13/skorch/runs/s20or4ct?workspace=user-borisd13).
+For more information, see this [example run](https://app.wandb.ai/borisd13/skorch/runs/s20or4ct?workspace=user-borisd13).
## Parameters
+The following table lists the parameters that the `WandbLogger` callback accepts.
+
| Parameter | Type | Description |
| :--- | :--- | :--- |
-| `wandb_run` | `wandb.wandb_run`. Run | wandb run used to log data. |
-|`save_model` | bool (default=True)| Whether to save a checkpoint of the best model and upload it to your Run on W&B.|
-|`keys_ignored`| str or list of str (default=None) | Key or list of keys that should not be logged to tensorboard. Note that in addition to the keys provided by the user, keys such as those starting with `event_` or ending on `_best` are ignored by default.|
+| `wandb_run` | `wandb.wandb_run`. Run | The W&B run used to log data. |
+|`save_model` | `bool` (default=`True`)| Whether to save a checkpoint of the best model and upload it to your run on W&B.|
+|`keys_ignored`| `str` or list of `str` (default=`None`) | Key or list of keys not to log to TensorBoard. In addition to the keys you provide, W&B ignores keys such as those starting with `event_` or ending with `_best` by default.|
## Example code
-We've created a few examples for you to see how the integration works:
+The following examples show end-to-end usage of `WandbLogger` with Skorch:
-* [Colab](https://colab.research.google.com/drive/1Bo8SqN1wNPMKv5Bn9NjwGecBxzFlaNZn?usp=sharing): A simple demo to try the integration
-* [A step by step guide](https://app.wandb.ai/cayush/uncategorized/reports/Automate-Kaggle-model-training-with-Skorch-and-W%26B--Vmlldzo4NTQ1NQ): to tracking your Skorch model performance
+* [Colab](https://colab.research.google.com/drive/1Bo8SqN1wNPMKv5Bn9NjwGecBxzFlaNZn?usp=sharing): A simple demo to try the integration.
+* [Step-by-step guide](https://app.wandb.ai/cayush/uncategorized/reports/Automate-Kaggle-model-training-with-Skorch-and-W%26B--Vmlldzo4NTQ1NQ): A walkthrough for tracking your Skorch model performance.
```python
# Install wandb
-... pip install wandb
+pip install wandb
import wandb
from skorch.callbacks import WandbLogger
-# Create a wandb Run
+# Create a wandb run
wandb_run = wandb.init()
# Log hyper-parameters (optional)
@@ -41,13 +44,15 @@ net.fit(X, y)
## Method reference
+The following table lists the callback methods that `WandbLogger` provides and when Skorch invokes each one.
+
| Method | Description |
| :--- | :--- |
| `initialize`\(\) | \(Re-\)Set the initial state of the callback. |
| `on_batch_begin`\(net\[, X, y, training\]\) | Called at the beginning of each batch. |
| `on_batch_end`\(net\[, X, y, training\]\) | Called at the end of each batch. |
-| `on_epoch_begin`\(net\[, dataset_train, …\]\) | Called at the beginning of each epoch. |
-| `on_epoch_end`\(net, \*\*kwargs\) | Log values from the last history step and save best model |
-| `on_grad_computed`\(net, named_parameters\[, X, …\]\) | Called once per batch after gradients have been computed but before an update step was performed. |
-| `on_train_begin`\(net, \*\*kwargs\) | Log model topology and add a hook for gradients |
+| `on_epoch_begin`\(net\[, dataset_train, ...\]\) | Called at the beginning of each epoch. |
+| `on_epoch_end`\(net, \*\*kwargs\) | Log values from the last history step and save the best model. |
+| `on_grad_computed`\(net, named_parameters\[, X, ...\]\) | Called once per batch after gradients are computed but before an update step is performed. |
+| `on_train_begin`\(net, \*\*kwargs\) | Log model topology and add a hook for gradients. |
| `on_train_end`\(net\[, X, y\]\) | Called at the end of training. |
diff --git a/models/integrations/spacy.mdx b/models/integrations/spacy.mdx
index b315fdbad6..00f591a56c 100644
--- a/models/integrations/spacy.mdx
+++ b/models/integrations/spacy.mdx
@@ -1,11 +1,14 @@
---
title: spaCy
description: "Integrate W&B with spaCy v3 to track training metrics and version models and datasets through the WandbLogger config."
+keywords: ["spacy train config", "nlp pipeline", "entity recognition"]
---
import ApiKeyCreateStreamlined from "/snippets/_includes/api-key-create-streamlined.mdx";
-[spaCy](https://spacy.io) is a popular "industrial-strength" NLP library: fast, accurate models with a minimum of fuss. As of spaCy v3, W&B can now be used with [`spacy train`](https://spacy.io/api/cli#train) to track your spaCy model's training metrics as well as to save and version your models and datasets. And all it takes is a few added lines in your configuration.
+[spaCy](https://spacy.io) is an NLP library that provides fast, accurate models. As of spaCy v3, you can use W&B with [`spacy train`](https://spacy.io/api/cli#train) to track your spaCy model's training metrics and to save and version your models and datasets. All it takes is a few added lines in your configuration.
+
+This page is for spaCy users who want to use W&B to monitor training runs, compare experiments, and version the models and datasets produced by `spacy train`.
## Sign up and create an API key
@@ -25,7 +28,7 @@ To install the `wandb` library locally and log in:
1. Set the `WANDB_API_KEY` [environment variable](/models/track/environment-variables/) to your API key.
```bash
- export WANDB_API_KEY=
-## WandbCallback Arguments
+## `WandbCallback` arguments
+
+The following table describes the arguments you can pass to `WandbCallback`:
| Argument | Usage |
| :--- | :--- |
-| `verbose` | The verbosity of sb3 output |
-| `model_save_path` | Path to the folder where the model will be saved, The default value is \`None\` so the model is not logged |
-| `model_save_freq` | Frequency to save the model |
-| `gradient_save_freq` | Frequency to log gradient. The default value is 0 so the gradients are not logged |
+| `verbose` | The verbosity of SB3 output. |
+| `model_save_path` | Path to the folder where the model is saved. The default is `None`, so the model isn't logged. |
+| `model_save_freq` | Frequency to save the model. |
+| `gradient_save_freq` | Frequency to log gradients. The default is `0`, so gradients aren't logged. |
## Basic example
-The W&B SB3 integration uses the logs output from TensorBoard to log your metrics
+The W&B SB3 integration uses the logs output from TensorBoard to log your metrics.
```python
import gym
diff --git a/models/integrations/tensorboard.mdx b/models/integrations/tensorboard.mdx
index 151c4f6e1d..921eb0ad5f 100644
--- a/models/integrations/tensorboard.mdx
+++ b/models/integrations/tensorboard.mdx
@@ -1,6 +1,7 @@
---
title: TensorBoard
description: "Sync TensorBoard logs to W&B for cloud-hosted visualization, sharing, and centralized analysis alongside system metrics."
+keywords: ["wandb.tensorboard.patch", "tb log import", "cloud tensorboard"]
---
import { ColabLink } from '/snippets/_includes/colab-link.mdx';
@@ -10,7 +11,7 @@ import { ColabLink } from '/snippets/_includes/colab-link.mdx';
W&B supports embedded TensorBoard for W&B Multi-tenant Cloud.
-Upload your TensorBoard logs to the cloud, quickly share your results among colleagues and classmates and keep your analysis in one centralized location.
+This page shows how to sync TensorBoard logs to W&B so you can upload your TensorBoard logs to the cloud, share your results among colleagues and classmates, and keep your analysis in one centralized location. This integration is for users who already log to TensorBoard and want cloud-hosted visualization, sharing, and side-by-side comparison with W&B system metrics.
@@ -18,6 +19,8 @@ Upload your TensorBoard logs to the cloud, quickly share your results among coll
## Get started
+To enable TensorBoard syncing, set `sync_tensorboard=True` when you initialize a W&B run. W&B automatically uploads any TensorBoard events your training code emits.
+
```python
import wandb
@@ -30,25 +33,27 @@ wandb.init(project="my-project", sync_tensorboard=True) as run:
Review an [example TensorBoard integration run](https://wandb.ai/rymc/simple-tensorboard-example/runs/oab614zf/tensorboard).
-Once your run finishes, you can access your TensorBoard event files in W&B and you can visualize your metrics in native W&B charts, together with additional useful information like the system's CPU or GPU utilization, the `git` state, the terminal command the run used, and more.
+After your run finishes, you can access your TensorBoard event files in W&B and visualize your metrics in native W&B charts. W&B also captures additional information such as system CPU or GPU utilization, the `git` state, and the terminal command the run used.
+
Check the W&B blog post on [Fine-tuning Mistral 7B using torchtune](https://wandb.ai/capecape/torchtune-mistral/reports/torchtune-The-new-PyTorch-LLM-fine-tuning-library---Vmlldzo3NTUwNjM0).
-## W&B logging at your fingertips
+## Enable W&B logging
+
+You can enable W&B logging in two ways: override arguments at launch from the command line, or edit the recipe's config file. Choose whichever fits your workflow.
+
### Logged metrics
@@ -88,17 +93,17 @@ Each recipe has its own training loop. Check each individual recipe to see its l
| Metric | Description |
| --- | --- |
-| `loss` | The loss of the model |
-| `lr` | The learning rate |
-| `tokens_per_second` | The tokens per second of the model |
-| `grad_norm` | The gradient norm of the model |
-| `global_step` | Corresponds to the current step in the training loop. Takes into account gradient accumulation, basically every time an optimizer step is taken, the model is updated, the gradients are accumulated and the model is updated once every `gradient_accumulation_steps` |
+| `loss` | The loss of the model. |
+| `lr` | The learning rate. |
+| `tokens_per_second` | The tokens per second of the model. |
+| `grad_norm` | The gradient norm of the model. |
+| `global_step` | Corresponds to the current step in the training loop. Accounts for gradient accumulation. Each time an optimizer step runs, the model updates, the gradients accumulate, and the model updates once every `gradient_accumulation_steps`. |
YOLO Fine-tuning Experiments
@@ -79,13 +90,11 @@ Here's how epoch-wise validation results are visualized using a [W&B Table](/mod
WandB Image Overlay
-For more details, see the [W&B image overlays guide](/models/track/log/media/#image-overlays).
+For more information, see the [W&B image overlays guide](/models/track/log/media/#image-overlays).
## More resources
diff --git a/models/integrations/w-and-b-for-julia.mdx b/models/integrations/w-and-b-for-julia.mdx
index ad0acbb859..9a29db64d8 100644
--- a/models/integrations/w-and-b-for-julia.mdx
+++ b/models/integrations/w-and-b-for-julia.mdx
@@ -1,11 +1,12 @@
---
description: "Integrate W&B with Julia to track experiments, log metrics, and visualize model performance from Julia programs."
title: W&B for Julia
+keywords: ["wandb.jl", "avik-pal", "Flux.jl"]
---
-For those running machine learning experiments in the Julia programming language, a community contributor has created an unofficial set of Julia bindings called [wandb.jl](https://github.com/avik-pal/Wandb.jl) that you can use.
+If you run machine learning experiments in Julia, you can use [`wandb.jl`](https://github.com/avik-pal/Wandb.jl), an unofficial set of Julia bindings created by a community contributor.
-You can find examples [in the documentation](https://github.com/avik-pal/Wandb.jl/tree/main/docs/src/examples) on the wandb.jl repository. Their "Getting Started" example is here:
+For more examples, see the [`wandb.jl` examples directory](https://github.com/avik-pal/Wandb.jl/tree/main/docs/src/examples). The following code is the getting started example from the `wandb.jl` repository:
```julia
using Wandb, Dates, Logging
diff --git a/models/integrations/xgboost.mdx b/models/integrations/xgboost.mdx
index 290c29f5c8..65b7d55b29 100644
--- a/models/integrations/xgboost.mdx
+++ b/models/integrations/xgboost.mdx
@@ -1,12 +1,15 @@
---
description: "Integrate W&B with XGBoost to log gradient boosting metrics, feature importance, and model performance automatically."
title: XGBoost
+keywords: ["XGBClassifier", "xgb plot importance", "boosting rounds"]
---
import { ColabLink } from '/snippets/_includes/colab-link.mdx';
@@ -14,7 +17,7 @@ The `wandb` library has a `WandbCallback` callback for logging metrics, configs
## Get started
-Logging XGBoost metrics, configs and booster models to W&B is as easy as passing the `WandbCallback` to XGBoost:
+To log XGBoost metrics, configs, and booster models to W&B, pass the `WandbCallback` to XGBoost:
```python
from wandb.integration.xgboost import WandbCallback
@@ -28,41 +31,45 @@ with wandb.init() as run:
bst.fit(X_train, y_train, callbacks=[WandbCallback(log_model=True)])
```
-You can open [this notebook](https://wandb.me/xgboost) for a comprehensive look at logging with XGBoost and W&B
+For a comprehensive look at logging with XGBoost and W&B, see the [XGBoost and W&B logging notebook](https://wandb.me/xgboost).
## `WandbCallback` reference
### Functionality
-Passing `WandbCallback` to a XGBoost model will:
-- log the booster model configuration to W&B
-- log evaluation metrics collected by XGBoost, such as rmse, accuracy etc to W&B
-- log training metrics collected by XGBoost (if you provide data to eval_set)
-- log the best score and the best iteration
-- save and upload your trained model to W&B Artifacts (when `log_model = True`)
-- log feature importance plot when `log_feature_importance=True` (default).
-- Capture the best eval metric in `wandb.Run.summary` when `define_metric=True` (default).
+
+Passing `WandbCallback` to an XGBoost model does the following:
+- Logs the booster model configuration to W&B.
+- Logs evaluation metrics collected by XGBoost, such as `rmse`, accuracy, and so on to W&B.
+- Logs training metrics collected by XGBoost (if you provide data to `eval_set`).
+- Logs the best score and the best iteration.
+- Saves and uploads your trained model to W&B Artifacts (when `log_model = True`).
+- Logs the feature importance plot when `log_feature_importance=True` (default).
+- Captures the best eval metric in `wandb.Run.summary` when `define_metric=True` (default).
### Arguments
-- `log_model`: (boolean) if True save and upload the model to W&B Artifacts
-- `log_feature_importance`: (boolean) if True log a feature importance bar plot
+- `log_model`: (boolean) if True, saves and uploads the model to W&B Artifacts.
-- `importance_type`: (str) one of `{weight, gain, cover, total_gain, total_cover}` for tree model. weight for linear model.
+- `log_feature_importance`: (boolean) if True, logs a feature importance bar plot.
-- `define_metric`: (boolean) if True (default) capture model performance at the best step, instead of the last step, of training in your `run.summary`.
+- `importance_type`: (str) one of `{weight, gain, cover, total_gain, total_cover}` for tree model. `weight` for linear model.
+- `define_metric`: (boolean) if True (default), captures model performance at the best step, instead of the last step, of training in your `run.summary`.
-You can review the [source code for WandbCallback](https://github.com/wandb/wandb/blob/main/wandb/integration/xgboost/xgboost.py).
-For additional examples, check out the [repository of examples on GitHub](https://github.com/wandb/examples/tree/master/examples/boosting-algorithms).
+Review the [source code for WandbCallback](https://github.com/wandb/wandb/blob/main/wandb/integration/xgboost/xgboost.py).
+
+For more examples, see the [repository of examples on GitHub](https://github.com/wandb/examples/tree/master/examples/boosting-algorithms).
## Tune your hyperparameters with Sweeps
-Attaining the maximum performance out of models requires tuning hyperparameters, like tree depth and learning rate. W&B [Sweeps](/models/sweeps/) is a powerful toolkit for configuring, orchestrating, and analyzing large hyperparameter testing experiments.
+W&B [Sweeps](/models/sweeps/) is a toolkit for configuring, orchestrating, and analyzing hyperparameter testing experiments. This section shows how to combine the XGBoost integration with W&B Sweeps to search across hyperparameter configurations.
+
+To improve model performance, tune hyperparameters like tree depth and learning rate.
diff --git a/models/integrations/yolov5.mdx b/models/integrations/yolov5.mdx
index 198889c4ff..d133a39f20 100644
--- a/models/integrations/yolov5.mdx
+++ b/models/integrations/yolov5.mdx
@@ -1,50 +1,52 @@
---
title: YOLOv5
description: "Use the built-in W&B integration in YOLOv5 for experiment tracking, model versioning, and prediction visualization."
+keywords: ["train.py", "yolov5 weights", "detect.py"]
---
import { ColabLink } from '/snippets/_includes/colab-link.mdx';
-Any questions or issues about this W&B integration? Open an issue in the [YOLOX repository](https://github.com/Megvii-BaseDetection/YOLOX).
+If you have questions or issues about this W&B integration, open an issue in the [YOLOX repository](https://github.com/Megvii-BaseDetection/YOLOX).