For AI agents: the complete documentation index is available at https://docs.ovhcloud.com/it/llms.txt, the full documentation bundle is available at https://docs.ovhcloud.com/it/llms-full.txt, and this page is available as Markdown at https://docs.ovhcloud.com/it/guides/public-cloud/ai-machine-learning/ai-notebooks-weights-biases.md.

AI Notebooks - Tutorial - Weights & Biases integration

Vedi come Markdown

How to use wandb in notebooks

Objective

The purpose of this tutorial is to show how it is possible to use Weights & Biases, one of the most famous Developer tools for machine learning, with OVHcloud AI Notebooks.

Weight and Biases allow you to track your machine learning experiments, version your datasets and manage your models easily, like shown below :

Weights and Biases workspace comparing seven training runs with charts for Test error rate loss acc val_loss val_acc and epoch

This tutorial presents two examples of using Weights & Biases. In the first notebook we will use TensorFlow and in the second a PyTorch docker image.

Requirements

  • access to the ;
  • a Public Cloud project created;
  • a Public Cloud user with the ability to start AI Notebooks;
  • a Weights & Biases account, you can create it on their website. It's Free for individuals.

Instructions

Launch and access a Jupyter notebook

The first step consists of creating a Jupyter Notebook with OVHcloud AI Notebooks.

First, you have to install the OVHAI CLI then just choose the name of the notebook (<notebook-name>) and the number of GPUs (<nb-gpus>) to use on your job and use the following command:

  • TensorFlow image docker:
ovhai notebook run tensorflow jupyterlab \
    --name <notebook-name> \
    --gpu <nb-gpus>
  • PyTorch image docker:
ovhai notebook run pytorch jupyterlab \
    --name <notebook-name> \
    --gpu <nb-gpus>

Whatever the selected method, you should now be able to reach your notebook's URL (see in the output of the command, the field Url:).

Experiment with OVHcloud examples notebooks

Once the repository has been cloned, find the notebook of your choice.
Instructions are directly shown inside the notebooks. You can run them with the standard "Play" button inside the notebook interface.

Notebook using TensorFlow and Weights & Biases is based on the MNIST dataset

The notebook using TensorFlow and Weights & Biases is based on the MNIST dataset. To access it, follow this path:

ai-training-examples > notebooks > computer-vision > image-classification > tensorflow > weights-and-biases > notebook_Weights_and_Biases_MNIST.ipynb

The aim of this tutorial is to show how it is possible, thanks to Weights & Biases, to compare the results of trainings according to the chosen hyperparameters.

For example, you can display the accuracy and loss curves for your valid and train data. These metrics will be displayed for each epoch of each training.

Weights and Biases workspace with a Valid data section showing val_loss and val_acc and a Train data section showing loss and acc for the seven training runs

You can then compare your trainings using the Parallel coordinates graph type:

Weights and Biases Parallel coordinates chart linking the loss learning_rate and epochs axes to the resulting acc value with a colour scale from 0.984 to 1.000

You can also compare the Test error rates:

Weights and Biases Test error rate bar chart comparing the runs training_1 to training_7 with values between about 1.2 and 1.9

A preview of this notebook can be found on GitHub.

Notebook using PyTorch and Weights & Biases is based on YOLOv5 and the COCO dataset

The notebook using PyTorch and Weights & Biases is based on YOLOv5 and the COCO dataset. To access it, follow this path:

ai-training-examples > notebooks > computer-vision > object-detection > miniconda > weights-and-biases > notebook_Weights_and_Biases_yolov5.ipynb

The aim of this tutorial is to show how Weights & Biases can be used with the YOLOv5 real-time object detection framework. In order to achieve this, the YOLOv5 s, m, l and x models performance will be compared on the COCO dataset for the same number of epochs.

Weights and Biases workspace with a train section showing obj_loss cls_loss and box_loss and a val section showing the same three losses for the four runs yolov5x_results yolov5l_results yolov5m_results and yolov5s_results

Another possibility with Weights & Biases is to display the use of your computing resources:

Weights and Biases System section showing GPU Power Usage in watts and percent GPU Memory Allocated GPU Time Spent Accessing Memory GPU Temp and GPU Utilization over time for the four YOLOv5 runs

You can also create your report with your curves and images and share it with your team!

Weights and Biases report titled YOLOv5 model comparaison with an Images row showing the same photo annotated by each of the four runs and a Results row showing their PR_curve.png precision recall curves

A preview of this notebook can be found on GitHub.

Conclusion

To sum up, Weights & Biases allows you to quickly track your experiments, version and iterate data sets, evaluate model performance, reproduce models, visualise results and spot regressions, and share results with your colleagues.

You can use it directly on OVHcloud AI Notebooks in few minutes.

Go further

  • You can also use the Weights & Biases tool in an AI Training job by following this tutorial.
  • It is possible to integrate Weights and Biases to compare the performance of pre-trained models like ResNet50 for image classification. Take a look at this notebook.

If you need training or technical assistance to implement our solutions, contact your sales representative or click on this link to get a quote and ask our Professional Services experts for a custom analysis of your project.

Feedback

Please send us your questions, feedback and suggestions to improve the service:

Questa pagina ti è stata utile?