Example edits (#158)

This commit is contained in:
pollfly
2022-01-13 09:42:36 +02:00
committed by GitHub
parent 15d28865c3
commit 5ea532ebd8
12 changed files with 98 additions and 132 deletions

View File

@@ -8,10 +8,9 @@ demonstrates the integration of **ClearML** into code that uses PyTorch.
The example script does the following:
* Trains a simple deep neural network on the PyTorch built-in [MNIST](https://pytorch.org/vision/stable/datasets.html#mnist)
dataset.
* Uses **ClearML** automatic logging.
* Calls the [Logger.report_scalar](../../../references/sdk/logger.md#report_scalar) method to demonstrate explicit reporting,
which allows adding customized reporting to the code.
* Creates an experiment named `pytorch mnist train`, which is associated with the `examples` project.
* ClearML automatically logs `argparse` command line options, and models (and their snapshots) created by PyTorch
* Additional metrics are logged by calling the [Logger.report_scalar](../../../references/sdk/logger.md#report_scalar) method.
## Scalars
@@ -19,16 +18,19 @@ In the example script's `train` function, the following code explicitly reports
```python
Logger.current_logger().report_scalar(
"train", "loss", iteration=(epoch * len(train_loader) + batch_idx), value=loss.item())
"train", "loss", iteration=(epoch * len(train_loader) + batch_idx), value=loss.item()
)
```
In the `test` method, the code explicitly reports `loss` and `accuracy` scalars.
```python
Logger.current_logger().report_scalar(
"test", "loss", iteration=epoch, value=test_loss)
"test", "loss", iteration=epoch, value=test_loss
)
Logger.current_logger().report_scalar(
"test", "accuracy", iteration=epoch, value=(correct / len(test_loader.dataset)))
"test", "accuracy", iteration=epoch, value=(correct / len(test_loader.dataset))
)
```
These scalars can be visualized in plots, which appear in the **ClearML web UI**, in the experiment's
@@ -49,17 +51,12 @@ Text printed to the console for training progress, as well as all other console
## Artifacts
Model artifacts associated with the experiment appear in the info panel of the **EXPERIMENTS** tab and in
the info panel of the **MODELS** tab.
The experiment info panel shows model tracking, including the model name and design (in this case, no design was stored).
Models created by the experiment appear in the experiments **ARTIFACTS** tab. ClearML automatically logs and tracks models
and any snapshots created using PyTorch.
![image](../../../img/examples_pytorch_mnist_02.png)
The model info panel contains the model details, including:
* Model URL
* Framework
* Snapshot locations.
Clicking on the model name takes you to the [models page](../../../webapp/webapp_model_viewing.md), where you can view
the models details and access the model.
![image](../../../img/examples_pytorch_mnist_03.png)

View File

@@ -3,16 +3,14 @@ title: PyTorch with TensorBoard
---
The [pytorch_tensorboard.py](https://github.com/allegroai/clearml/blob/master/examples/frameworks/pytorch/pytorch_tensorboard.py)
example demonstrates the integration of **ClearML** into code that uses PyTorch and TensorBoard.
example demonstrates the integration of ClearML into code that uses PyTorch and TensorBoard.
The example does the following:
* Trains a simple deep neural network on the PyTorch built-in [MNIST](https://pytorch.org/vision/stable/datasets.html#mnist)
dataset.
* Creates a TensorBoard `SummaryWriter` object to log:
* Scalars during training.
* Scalars and debug samples during testing.
* Test text message to the console (a test message to demonstrate **ClearML**'s automatic logging).
* Creates an experiment named `pytorch with tensorboard`, which is associated with the `examples` project.
* ClearML automatically captures scalars and text logged using the TensorBoard `SummaryWriter` object, and
the model created by PyTorch.
## Scalars
@@ -23,13 +21,13 @@ These scalars, along with the resource utilization plots, which are titled **:mo
## Debug Samples
**ClearML** automatically tracks images and text output to TensorFlow. They appear in **RESULTS** **>** **DEBUG SAMPLES**.
ClearML automatically tracks images and text output to TensorFlow. They appear in **RESULTS** **>** **DEBUG SAMPLES**.
![image](../../../img/examples_pytorch_tensorboard_08.png)
## Hyperparameters
**ClearML** automatically logs TensorFlow Definitions. They appear in **CONFIGURATIONS** **>** **HYPER PARAMETERS** **>** **TF_DEFINE**.
ClearML automatically logs TensorFlow Definitions. They appear in **CONFIGURATIONS** **>** **HYPER PARAMETERS** **>** **TF_DEFINE**.
![image](../../../img/examples_pytorch_tensorboard_01.png)
@@ -41,16 +39,12 @@ Text printed to the console for training progress, as well as all other console
## Artifacts
Model artifacts associated with the experiment appear in the info panel of the **EXPERIMENTS** tab and in the info panel
of the **MODELS** tab.
The experiment info panel shows model tracking, including the model name and design (in this case, no design was stored).
Models created by the experiment appear in the experiments **ARTIFACTS** tab. ClearML automatically logs and tracks
models and any snapshots created using PyTorch.
![image](../../../img/examples_pytorch_tensorboard_02.png)
The model info panel contains the model details, including:
* Model URL
* Framework
* Snapshot locations.
Clicking on a model's name takes you to the [models page](../../../webapp/webapp_model_viewing.md), where you can view
the models details and access the model.
![image](../../../img/examples_pytorch_tensorboard_03.png)

View File

@@ -3,28 +3,26 @@ title: PyTorch TensorBoardX
---
The [pytorch_tensorboardX.py](https://github.com/allegroai/clearml/blob/master/examples/frameworks/tensorboardx/pytorch_tensorboardX.py)
example demonstrates the integration of **ClearML** into code that uses PyTorch and TensorBoardX.
example demonstrates the integration of ClearML into code that uses PyTorch and TensorBoardX.
The example does the following:
* Trains a simple deep neural network on the PyTorch built-in [MNIST](https://pytorch.org/vision/stable/datasets.html#mnist)
dataset.
* Creates a TensorBoardX `SummaryWriter` object to log:
* Scalars during training
* Scalars and debug samples during testing
* A test text message to the console (a test message to demonstrate **ClearML** automatic logging).
* Creates an experiment named `pytorch with tensorboardX`, which is associated with the `examples` project in the **ClearML Web UI**.
* Creates an experiment named `pytorch with tensorboardX`, which is associated with the `examples` project.
* ClearML automatically captures scalars and text logged using the TensorBoardX `SummaryWriter` object, and
the model created by PyTorch.
## Scalars
The loss and accuracy metric scalar plots, along with the resource utilization plots, which are titled **:monitor: machine**,
appear in the experiment's page in the **web UI**, under **RESULTS** **>** **SCALARS**.
.
appear in the experiment's page in the [web UI](../../../webapp/webapp_overview.md), under **RESULTS** **>** **SCALARS**.
![image](../../../img/examples_pytorch_tensorboardx_03.png)
## Hyperparameters
**ClearML** automatically logs command line options defined with `argparse`. They appear in **CONFIGURATIONS** **>**
ClearML automatically logs command line options defined with `argparse`. They appear in **CONFIGURATIONS** **>**
**HYPER PARAMETERS** **>** **Args**.
![image](../../../img/examples_pytorch_tensorboardx_01.png)
@@ -37,16 +35,12 @@ Text printed to the console for training progress, as well as all other console
## Artifacts
Model artifacts associated with the experiment appear in the info panel of the **EXPERIMENTS** tab and in the info panel
of the **MODELS** tab.
The experiment info panel shows model tracking, including the model name and design (in this case, no design was stored).
Models created by the experiment appear in the experiments **ARTIFACTS** tab. ClearML automatically logs and tracks
models and any snapshots created using PyTorch.
![image](../../../img/examples_pytorch_tensorboardx_04.png)
The model info panel contains the model details, including:
* Model URL
* Framework
* Snapshot locations.
Clicking on the model name takes you to the [models page](../../../webapp/webapp_model_viewing.md), where you can view
the models details and access the model.
![image](../../../img/examples_pytorch_tensorboardx_05.png)