当前位置:网站首页>Weights & biases (I)

Weights & biases (I)

2022-07-23 19:18:00 Jin huaixuan

One 、 Brief introduction

Weights & Biases It is a machine learning platform for developers to build better models faster . Use W&B Lightweight of 、 Interoperable tools for fast tracking experiments 、 Version and iteration datasets 、 Evaluate model performance 、 Recurrence model 、 Visualization results and discovery regression , And share the findings with colleagues .
stay 5 Set in minutes W&B, Then quickly iterate over your machine learning pipeline , Make sure your data sets and models are tracked and versioned in a reliable recording system .

The main function

  • Experimental tracking : Real time visualization experiment

  • Super parameter tuning : Fast optimization model

  • data + Model version control : Version datasets and models

  • Model management : Manage the model lifecycle from training to production

  • Data visualization : Visual prediction across model versions

  • Collaborative reporting : Describe and share findings

  • Integrate :Py Torch、Keras、Hugging Face etc.

  • private - trusteeship :W&B Private cloud and local hosting of applications

Reference resources

  1. App The user interface
  2. Python library
  3. Command line interface

Two 、 Quick start

Use weights and bias experimental tracking to build better models more effectively .

Try this short Google Colab To see the weights and deviations , No need to install code !

2.1. Set up wandb

a) stay https://wandb.ai/site Sign up for a free account , Then log in to your wandb account .
b) stay Python 3 Use in the environment pip Install... On your machine wandb library
c) Log in to wandb library . Here you will find your API secret key :https://wandb.ai/authorize. 

pip install wandb

wandb login

2.2. Start a new run

stay Python Initialize in script or notebook W&B New operation in . wandb.init() Will start tracking system metrics and console logs , Open the box . Run your code , Enter your API secret key , You will see the new run appear in W&B in .
More about wandb.init() →【 The following guidance page 】

import wandb
wandb.init(project="my-awesome-project")

2.3. Tracking indicators

Use wandb.log() Track metrics or framework integration for easy detection .

wandb.log({'accuracy': train_acc, 'loss': train_loss})

2.4. Trace superparameter

Save the super parameters , So that you can quickly compare experiments . 

wandb.config.dropout = 0.2

 2.5. Get alert

If your W&B Run Crashed or whether the custom trigger has been reached ( For example, your lost to Na N Or your ML The steps in the pipeline have been completed ), Through Slack Or email for notification . For complete setup , Refer to the alert documentation .

1. stay W&B Open alarm in user settings
2. take wandb.alert() Add to your code

wandb.alert(
    title="Low accuracy", 
    text=f"Accuracy {acc} is below the acceptable threshold {thresh}"
)

And then in Slack( Or your email ) View in W&B Alert message .

common problem

Where can I find my API secret key ?
Sign in www.wandb.ai after ,API The key will be on the authorization page .


How to use in an automated environment W&B?
If you are inconvenient to run shell Training models in an automated environment of commands , for example Google Of Cloud ML, You should check our environment variable configuration guide .


Do you provide local 、 Local installation ?
Yes , You can host locally and privately in your own machine or private cloud W&B, Try this quick tutorial notebook to see how . Be careful , To log in wandb Local server , You can set the host flag to the address of the local instance .


How to temporarily close wandb logging ?
If you are testing code and want to disable wandb Sync , Please set environment variable WANDB _ MODE=offline.

原网站

版权声明
本文为[Jin huaixuan]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/204/202207231703187163.html