Jelajahi Sumber

换用github jwjohns/unsloth-GRPO-qwen2.5 验证GRPO训练模型

zhouyang.xie 2 bulan lalu
induk
melakukan
7b5779cba9

TEMPAT SAMPAH
resources/主题3 能源大模型应用与实践-中广核新能源.pdf


+ 5 - 1
src/inference.py

@@ -2,6 +2,7 @@ import os
 import torch
 from unsloth import FastLanguageModel
 from transformers import TextStreamer
+from conf_train import load_config
 
 class ModelInference:
     def __init__(self, model_path, max_seq_length, dtype, load_in_4bit):
@@ -53,8 +54,11 @@ class ModelInference:
             print(f"人工智能: {model_response}")
 
 if __name__ == "__main__":
+    # Load configuration
+    config = load_config()
+
     # 配置参数
-    model_path = os.path.join('..', 'models', 'trained', 'DeepSeek-R1-Distill-Qwen-1.5B-GRPO')
+    model_path = config.save_path
     max_seq_length = 2048
     dtype = torch.float16
     load_in_4bit = True