-
Notifications
You must be signed in to change notification settings - Fork 51
/
mlora_train.py
44 lines (37 loc) · 1.41 KB
/
mlora_train.py
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
32
33
34
35
36
37
38
39
40
41
42
43
44
# m-LoRA: Efficient Multi-LoRA Fine Tuning with Shared-Based Model
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Copyright (C) 2024 All Rights Reserved.
#
# Github: https://github.com/TUDB-Labs/mLoRA
import mlora.model
import mlora.utils
import mlora.executor
import mlora.config
if __name__ == "__main__":
args = mlora.utils.get_cmd_args()
mlora.utils.setup_seed(args.seed)
mlora.utils.setup_logging(args.log_level, args.log_file)
mlora.utils.setup_cuda_check()
mlora.utils.setup_metric_logger(args.metric_file)
# enable the trace mode for profiling performance
if args.trace:
mlora.utils.setup_trace_mode()
tokenizer, model = mlora.model.load_model(args)
config = mlora.config.MLoRAConfig(args.config)
# init all task from config file
executor = mlora.executor.Executor(model, tokenizer, config)
for item in config.tasks_:
executor.add_task(item)
executor.execute()