2021-12-19 10:34:06 +00:00
---
2021-12-27 08:41:43 +00:00
title: MegEngine
2021-12-19 10:34:06 +00:00
---
The [megengine_mnist.py ](https://github.com/allegroai/clearml/blob/master/examples/frameworks/megengine/megengine_mnist.py )
example demonstrates the integration of ClearML into code that uses [MegEngine ](https://github.com/MegEngine/MegEngine )
and [TensorBoardX ](https://github.com/lanpa/tensorboardX ). ClearML automatically captures models saved with `megengine` .
The example script does the following:
2024-12-09 13:02:44 +00:00
* Trains a simple deep neural network on MegEngine's built-in [MNIST ](https://www.megengine.org.cn/doc/master/en/reference/api/megengine.data.dataset.MNIST.html )
2021-12-19 10:34:06 +00:00
dataset.
* Creates a TensorBoardX `SummaryWriter` object to log scalars during training.
2023-09-04 12:40:42 +00:00
* Creates a ClearML experiment named `megengine mnist train` in the `examples` project.
2021-12-19 10:34:06 +00:00
## Hyperparameters
2022-05-26 06:54:41 +00:00
ClearML automatically logs command line options defined with `argparse` . They appear in the experiment's **CONFIGURATION**
2023-01-12 10:49:55 +00:00
tab under **HYPERPARAMETERS** ** >** **Args** .
2021-12-19 10:34:06 +00:00
![Configuration tab ](../../../img/examples_megengine_mnist_config.png )
## Scalars
The example script's `train` function calls TensorBoardX's `SummaryWriter.add_scalar` method to report `loss` .
ClearML automatically captures the data that is added to the `SummaryWriter` object.
These scalars can be visualized in plots, which appear in the ClearML [WebApp ](../../../webapp/webapp_home.md ), in the
2022-05-26 06:54:41 +00:00
experiment's **SCALARS** tab.
2021-12-19 10:34:06 +00:00
![Scalars tab ](../../../img/examples_megengine_mnist_scalars.png )
## Models
ClearML automatically captures the model logged using the `megengine.save` method, and saves it as an artifact.
View saved snapshots in the experiment's **ARTIFACTS** tab.
![Artifacts tab ](../../../img/examples_megengine_models_1.png )
To view the model details, click the model name in the **ARTIFACTS** page, which will open the model's info tab. Alternatively, download the model.
The model info panel contains the model details, including:
* Model URL
* Framework
* Snapshot locations.
![Model info panel ](../../../img/examples_megengine_models_2.png )
## Console
2023-10-01 07:31:48 +00:00
All console output during the script's execution appears in the experiment's **CONSOLE** page.
2024-08-05 07:12:18 +00:00
2021-12-19 10:34:06 +00:00
![Console tab ](../../../img/examples_megengine_console.png )