ImaghT commited on
Commit
ad5646f
·
verified ·
1 Parent(s): 0460161

Update Unit_3.py

Browse files
Files changed (1) hide show
  1. Unit_3.py +0 -32
Unit_3.py CHANGED
@@ -137,35 +137,3 @@ model.save(model_save_name) # 保存为 dqn-SpaceInvaders.zip
137
  print("Training Finished!")
138
 
139
 
140
- # ============================================================
141
- # 7. 上传到 Hugging Face Hub(可选)
142
- # ============================================================
143
-
144
- # 模型名称(会显示在 Hugging Face 页面)
145
- model_name = "dqn-SpaceInvadersNoFrameskip-v4"
146
-
147
- # 🔥 重要:改成你的 Hugging Face 用户名
148
- username = "ImaghT" # <=== 改成你的用户名!
149
- repo_id = f"{username}/{model_name}"
150
-
151
- print(f"Uploading to {repo_id}...")
152
-
153
- # 创建评估环境(使用训练时的环境格式)
154
- eval_env = make_atari_env(env_id, n_envs=1, seed=42) # env_id 仍是 "ALE/SpaceInvaders-v5"
155
- eval_env = VecFrameStack(eval_env, n_stack=4)
156
-
157
- # ⚠️ 关键修改:env_id 参数使用旧格式以匹配验证系统
158
- package_to_hub(
159
- model=model,
160
- model_name=model_name,
161
- model_architecture="DQN",
162
- env_id="SpaceInvadersNoFrameskip-v4", # ⚠️ 使用旧格式标识符(硬编码)
163
- eval_env=eval_env, # 评估环境仍使用训练时的实际环境
164
- repo_id=repo_id,
165
- commit_message="Unit 3 DQN SpaceInvaders Solution",
166
- is_deterministic=False,
167
- video_length=1000
168
- )
169
-
170
- print("Done! Check your model on Hugging Face Hub.")
171
-
 
137
  print("Training Finished!")
138
 
139