bread-good111 commited on
Commit
19d999f
·
verified ·
1 Parent(s): ce8e22b

Delete scripts/run_inference_final.py

Browse files
Files changed (1) hide show
  1. scripts/run_inference_final.py +0 -52
scripts/run_inference_final.py DELETED
@@ -1,52 +0,0 @@
1
- """
2
- 最终推理脚本 - 使用已训练好的模型
3
- """
4
- import sys
5
- from pathlib import Path
6
-
7
- # 添加scripts目录到路径,以便导入inference_longemotion
8
- sys.path.append(str(Path(__file__).parent))
9
-
10
- from inference_longemotion import LongEmotionInference
11
-
12
- def main():
13
- print("="*80)
14
- print("LongEmotion 测试集推理 - 使用已训练模型")
15
- print("="*80)
16
-
17
- # 配置 - 使用Detection文件夹内的相对路径
18
- # 获取Detection文件夹的根目录
19
- detection_root = Path(__file__).parent.parent
20
- model_path = detection_root / "model" / "best_model.pt"
21
- test_file = detection_root / "test_data" / "test.jsonl"
22
- output_file = detection_root / "submission" / "predictions.jsonl"
23
- output_detailed = detection_root / "submission" / "predictions_detailed.json"
24
-
25
- print(f"\n模型: {model_path}")
26
- print(f"测试集: {test_file} (136个样本)")
27
- print(f"输出: {output_file}")
28
-
29
- # 创建推理器
30
- print("\n[1/2] 加载模型...")
31
- inference = LongEmotionInference(
32
- model_path=str(model_path),
33
- device="cpu", # 使用CPU,更稳定
34
- max_length=512,
35
- batch_size=16
36
- )
37
-
38
- # 执行推理
39
- print("\n[2/2] 开始推理...")
40
- inference.inference_longemotion_test(
41
- test_file=str(test_file),
42
- output_file=str(output_file),
43
- output_detailed=str(output_detailed)
44
- )
45
-
46
- print("\n" + "="*80)
47
- print("[完成] 推理结束!")
48
- print("="*80)
49
-
50
- if __name__ == "__main__":
51
- main()
52
-