ITADN

[问题/Issue] 章节X.X:简短问题描述 / ChapterX.X: Brief description

#637Opendudiaoweng 创建于 2026-05-29
documentation
D
dudiaowengcommented
### 1. 遇到问题的章节 / Affected Chapter Chapter11.1.5 ### 2. 问题类型 / Issue Type 代码错误 / Code Error ### 3. 具体问题描述 / Problem Description 代码运行时出现错误:Failed to import trl.trainer.sft_trainer because of the following error (look up to see its traceback):'gbk' codec can't decode byte 0x9c in position 665: illegal multibyte sequence Traceback (most recent call last): File \"C:\\Users\\13813\\Agentic-RL\\.venv\\Lib\\site-packages\\trl\\_lazy_module.py\", line 71, in _get_module return importlib.import_module(\".\" + module_name, self.__name__) ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File \"C:\\Python\\Python313\\Lib\\importlib\\__init__.py\", line 88, in import_module return _bootstrap._gcd_import(name[level:], package, level) ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File \"<frozen importlib._bootstrap>\", line 1387, in _gcd_import File \"<frozen importlib._bootstrap>\", line 1360, in _find_and_load File \"<frozen importlib._bootstrap>\", line 1331, in _find_and_load_unlocked File \"<frozen importlib._bootstrap>\", line 935, in _load_unlocked File \"<frozen importlib._bootstrap_external>\", line 1023, in exec_module File \"<frozen importlib._bootstrap>\", line 488, in _call_with_frames_removed File \"C:\\Users\\13813\\Agentic-RL\\.venv\\Lib\\site-packages\\trl\\trainer\\grpo_trainer.py\", line 59, in <module> from ..chat_template_utils import ( ...<5 lines>... ) File \"C:\\Users\\13813\\Agentic-RL\\.venv\\Lib\\site-packages\\trl\\chat_template_utils.py\", line 314, in <module> deepseekv3_chat_template = (_CHAT_TEMPLATES_DIR / \"deepseekv3.jinja\").read_text() File \"C:\\Python\\Python313\\Lib\\pathlib\\_local.py\", line 546, in read_text return PathBase.read_text(self, encoding, errors, newline) ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File \"C:\\Python\\Python313\\Lib\\pathlib\\_abc.py\", line 633, in read_text return f.read() ~~~~~~^^ UnicodeDecodeError: 'gbk' codec can't decode byte 0x9c in position 665: illegal multibyte sequence The above exception was the direct cause of the following exception: Traceback (most recent call last): File \"C:\\Users\\13813\\Agentic-RL\\.venv\\Lib\\site-packages\\hello_agents\\tools\\builtin\\rl_training_tool.py\", line 119, in run return self._handle_train(parameters) ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^ File \"C:\\Users\\13813\\Agentic-RL\\.venv\\Lib\\site-packages\\hello_agents\\tools\\builtin\\rl_training_tool.py\", line 202, in _handle_train result = self._train_grpo( model_name=model_name, ...<10 lines>... wandb_project=wandb_project ) File \"C:\\Users\\13813\\Agentic-RL\\.venv\\Lib\\site-packages\\hello_agents\\tools\\builtin\\rl_training_tool.py\", line 559, in _train_grpo trainer_wrapper.train() ~~~~~~~~~~~~~~~~~~~~~^^ File \"C:\\Users\\13813\\Agentic-RL\\.venv\\Lib\\site-packages\\hello_agents\\rl\\trainers.py\", line 292, in train from trl import GRPOConfig, GRPOTrainer File \"<frozen importlib._bootstrap>\", line 1412, in _handle_fromlist File \"C:\\Users\\13813\\Agentic-RL\\.venv\\Lib\\site-packages\\trl\\_lazy_module.py\", line 62, in __getattr__ value = getattr(module, name) File \"C:\\Users\\13813\\Agentic-RL\\.venv\\Lib\\site-packages\\trl\\_lazy_module.py\", line 61, in __getattr__ module = self._get_module(self._class_to_module[name]) File \"C:\\Users\\13813\\Agentic-RL\\.venv\\Lib\\site-packages\\trl\\_lazy_module.py\", line 73, in _get_module raise RuntimeError( ...<2 lines>... ) from e RuntimeError: Failed to import trl.trainer.grpo_trainer because of the following error (look up to see its traceback): 'gbk' codec can't decode byte 0x9c in position 665: illegal multibyte sequence ### 4. 问题重现材料 / Reproduction Materials import sys import json from hello_agents.tools import RLTrainingTool # 创建RL训练工具 rl_tool = RLTrainingTool() # 1. 快速测试:SFT训练(10个样本,1个epoch) sft_result_str = rl_tool.run({ "action": "train", "algorithm": "sft", "model_name": "Qwen/Qwen3-0.6B", "output_dir": "./models/quick_test_sft", "max_samples": 10, # 只用10个样本快速测试 "num_epochs": 1, # 只训练1轮 "batch_size": 2, "use_lora": True # 使用LoRA加速训练 }) ### 5. 补充信息 / Additional Information _No response_ ### 确认事项 / Verification - [x] 我已阅读过相关章节的文档 / I have read the relevant chapter documentation - [x] 我已搜索过现有的Issues,确认此问题未被报告 / I have searched existing Issues and confirmed this hasn't been reported - [x] 我已尝试过基本的故障排除(如重启、重新安装依赖等) / I have tried basic troubleshooting (restart, reinstall dependencies, etc.)
0 条评论