TUDB-Labs / mLoRA

An Efficient "Factory" to Build Multiple LoRA Adapters
Apache License 2.0
277 stars 53 forks source link

Feature/hyperparameter tuning final #267

Open Saf9933 opened 1 month ago

Saf9933 commented 1 month ago

Design

Implement hyperparameter tuning for the mLoRA project to optimize model parameters and improve task performance. Files Modified mlora_train_optuna.py Purpose: This script introduces Optuna for automated hyperparameter tuning, focusing on parameters such as rank, alpha, learning_rate, and dropout. Key Changes: Objective Function: Defines an Optuna objective function that tests combinations of hyperparameters to minimize loss. Task Configuration: Dynamically generates a task configuration using the tuned hyperparameters. Execution: Sets up an Optuna study to run multiple trials, logging the best hyperparameters for improved model performance. edited executor.py Purpose: Manages task execution, model loading, and adapter application during training. Key Changes: Loss Tracking: Enhanced to log loss values for each task during training, integrating seamlessly with the hyperparameter tuning process. Hooks: Added and refined hooks (init, running, ready, done, terminate) for better control over model adapter loading and task status. Summary These changes streamline and automate the process of finding optimal hyperparameters, improving model performance with minimal manual intervention. The integration with Optuna in mlora_train_optuna.py complements executor.py’s enhanced task management and loss tracking to support efficient tuning workflows.