jljiu commited on
Commit
201a793
·
verified ·
1 Parent(s): 3423340

Update train.py

Browse files
Files changed (1) hide show
  1. train.py +8 -4
train.py CHANGED
@@ -14,12 +14,16 @@ class ModelTrainer:
14
  with open(system_prompts_path, 'r', encoding='utf-8') as f:
15
  self.system_prompts = json.load(f)
16
 
17
- # 初始化tokenizer和model - 移除GPU相关设置
18
- self.tokenizer = AutoTokenizer.from_pretrained(model_id)
 
 
 
19
  self.model = AutoModelForCausalLM.from_pretrained(
20
  model_id,
21
- low_cpu_mem_usage=True, # 降低内存使用
22
- torch_dtype='float32' # 使用float32而不是float16
 
23
  )
24
 
25
  # 使用更轻量的LoRA配置
 
14
  with open(system_prompts_path, 'r', encoding='utf-8') as f:
15
  self.system_prompts = json.load(f)
16
 
17
+ # 初始化tokenizer和model - 添加trust_remote_code=True
18
+ self.tokenizer = AutoTokenizer.from_pretrained(
19
+ model_id,
20
+ trust_remote_code=True # 添加此参数
21
+ )
22
  self.model = AutoModelForCausalLM.from_pretrained(
23
  model_id,
24
+ trust_remote_code=True, # 添加此参数
25
+ low_cpu_mem_usage=True,
26
+ torch_dtype='float32'
27
  )
28
 
29
  # 使用更轻量的LoRA配置