|
@@ -121,7 +121,7 @@ class ModelTrainer:
|
|
|
max_lora_rank = lora_rank,
|
|
|
gpu_memory_utilization=0.6, # 0.6 # Reduce if out of memory
|
|
|
)
|
|
|
-
|
|
|
+
|
|
|
# 将模型移动到设备上
|
|
|
model = model.to_empty(device='cuda') # 使用 to_empty 而不是 to
|
|
|
|
|
@@ -226,7 +226,7 @@ if __name__ == "__main__":
|
|
|
# model_name: 预训练模型的路径
|
|
|
max_seq_length = 6000 # 单次会话(single session) 的最大 token 长度,一个token大约3-4 字节(Byte)
|
|
|
dtype = torch.float16 # 数据类型
|
|
|
- load_in_4bit = False # 是否以4位精度加载模型
|
|
|
+ load_in_4bit = True # 是否以4位精度加载模型
|
|
|
lora_rank=16
|
|
|
|
|
|
# 定义训练集和测试集路径
|