-
Notifications
You must be signed in to change notification settings - Fork 54
Expand file tree
/
Copy pathtrain.py
More file actions
31 lines (22 loc) · 733 Bytes
/
train.py
File metadata and controls
31 lines (22 loc) · 733 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import argparse
import yaml
from QloraTrainer import QloraTrainer
def read_yaml_file(file_path):
with open(file_path, 'r') as file:
try:
data = yaml.safe_load(file)
return data
except yaml.YAMLError as e:
print(f"Error reading YAML file: {e}")
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("config_path", help="Path to the config YAML file")
args = parser.parse_args()
config = read_yaml_file(args.config_path)
trainer = QloraTrainer(config)
print("Load base model")
trainer.load_base_model()
print("Start training")
trainer.train()
print("Merge model and save")
trainer.merge_and_save()