This project provides scripts and configuration files to automate hyperparameter search and evaluation for various German-language BERT models using the NNI (Neural Network Intelligence) toolkit. It supports both classification and named entity recognition (NER) tasks.
├── cls/
│ ├── create_hpsets_configs.py # Generates hyperparameter sets and NNI config files for classification
│ └── run_classification.py # Runs classification experiments
├── ner/
│ ├── create_hpsets_configs.py # Generates hyperparameter sets and NNI config files for NER
│ └── run_ner.py # Runs NER experiments
├── parse_best_hparams.py # Parses best hyperparameters from NNI results
├── parse_best_metrics.py # Parses best metrics from NNI results
├── parse_entity_metrics.py # Parses entity-level metrics for NER
├── parse_results.py # Parses general experiment results
├── parse_runtime.py # Parses runtime information
├── requirements.txt # Python dependencies
└── README.md # Project documentation
- Automated Hyperparameter Search:
- Generates JSON search spaces and NNI
config.ymlfiles for each model/dataset combination. - Supports grid search for learning rate and batch size.
- Generates JSON search spaces and NNI
- Experiment Management:
- Organizes experiments in
experiments/<model>/<dataset>/directories. - Compatible with NNI's local training service.
- Organizes experiments in
- Result Parsing:
- Scripts to extract best hyperparameters, metrics, and runtime from NNI output.
-
Install Dependencies
pip install -r requirements.txt
-
Generate Hyperparameter Sets and Configs
- For classification:
python cls/create_hpsets_configs.py
- For NER:
python ner/create_hpsets_configs.py
- For classification:
-
Run NNI Experiments
- Use the generated
config.ymlfiles inexperiments/<model>/<dataset>/with NNI:nnictl create --config experiments/<model>/<dataset>/config.yml
- Use the generated
-
Parse Results
- Use the provided parsing scripts to extract metrics and hyperparameters from NNI output.
- Python 3.8+
- NNI toolkit
- PyTorch, Transformers, and other dependencies (see
requirements.txt)
- Update dataset paths in
create_hpsets_configs.pyas needed. - GPU device selection is set via
CUDA_VISIBLE_DEVICESin the scripts.
MIT.
For questions or contributions, please contact the project maintainer.