https://github.com/nicolasmicaux/autohparams
Automatically create a config of hyper-parameters from global variables
https://github.com/nicolasmicaux/autohparams
hyperparameter hyperparameters logger logging
Last synced: 5 months ago
JSON representation
Automatically create a config of hyper-parameters from global variables
- Host: GitHub
- URL: https://github.com/nicolasmicaux/autohparams
- Owner: NicolasMICAUX
- Created: 2023-07-26T19:56:28.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-09-24T15:37:58.000Z (7 months ago)
- Last Synced: 2024-11-08T14:17:51.549Z (6 months ago)
- Topics: hyperparameter, hyperparameters, logger, logging
- Language: Python
- Homepage: https://pypi.org/project/autohparams/
- Size: 74.2 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.fr.md
- Contributing: CONTRIBUTING.md
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
[![Contributors][contributors-shield]][contributors-url]
[![Stargazers][stars-shield]][stars-url]
[![Issues][issues-shield]][issues-url]
[![PyPi version][pypi-shield]][pypi-url]
[![Python 2][python2-shield]][python-url]
[![Python 3][python3-shield]][python-url]
AutoHparams
Créez automatiquement une configuration d'hyper-paramètres à partir de variables globales!
## À propos
Avez-vous déjà effectué une expérience de machine learning pendant des heures, juste pour vous rendre compte quelques jours plus tard que vous avez oublié de sauvegarder certains hyper-paramètres? Alors vous devez prier pour que votre mémoire soit bonne, ou tout recommencer?
AutoHparams est un outil qui sauvegarde chaque variable de la portée globale de votre code dans un dictionnaire, que vous pouvez ensuite enregistrer à l'aide de votre outil préféré. Cela permet d'éviter 80% des situations d'hyper-paramètres oubliés.
## Getting Started
AutoHparams s'utilise en une ligne.Installez AutoHparams avec pip :
```sh
pip install autohparams
```Importez-le dans votre code, en ajoutant cette ligne :
```python
from autohparams import get_auto_hparams
```Pour obtenir le dictionnaire de hparamsuration, faites simplement :
```python
hparams = get_auto_hparams(globals())
```**Advanced tip**
Par défaut, `get_auto_hparams` ignore les variables dont le nom commence par un trait de soulignement` _`. Pratique pour filtrer les variables que vous souhaitez inclure dans la hparamsuration.
Par exemple:
```python
lr = 0.001 # nous voulons inclure le taux d'apprentissage
bs = 64 # nous voulons inclure la taille de lot
_gpu = 0 # nous ne voulons pas inclure le GPU choisi
hparams = get_auto_hparams(globals())
```## Usage
Vous pouvez maintenant l'utiliser dans n'importe quel cadre de votre choix, par exemple :**Tensorboard**
```python
import tensorflow as tf
from tensorboard.plugins.hparams import api as hpwith tf.summary.create_file_writer('logs/hparam_tuning').as_default():
hp.hparams(hparams)
```**MLflow**
```python
import mlflowwith mlflow.start_run():
mlflow.log_params(hparams)
```**Weights & Biases (wandb)**
```python
import wandbwandb.init(hparams=hparams)
```**Comet.ml**
```python
from comet_ml import Experimentexperiment = Experiment()
experiment.log_parameters(hparams)
```**Neptune.ai**
```python
import neptune.new as neptunerun = neptune.init()
run['parameters'] = hparams
```**Pytorch Lightning**
```python
import pytorch_lightning as pltrainer = pl.Trainer(logger=...)
trainer.logger.log_hyperparams(hparams)
```**Guild AI**
```python
import guildguild.run(hparams=hparams)
```**Polyaxon**
```python
import polyaxon_sdkapi_client = polyaxon_sdk.ApiClient()
api_client.create_hyper_params(run_uuid='uuid-of-your-run', body=hparams)
```**ClearML**
```python
from clearml import Tasktask = Task.init()
task.set_parameters(hparams)
```**Kubeflow**
```python
from kubeflow.metadata import metadatastore = metadata.Store()
store.log_metadata(hparams)
```#### Encore plus concis
Si vous êtes amateur de la sorcellerie de python, vous pouvez même import autohparams et l'utiliser comme une fonction:
```python
import autohparams
config = autohparams(globals())
```
On ne peut pas faire plus simple !## Contributing
Contributions are welcome!### Roadmap/todo
Non-Code contribution :
| Task | Importance | Difficulty | Contributor on it | Description |
|:-------------------------|------------|------------|-------------------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Adding documentation](https://github.com/NicolasMICAUX/autohparams/discussions/6) | 4/5 | 1/5 | NOBODY | Write basic tutorials with real-life scenarios, write a wiki for other contributors to better understand the functioning of the library. |_For every todo, just click on the link to find the discussion where I describe how I would do it._
See the [discussions](https://github.com/NicolasMICAUX/autohparams/discussions) for a full list of proposed features (and known issues).### How to contribute
Contributing is an awesome way to learn, inspire, and help others. Any contributions you make are **greatly appreciated**, even if it's just about styling and best practices.If you have a suggestion that would make this project better, please fork the repo and create a pull request.
Don't forget to give the project a star! Thanks again!1. Fork the Project
2. Create your Feature Branch (`git checkout -b feature/YourAmazingFeature`)
3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)
4. Push to the Branch (`git push origin feature/AmazingFeature`)
5. Open a Pull Request## Authors
This library was created by [Nicolas MICAUX](https://github.com/NicolasMICAUX).[contributors-shield]: https://img.shields.io/github/contributors/NicolasMICAUX/autohparams.svg?style=for-the-badge
[contributors-url]: https://github.com/NicolasMICAUX/autohparams/graphs/contributors
[stars-shield]: https://img.shields.io/github/stars/NicolasMICAUX/autohparams.svg?style=for-the-badge
[stars-url]: https://github.com/NicolasMICAUX/autohparams/stargazers
[issues-shield]: https://img.shields.io/github/issues/NicolasMICAUX/autohparams.svg?style=for-the-badge
[issues-url]: https://github.com/NicolasMICAUX/autohparams/issues
[pypi-shield]: https://img.shields.io/pypi/v/searchin.svg?style=for-the-badge
[pypi-url]: https://pypi.org/project/searchin/
[python2-shield]: https://img.shields.io/badge/python-2.7+-blue.svg?style=for-the-badge
[python3-shield]: https://img.shields.io/badge/python-3.5+-blue.svg?style=for-the-badge
[python-url]: https://www.python.org/downloads/[//]: # ([license-shield]: https://img.shields.io/github/license/NicolasMICAUX/autohparams.svg?style=for-the-badge)
[//]: # ([license-url]: https://github.com/NicolasMICAUX/autohparams/blob/master/LICENSE.txt)
[//]: # ([linkedin-shield]: https://img.shields.io/badge/-LinkedIn-black.svg?style=for-the-badge&logo=linkedin&colorB=555)
[//]: # ([linkedin-url]: https://linkedin.com/in/othneildrew)