From 8fc957399ca70b86c95f15371263e42c7075545c Mon Sep 17 00:00:00 2001 From: awaelchli Date: Sun, 11 Feb 2024 02:00:22 +0100 Subject: [PATCH 1/8] wandb page --- docs/source-fabric/glossary/index.rst | 6 ++ docs/source-fabric/guide/loggers/wandb.rst | 108 +++++++++++++++++++++ docs/source-fabric/guide/logging.rst | 3 +- 3 files changed, 116 insertions(+), 1 deletion(-) create mode 100644 docs/source-fabric/guide/loggers/wandb.rst diff --git a/docs/source-fabric/glossary/index.rst b/docs/source-fabric/glossary/index.rst index ebfa1b23a3bd3..b08bc4f830163 100644 --- a/docs/source-fabric/glossary/index.rst +++ b/docs/source-fabric/glossary/index.rst @@ -7,6 +7,7 @@ Glossary :hidden: Checkpoint <../guide/checkpoint/index> + Weights and Biases <../guide/loggers/wandb> .. raw:: html @@ -204,6 +205,11 @@ Glossary :button_link: ../guide/trainer_template.html :col_css: col-md-4 +.. displayitem:: + :header: Weights and Biases + :button_link: ../guide/loggers/wandb.html + :col_css: col-md-4 + .. displayitem:: :header: 16-bit, 8-bit, 4-bit :button_link: ../fundamentals/precision.html diff --git a/docs/source-fabric/guide/loggers/wandb.rst b/docs/source-fabric/guide/loggers/wandb.rst new file mode 100644 index 0000000000000..e1def8fba7006 --- /dev/null +++ b/docs/source-fabric/guide/loggers/wandb.rst @@ -0,0 +1,108 @@ +################## +Weights and Biases +################## + +TODO: Brief Description here + + +---- + + +************************* +Set Up Weights and Biases +************************* + +First, you need to install the ``wandb`` package: + +.. code-block:: bash + + pip install wandb + +Then log in with your API key found in your W&B account settings: + +.. code-block:: bash + + wandb login + + +You are all set and can start logging your metrics to Weights and Biases. + + +---- + + +************* +Track metrics +************* + +To start tracking metrics in your training loop, import the WandbLogger and configure it with your settings: + +.. code-block:: python + + from lightning.fabric import Fabric + + # 1. Import the WandbLogger + from wandb.x.y.z import WandbLogger + + # 2. Configure the logger + logger = WandbLogger(project="my-project") + + # 3. Pass it to Fabric + fabric = Fabric(loggers=logger) + + +Next, add :meth:`~lightning.fabric.fabric.Fabric.log` calls in your code. + +.. code-block:: python + + value = ... # Python scalar or tensor scalar + fabric.log("some_value", value) + + +To log multiple metrics at once, use :meth:`~lightning.fabric.fabric.Fabric.log_dict`: + +.. code-block:: python + + values = {"loss": loss, "acc": acc, "other": other} + fabric.log_dict(values) + + +---- + + +************************************************** +Logging media, artifacts, hyperparameters and more +************************************************** + +With WandbLogger you can also log images, text, tables, checkpoints, hyperparameters and more. +For a description of all features, check out the official Weights and Biases documentation and examples. + + +.. raw:: html + +
+
+ +.. displayitem:: + :header: Official WandbLogger Documentation + :description: Learn about all features from Weights and Biases + :button_link: https://docs.wandb.ai/guides/integrations/lightning + :col_css: col-md-4 + :height: 150 + +.. displayitem:: + :header: WandbLogger Examples + :description: See examples of how to use the WandbLogger + :button_link: https://github.com/wandb/examples + :col_css: col-md-4 + :height: 150 + + +.. raw:: html + +
+
+ + +| +| \ No newline at end of file diff --git a/docs/source-fabric/guide/logging.rst b/docs/source-fabric/guide/logging.rst index 36b951337320c..6068ba951a075 100644 --- a/docs/source-fabric/guide/logging.rst +++ b/docs/source-fabric/guide/logging.rst @@ -32,10 +32,11 @@ To track a metric, add the following: fabric = Fabric(loggers=logger) -Built-in loggers you can choose from: +Loggers you can choose from: - :class:`~lightning.fabric.loggers.TensorBoardLogger` - :class:`~lightning.fabric.loggers.CSVLogger` +- :doc:`Weights and Biases ` | From d36e63b9d8b328ecf5acae6af0655afd78d23ab7 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sun, 11 Feb 2024 01:02:06 +0000 Subject: [PATCH 2/8] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- docs/source-fabric/guide/loggers/wandb.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source-fabric/guide/loggers/wandb.rst b/docs/source-fabric/guide/loggers/wandb.rst index e1def8fba7006..fd3869bf51dca 100644 --- a/docs/source-fabric/guide/loggers/wandb.rst +++ b/docs/source-fabric/guide/loggers/wandb.rst @@ -105,4 +105,4 @@ For a description of all features, check out the official Weights and Biases doc | -| \ No newline at end of file +| From 1d18ea6730c0f1458d5742b295fc1322f0082b37 Mon Sep 17 00:00:00 2001 From: Anish Shah Date: Mon, 12 Feb 2024 11:17:12 -0500 Subject: [PATCH 3/8] Update wandb.rst Update descriptions, links, and imports --- docs/source-fabric/guide/loggers/wandb.rst | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/docs/source-fabric/guide/loggers/wandb.rst b/docs/source-fabric/guide/loggers/wandb.rst index fd3869bf51dca..3ef87c6cbca8a 100644 --- a/docs/source-fabric/guide/loggers/wandb.rst +++ b/docs/source-fabric/guide/loggers/wandb.rst @@ -2,7 +2,9 @@ Weights and Biases ################## -TODO: Brief Description here +Weights & Biases (W&B) is the AI developer platform, with tools for training models, fine-tuning models, and leveraging foundation models. + +W&B allows machine learning practitioners to track experiments, visualize data, and share insights with a few lines of. It integrates seamlessly with your Lightning ML workflows to log metrics, output visualizations, and manage artifacts. This integration provides a simple way to log metrics and artifacts from your Fabric training loop to W&B via the `WandbLogger`. The `WandbLogger` also supports all features of the Weights and Biases library, such as logging rich media (image, audio, video), artifacts, hyperparameters, tables, custom visualizations, and more. Check the official documentation at https://docs.wandb.ai. ---- @@ -42,7 +44,7 @@ To start tracking metrics in your training loop, import the WandbLogger and conf from lightning.fabric import Fabric # 1. Import the WandbLogger - from wandb.x.y.z import WandbLogger + from wandb.integration.lightning.fabric import WandbLogger # 2. Configure the logger logger = WandbLogger(project="my-project") @@ -84,16 +86,23 @@ For a description of all features, check out the official Weights and Biases doc
.. displayitem:: - :header: Official WandbLogger Documentation + :header: Official WandbLogger Lightning and Fabric Documentation :description: Learn about all features from Weights and Biases :button_link: https://docs.wandb.ai/guides/integrations/lightning :col_css: col-md-4 :height: 150 .. displayitem:: - :header: WandbLogger Examples + :header: Fabric WandbLogger Example + :description: Official example of how to use the WandbLogger with Fabric + :button_link: https://colab.research.google.com/github/wandb/examples/blob/master/colabs/pytorch-lightning/Track_PyTorch_Lightning_with_Fabric_and_Wandb.ipynb + :col_css: col-md-4 + :height: 150 + +.. displayitem:: + :header: Lightning WandbLogger Examples :description: See examples of how to use the WandbLogger - :button_link: https://github.com/wandb/examples + :button_link: https://github.com/wandb/examples/tree/master/colabs/pytorch-lightning :col_css: col-md-4 :height: 150 From 3a7b594cb13a24314df7852bd8b6a46ece6770a5 Mon Sep 17 00:00:00 2001 From: awaelchli Date: Tue, 13 Feb 2024 15:14:49 +0100 Subject: [PATCH 4/8] line breaks for easier diff --- docs/source-fabric/guide/loggers/wandb.rst | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/source-fabric/guide/loggers/wandb.rst b/docs/source-fabric/guide/loggers/wandb.rst index 3ef87c6cbca8a..808fe9db7c570 100644 --- a/docs/source-fabric/guide/loggers/wandb.rst +++ b/docs/source-fabric/guide/loggers/wandb.rst @@ -4,7 +4,11 @@ Weights and Biases Weights & Biases (W&B) is the AI developer platform, with tools for training models, fine-tuning models, and leveraging foundation models. -W&B allows machine learning practitioners to track experiments, visualize data, and share insights with a few lines of. It integrates seamlessly with your Lightning ML workflows to log metrics, output visualizations, and manage artifacts. This integration provides a simple way to log metrics and artifacts from your Fabric training loop to W&B via the `WandbLogger`. The `WandbLogger` also supports all features of the Weights and Biases library, such as logging rich media (image, audio, video), artifacts, hyperparameters, tables, custom visualizations, and more. Check the official documentation at https://docs.wandb.ai. +W&B allows machine learning practitioners to track experiments, visualize data, and share insights with a few lines of. +It integrates seamlessly with your Lightning ML workflows to log metrics, output visualizations, and manage artifacts. +This integration provides a simple way to log metrics and artifacts from your Fabric training loop to W&B via the `WandbLogger`. +The `WandbLogger` also supports all features of the Weights and Biases library, such as logging rich media (image, audio, video), artifacts, hyperparameters, tables, custom visualizations, and more. +Check the official documentation at https://docs.wandb.ai. ---- From 7142b9293cafaeca2e0c1874292a7242cf187cb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20W=C3=A4lchli?= Date: Tue, 13 Feb 2024 15:33:58 +0100 Subject: [PATCH 5/8] links --- docs/source-fabric/api/loggers.rst | 11 +++++++++++ docs/source-fabric/guide/loggers/wandb.rst | 10 +++++----- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/docs/source-fabric/api/loggers.rst b/docs/source-fabric/api/loggers.rst index 3c4936c0ac124..c66ededed9d9f 100644 --- a/docs/source-fabric/api/loggers.rst +++ b/docs/source-fabric/api/loggers.rst @@ -18,3 +18,14 @@ Loggers Logger CSVLogger TensorBoardLogger + + +Third-party Loggers +^^^^^^^^^^^^^^^^^^^ + +.. list-table:: + :widths: 50 50 + :header-rows: 0 + + * - :doc:`WandbLogger <../guide/loggers/wandb>` + - Log to the W&B cloud. diff --git a/docs/source-fabric/guide/loggers/wandb.rst b/docs/source-fabric/guide/loggers/wandb.rst index 808fe9db7c570..c7fc87268a417 100644 --- a/docs/source-fabric/guide/loggers/wandb.rst +++ b/docs/source-fabric/guide/loggers/wandb.rst @@ -2,13 +2,13 @@ Weights and Biases ################## -Weights & Biases (W&B) is the AI developer platform, with tools for training models, fine-tuning models, and leveraging foundation models. +`Weights & Biases (W&B) `_ is the AI developer platform, with tools for training models, fine-tuning models, and leveraging foundation models. W&B allows machine learning practitioners to track experiments, visualize data, and share insights with a few lines of. It integrates seamlessly with your Lightning ML workflows to log metrics, output visualizations, and manage artifacts. -This integration provides a simple way to log metrics and artifacts from your Fabric training loop to W&B via the `WandbLogger`. -The `WandbLogger` also supports all features of the Weights and Biases library, such as logging rich media (image, audio, video), artifacts, hyperparameters, tables, custom visualizations, and more. -Check the official documentation at https://docs.wandb.ai. +This integration provides a simple way to log metrics and artifacts from your Fabric training loop to W&B via the ``WandbLogger``. +The ``WandbLogger`` also supports all features of the Weights and Biases library, such as logging rich media (image, audio, video), artifacts, hyperparameters, tables, custom visualizations, and more. +Check the official documentation at `docs.wandb.ai `_. ---- @@ -80,7 +80,7 @@ To log multiple metrics at once, use :meth:`~lightning.fabric.fabric.Fabric.log_ Logging media, artifacts, hyperparameters and more ************************************************** -With WandbLogger you can also log images, text, tables, checkpoints, hyperparameters and more. +With ``WandbLogger`` you can also log images, text, tables, checkpoints, hyperparameters and more. For a description of all features, check out the official Weights and Biases documentation and examples. From 1525fefa76a6d1d1dcae8f663211e018eb55abcb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20W=C3=A4lchli?= Date: Tue, 13 Feb 2024 15:36:01 +0100 Subject: [PATCH 6/8] consistency --- docs/source-fabric/guide/logging.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source-fabric/guide/logging.rst b/docs/source-fabric/guide/logging.rst index 6068ba951a075..7390fac945506 100644 --- a/docs/source-fabric/guide/logging.rst +++ b/docs/source-fabric/guide/logging.rst @@ -36,7 +36,7 @@ Loggers you can choose from: - :class:`~lightning.fabric.loggers.TensorBoardLogger` - :class:`~lightning.fabric.loggers.CSVLogger` -- :doc:`Weights and Biases ` +- :doc:`WandbLogger ` | From 7bfb54f3d34881539da35b5a315415803f95ea43 Mon Sep 17 00:00:00 2001 From: Anish Shah Date: Wed, 14 Feb 2024 13:30:13 -0500 Subject: [PATCH 7/8] Fix wording and links --- docs/source-fabric/api/loggers.rst | 2 +- docs/source-fabric/guide/loggers/wandb.rst | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/source-fabric/api/loggers.rst b/docs/source-fabric/api/loggers.rst index c66ededed9d9f..5bfbe0b307722 100644 --- a/docs/source-fabric/api/loggers.rst +++ b/docs/source-fabric/api/loggers.rst @@ -28,4 +28,4 @@ Third-party Loggers :header-rows: 0 * - :doc:`WandbLogger <../guide/loggers/wandb>` - - Log to the W&B cloud. + - Log to `Weights & Biases `_. diff --git a/docs/source-fabric/guide/loggers/wandb.rst b/docs/source-fabric/guide/loggers/wandb.rst index c7fc87268a417..8ed635dc1732b 100644 --- a/docs/source-fabric/guide/loggers/wandb.rst +++ b/docs/source-fabric/guide/loggers/wandb.rst @@ -8,7 +8,7 @@ W&B allows machine learning practitioners to track experiments, visualize data, It integrates seamlessly with your Lightning ML workflows to log metrics, output visualizations, and manage artifacts. This integration provides a simple way to log metrics and artifacts from your Fabric training loop to W&B via the ``WandbLogger``. The ``WandbLogger`` also supports all features of the Weights and Biases library, such as logging rich media (image, audio, video), artifacts, hyperparameters, tables, custom visualizations, and more. -Check the official documentation at `docs.wandb.ai `_. +`Check the official documentation here `_. ---- @@ -104,9 +104,9 @@ For a description of all features, check out the official Weights and Biases doc :height: 150 .. displayitem:: - :header: Lightning WandbLogger Examples - :description: See examples of how to use the WandbLogger - :button_link: https://github.com/wandb/examples/tree/master/colabs/pytorch-lightning + :header: Lightning WandbLogger Example + :description: Official example of how to use the WandbLogger with Lightning + :button_link: wandb.me/lightning :col_css: col-md-4 :height: 150 From 16bc6cfd293fd66b93744fad5ae4e37efdf0197f Mon Sep 17 00:00:00 2001 From: awaelchli Date: Mon, 4 Mar 2024 06:53:15 -0500 Subject: [PATCH 8/8] Update docs/source-fabric/guide/loggers/wandb.rst --- docs/source-fabric/guide/loggers/wandb.rst | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/source-fabric/guide/loggers/wandb.rst b/docs/source-fabric/guide/loggers/wandb.rst index 8ed635dc1732b..ef7776fb0b508 100644 --- a/docs/source-fabric/guide/loggers/wandb.rst +++ b/docs/source-fabric/guide/loggers/wandb.rst @@ -2,9 +2,8 @@ Weights and Biases ################## -`Weights & Biases (W&B) `_ is the AI developer platform, with tools for training models, fine-tuning models, and leveraging foundation models. +`Weights & Biases (W&B) `_ allows machine learning practitioners to track experiments, visualize data, and share insights with a few lines of code. -W&B allows machine learning practitioners to track experiments, visualize data, and share insights with a few lines of. It integrates seamlessly with your Lightning ML workflows to log metrics, output visualizations, and manage artifacts. This integration provides a simple way to log metrics and artifacts from your Fabric training loop to W&B via the ``WandbLogger``. The ``WandbLogger`` also supports all features of the Weights and Biases library, such as logging rich media (image, audio, video), artifacts, hyperparameters, tables, custom visualizations, and more.