Py之yacs:yacs的简介、安装、使用方法之详细攻略
生活随笔
收集整理的這篇文章主要介紹了
Py之yacs:yacs的简介、安装、使用方法之详细攻略
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
Py之yacs:yacs的簡介、安裝、使用方法之詳細攻略
?
?
目錄
yacs的簡介
yacs的安裝
yacs的使用方法
1、基礎用法
?
?
?
yacs的簡介
? ? ? ?A simple experiment configuration system for research.
? ? ? ?yacs是作為一個輕量級庫創(chuàng)建的,用于定義和管理系統(tǒng)配置,比如那些通常可以在為科學實驗設計的軟件中找到的配置。這些“配置”通常包括用于訓練機器學習模型的超參數或可配置模型超參數(如卷積神經網絡的深度)等概念。由于您正在進行科學研究,所以再現(xiàn)性是最重要的,因此您需要一種可靠的方法來序列化實驗配置。YACS使用YAML作為一種簡單的、人類可讀的序列化格式。范例是:你的代碼+實驗E的yacs配置(+外部依賴+硬件+其他討厭的術語…)=可重復的實驗E。雖然你不能控制一切,但至少你可以控制你的代碼和你的實驗配置。yacs會幫你的。
? ? ? ?yacs是在py-fast -rcnn和Detectron中使用的實驗配置系統(tǒng)中發(fā)展起來的。
?
?
yacs的安裝
pip install yacs
?
yacs的使用方法
1、基礎用法
# my_project/config.py from yacs.config import CfgNode as CN_C = CN()_C.SYSTEM = CN() # Number of GPUS to use in the experiment _C.SYSTEM.NUM_GPUS = 8 # Number of workers for doing things _C.SYSTEM.NUM_WORKERS = 4_C.TRAIN = CN() # A very important hyperparameter _C.TRAIN.HYPERPARAMETER_1 = 0.1 # The all important scales for the stuff _C.TRAIN.SCALES = (2, 4, 8, 16)def get_cfg_defaults():"""Get a yacs CfgNode object with default values for my_project."""# Return a clone so that the defaults will not be altered# This is for the "local variable" use patternreturn _C.clone()# Alternatively, provide a way to import the defaults as # a global singleton: # cfg = _C # users can `from config import cfg`?
?
?
?
總結
以上是生活随笔為你收集整理的Py之yacs:yacs的简介、安装、使用方法之详细攻略的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Py之fvcore:fvcore库的简介
- 下一篇: Py之portalocker:porta