Skip to content

Conversation

@Saf9933
Copy link
Contributor

@Saf9933 Saf9933 commented Oct 29, 2024

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.


if args.base_model == "tinyllama":
logging.info("Using TinyLlama_v1.1 model for testing")
args.base_model = "/model/TinyLlama_v1.1"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do not use hard code

import os
from typing import Dict

import optuna
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add optuna to requirements.txt

from mlora.config.task import TrainTaskConfig

# Set up logging
logging.basicConfig(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

redunant code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants