Image-Text-to-Text
Transformers
English
gamescaling
game-agent
embodied-agent
keyboard-mouse
continued-pretraining
qwen3_5
Run this model with HF Jobs
Run THUSI-Lab/GameScaling on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs and TRL to fine-tune https://huggingface.co/THUSI-Lab/GameScaling. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/THUSI-Lab/GameScaling on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Evaluate on a benchmark
Use HF Jobs to evaluate https://huggingface.co/THUSI-Lab/GameScaling. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.
Quantize for lower memory use
Use HF Jobs to create a 4-bit version of https://huggingface.co/THUSI-Lab/GameScaling. Push it to a new model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.
Instructions to use THUSI-Lab/GameScaling with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use THUSI-Lab/GameScaling with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="THUSI-Lab/GameScaling")# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("THUSI-Lab/GameScaling", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use THUSI-Lab/GameScaling with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "THUSI-Lab/GameScaling" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "THUSI-Lab/GameScaling", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/THUSI-Lab/GameScaling
- SGLang
How to use THUSI-Lab/GameScaling with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "THUSI-Lab/GameScaling" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "THUSI-Lab/GameScaling", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "THUSI-Lab/GameScaling" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "THUSI-Lab/GameScaling", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use THUSI-Lab/GameScaling with Docker Model Runner:
docker model run hf.co/THUSI-Lab/GameScaling
Add 0.8B and 2B (S1, S3) checkpoints, prompt skeleton
Browse filesFiles changed (8)
- README.md+54-13
- models/0p8b_s1_1600h_gs6736/model.safetensorsAdded+3
- models/0p8b_s3_1600h_gs6760/model.safetensorsAdded+3
- models/2b_s1_1600h_gs6736/model.safetensorsAdded+3
- models/2b_s3_1600h_gs6760/model.safetensorsAdded+3
- prompts/example_doom_battle1.txtAdded+28
- prompts/system_prompt_template.txtAdded+23
- tests/test_core.py+11
15 unmodified lines16171819202128 unmodified lines5051525354555626 unmodified lines8384858687888990919293949531 unmodified lines12712812913013113213324 unmodified lines1581591601611621631641651661671681697 unmodified lines17717817918018118218321 unmodified lines20520620720820921021121 unmodified lines2332342352362372382392402412422432442452462472482498 unmodified lines25825926026126226326415 unmodified linespolicy.py 多轮客户端:历史窗口、图像编码、请求体action.py 动作格式与反解(200 ms chunk -> 6 x 33 ms 键鼠)keymaps.py 训练词表 <-> 浏览器/Playwright 键名models/ 8 个 Qwen3.5 checkpoint,各自带 chat_template.jinjascripts/serve_vllm.sh 起 OpenAI 兼容服务tests/test_core.py 离线单测(不需要 GPU)28 unmodified lines`chat_template.jinja`(vLLM 默认就会用),**不要**换成原版 Qwen 模板:自带模板会把没有思维链的历史轮渲染成 `<think>\n\n</think>\n\n<|action_start|>...`,与训练样本逐 token 一致。## 2. 最小用法```pythonfrom PIL import Image26 unmodified lines`PolicyConfig.preset("omnigamearena" | "vizdoom" | "gameworld")`:前两档把画面缩到 854×480;`gameworld` 不预填 `<think>`,提示词要用 `build_gameworld_system_prompt(..., reasoning=False)`。## 3. 系统提示词规范所有 benchmark 用同一骨架,顺序固定(`gamescaling/prompt.py`):1. **开场白**:游戏专家 + 游戏名 + "规划接下来 200ms、6 步、每步 33ms" 的契约;2. `**Game Rules**`:游戏是什么、怎么计分;3. **操作说明**:本游戏用到的键,**必须写成训练词表**(见 §4);4. `**Task Instruction**`:仅 GameWorld(一个游戏有多个任务);5. `**Output Format**`:模型据此决定输出格式;6. `**Explanation**` + `**Key Naming Rules**`。31 unmodified lines历史轮只放动作(`history_think=0`,论文口径)。解析失败的轮在历史里存成显式 no-op`<|action_start|>0 0 0 ; ; ; ; ; ; <|action_end|>`,而不是模型的原始坏输出。## 4. 动作格式与反解```<|action_start|>X Y Z ; g1 ; g2 ; g3 ; g4 ; g5 ; g6<|action_end|>24 unmodified lines不在词表里的 token 被丢弃(记在 `Action.dropped`)。`keymaps.TO_PLAYWRIGHT` 给出到浏览器键名的映射。## 5. 三个 benchmark三者都是**暂停时钟(pdq)**:模型思考时游戏冻结,只在执行 chunk 时前进。论文所有主表都是这个口径;不同时钟之间的分数不可比。### 5.1 ViZDoom(自包含)```bashpip install -r requirements.txt vizdoom==1.2.47 unmodified lines6 个 tic 上均分;HUD 开。计分:battle 图数击杀,defend 图击杀减死亡;`overall` 是四图均值的均值。场景文件来源见 `integrations/vizdoom/scenarios/PROVENANCE.md`。### 5.2 OmniGameArena在 [OmniGameArena](https://github.com/mxlin043/OmniGameArena)(测于 `f3a4057`)里注册agent kind `gamescaling`:21 unmodified lines- `solo_craft` 的后续 episode 请换一个新的 UE5 进程;复用实例时第 2、3 局会立即结束并复报第 1 局分数。### 5.3 GameWorld在 [GameWorld](https://github.com/gameworld-project/gameworld)(测于 `e236a39`)里注册模型id `gamescaling`:21 unmodified lines的 WASD 映射成方向键(模型主要在 PC 游戏上训练,习惯用 WASD 移动)。环境变量`GAMESCALING_ENDPOINT` 可覆盖服务地址,`GAMESCALING_THINK=1` 可打开 think prefill(非论文口径)。## 6. 接入新游戏1. 用 `build_system_prompt` 写提示词:游戏名、规则、`key_bindings` 用训练词表;鼠标控视角时加 `mouse_aim=True`;`reasoning` 与 `think_prefill` 一致。2. 每 200 ms(或暂停时钟下每次决策)截一帧,调用 `policy.act(frame)`。3. 按 §4 执行 `Action`:6 个 33 ms 子步的按住键 + 鼠标位移 + 滚轮。4. 新游戏沿用默认客户端(原尺寸画面、预填 `<think>`、`build_system_prompt` 标准格式)。要对齐论文某一张表时,再改用`PolicyConfig.preset("omnigamearena" | "vizdoom" | "gameworld")`。## 7. 与论文评测代码的差异发布代码与论文内部评测代码逐项对拍过:三个 benchmark 的全部系统提示词逐字节相同(ViZDoom 4 图、OmniGameArena 12 游戏 44 个 prompt、GameWorld 170 个任务),历史 trace8 unmodified lines- OmniGameArena 的 `map_wait` 用上游默认 3 s。内部评测等 60 s,但前 3 s 之后世界是冻结的,所以两者进入第一步时的游戏时间一致。## 8. 测试```bashpython tests/test_core.py # 或 python -m pytest tests/;离线:提示词、请求体、动作反解,不需要 GPU / 服务15 unmodified lines16171819202122232428 unmodified lines53545556575859606162636465666768697071727374757677787980818283848586878889909192939495969726 unmodified lines12412512612712812913013113213313413513631 unmodified lines16816917017117217317424 unmodified lines1992002012022032042052062072082092107 unmodified lines21821922022122222322421 unmodified lines24624724824925025125221 unmodified lines2742752762772782792802812822832842852862872882892908 unmodified lines29930030130230330430515 unmodified linespolicy.py 多轮客户端:历史窗口、图像编码、请求体action.py 动作格式与反解(200 ms chunk -> 6 x 33 ms 键鼠)keymaps.py 训练词表 <-> 浏览器/Playwright 键名prompts/system_prompt_template.txt 标准系统提示词骨架,填三个占位符即可用于任意游戏example_doom_battle1.txt 填好的示例models/ 8 个 Qwen3.5 checkpoint,各自带 chat_template.jinjascripts/serve_vllm.sh 起 OpenAI 兼容服务tests/test_core.py 离线单测(不需要 GPU)28 unmodified lines`chat_template.jinja`(vLLM 默认就会用),**不要**换成原版 Qwen 模板:自带模板会把没有思维链的历史轮渲染成 `<think>\n\n</think>\n\n<|action_start|>...`,与训练样本逐 token 一致。## 2. 系统提示词骨架`prompts/system_prompt_template.txt` 是标准系统提示词,只有三处要按游戏填写,其余部分**原样保留**(checkpoint 依赖 Output Format 那一段的精确文本来决定输出标签):| 占位符 | 填什么 | 示例 ||---|---|---|| `{GAME_NAME}` | 游戏名,出现两次(开场白和键位标题) | `Doom Battle-1` || `{GAME_RULES}` | 游戏是什么、目标、怎么计分,一段英文 | `Kill as many monsters as possible; collect health and ammo.` || `{KEY_BINDINGS}` | 每行一个 `- <键> -> <作用>`,键名必须用训练词表(见 §5) | 见下 |`{KEY_BINDINGS}` 的写法:```text- W -> Move forward- S -> Move backward- A -> Strafe left- D -> Strafe right- LB -> Fire- Mouse X Y -> aim / rotate the camera (X>0 right, Y>0 down)```最后一行只在鼠标控制视角的游戏里加,并且必须原样照抄。键名规则:字母大写(`W`),数字键写`zero`..`nine`,F1-F12 写 `One`..`Twelve`,鼠标键写 `LB` / `RB` / `MB`,方向键写`Up` / `Down` / `Left` / `Right`。填好的完整示例见 `prompts/example_doom_battle1.txt`。直接用文本文件:```pythontpl = open("prompts/system_prompt_template.txt").read().rstrip("\n")system = (tpl.replace("{GAME_NAME}", "Doom Battle-1").replace("{GAME_RULES}", "Kill as many monsters as possible; collect health and ammo.").replace("{KEY_BINDINGS}", "- W -> Move forward\n- LB -> Fire\n""- Mouse X Y -> aim / rotate the camera (X>0 right, Y>0 down)"))```和下面 `build_system_prompt(...)` 生成的结果逐字节相同(`tests/test_core.py` 会检查)。## 3. 最小用法```pythonfrom PIL import Image26 unmodified lines`PolicyConfig.preset("omnigamearena" | "vizdoom" | "gameworld")`:前两档把画面缩到 854×480;`gameworld` 不预填 `<think>`,提示词要用 `build_gameworld_system_prompt(..., reasoning=False)`。## 4. 系统提示词规范所有 benchmark 用同一骨架,顺序固定(`gamescaling/prompt.py`):1. **开场白**:游戏专家 + 游戏名 + "规划接下来 200ms、6 步、每步 33ms" 的契约;2. `**Game Rules**`:游戏是什么、怎么计分;3. **操作说明**:本游戏用到的键,**必须写成训练词表**(见 §5);4. `**Task Instruction**`:仅 GameWorld(一个游戏有多个任务);5. `**Output Format**`:模型据此决定输出格式;6. `**Explanation**` + `**Key Naming Rules**`。31 unmodified lines历史轮只放动作(`history_think=0`,论文口径)。解析失败的轮在历史里存成显式 no-op`<|action_start|>0 0 0 ; ; ; ; ; ; <|action_end|>`,而不是模型的原始坏输出。## 5. 动作格式与反解```<|action_start|>X Y Z ; g1 ; g2 ; g3 ; g4 ; g5 ; g6<|action_end|>24 unmodified lines不在词表里的 token 被丢弃(记在 `Action.dropped`)。`keymaps.TO_PLAYWRIGHT` 给出到浏览器键名的映射。## 6. 三个 benchmark三者都是**暂停时钟(pdq)**:模型思考时游戏冻结,只在执行 chunk 时前进。论文所有主表都是这个口径;不同时钟之间的分数不可比。### 6.1 ViZDoom(自包含)```bashpip install -r requirements.txt vizdoom==1.2.47 unmodified lines6 个 tic 上均分;HUD 开。计分:battle 图数击杀,defend 图击杀减死亡;`overall` 是四图均值的均值。场景文件来源见 `integrations/vizdoom/scenarios/PROVENANCE.md`。### 6.2 OmniGameArena在 [OmniGameArena](https://github.com/mxlin043/OmniGameArena)(测于 `f3a4057`)里注册agent kind `gamescaling`:21 unmodified lines- `solo_craft` 的后续 episode 请换一个新的 UE5 进程;复用实例时第 2、3 局会立即结束并复报第 1 局分数。### 6.3 GameWorld在 [GameWorld](https://github.com/gameworld-project/gameworld)(测于 `e236a39`)里注册模型id `gamescaling`:21 unmodified lines的 WASD 映射成方向键(模型主要在 PC 游戏上训练,习惯用 WASD 移动)。环境变量`GAMESCALING_ENDPOINT` 可覆盖服务地址,`GAMESCALING_THINK=1` 可打开 think prefill(非论文口径)。## 7. 接入新游戏1. 填 `prompts/system_prompt_template.txt`(§2),或用 `build_system_prompt` 写提示词:游戏名、规则、`key_bindings` 用训练词表;鼠标控视角时加 `mouse_aim=True`;`reasoning` 与 `think_prefill` 一致。2. 每 200 ms(或暂停时钟下每次决策)截一帧,调用 `policy.act(frame)`。3. 按 §5 执行 `Action`:6 个 33 ms 子步的按住键 + 鼠标位移 + 滚轮。4. 新游戏沿用默认客户端(原尺寸画面、预填 `<think>`、`build_system_prompt` 标准格式)。要对齐论文某一张表时,再改用`PolicyConfig.preset("omnigamearena" | "vizdoom" | "gameworld")`。## 8. 与论文评测代码的差异发布代码与论文内部评测代码逐项对拍过:三个 benchmark 的全部系统提示词逐字节相同(ViZDoom 4 图、OmniGameArena 12 游戏 44 个 prompt、GameWorld 170 个任务),历史 trace8 unmodified lines- OmniGameArena 的 `map_wait` 用上游默认 3 s。内部评测等 60 s,但前 3 s 之后世界是冻结的,所以两者进入第一步时的游戏时间一致。## 9. 测试```bashpython tests/test_core.py # 或 python -m pytest tests/;离线:提示词、请求体、动作反解,不需要 GPU / 服务
123version https://git-lfs.github.com/spec/v1oid sha256:b2986b2a0deec5dd76c8c72946e7f65daf4b695c76c9b01c4f5fff9433dbeb67size 2214590296123version https://git-lfs.github.com/spec/v1oid sha256:d553c0796833691e32277a937db649eaac39bae9a0028a63c964c12a261c2dfasize 2214590296123version https://git-lfs.github.com/spec/v1oid sha256:320dd2f7e1804faceae76fbfd6bfb83f17c9294a369bebf07cf1f3278dec3351size 5443677680123version https://git-lfs.github.com/spec/v1oid sha256:97018239265aed03c16afa0f2acb035a428a3e66195a20518cf3c14dcfe289e8size 544367768012345678910111213141516171819202122232425262728You are a gaming expert, and you are currently playing Doom Battle-1. You are proficient in keyboard and mouse operations. You understand game mechanics and combat pacing, can quickly extract key information from the current screen, and can think and make precise decisions at critical moments. Based on the current screen, plan the next 200ms of actions, consisting of 6 steps spaced 33ms apart. Each step lasts 33ms, until the next step begins. If the current situation continues the previous strategy, output the action directly. Think only when the situation changes significantly, the previous analysis is no longer valid, or a new objective appears.**Game Rules**Kill as many monsters as possible; collect health and ammo.**Common Keys in Doom Battle-1**- W -> Move forward- S -> Move backward- A -> Strafe left- D -> Strafe right- LB -> Fire- Mouse X Y -> aim / rotate the camera (X>0 right, Y>0 down)**Output Format****Action only (usual)**<think></think><|action_start|>X Y Z ; k1 k2 k3 ; k4 k5 ; k6 ; k7 ; k8 ; k9 k10<|action_end|>**Thinking + action (when necessary)**<think>reasoning</think><|action_start|>X Y Z ; k1 k2 k3 ; k4 k5 ; k6 ; k7 ; k8 ; k9 k10<|action_end|>**Explanation**1. **Mouse Movement**: First, specify the relative displacement X, Y (X>0 means move right, Y>0 means move down) and scroll amount Z (Z>0 means scroll up).2. **Key Sequence**: Then list 6 groups of keys; within each group, keys are separated by spaces, and groups are separated by semicolons.- Each group can contain up to 4 keys.- If a group has no keys, leave it empty but keep the `;`.3. Only output a plain string that conforms to the above format — no line breaks and no quotation marks.**Key Naming Rules**- Number keys `0-9`: use lowercase English words, e.g., `zero` for `0`, `one` for `1`, ... `nine` for `9`.- Function keys `F1-F12`: use capitalized English words, e.g., `One` represents `F1`, `Two` represents `F2`, and so on.- Mouse buttons: use `LB`, `RB`, `MB` for the left, right, and middle mouse button.- Letters: use the uppercase letter, e.g., `A`, `D`, `W`, `S`.- Arrow keys: use `Up`, `Down`, `Left`, `Right`.- Modifier/special keys: `Shift`, `Ctrl`, `Alt`, `Tab`, `Caps`, `Esc`, `Space`, `Enter`, `Back` (backspace), `Delete`, `Insert`, `Home`, `End`, `Pause`.1234567891011121314151617181920212223You are a gaming expert, and you are currently playing {GAME_NAME}. You are proficient in keyboard and mouse operations. You understand game mechanics and combat pacing, can quickly extract key information from the current screen, and can think and make precise decisions at critical moments. Based on the current screen, plan the next 200ms of actions, consisting of 6 steps spaced 33ms apart. Each step lasts 33ms, until the next step begins. If the current situation continues the previous strategy, output the action directly. Think only when the situation changes significantly, the previous analysis is no longer valid, or a new objective appears.**Game Rules**{GAME_RULES}**Common Keys in {GAME_NAME}**{KEY_BINDINGS}**Output Format****Action only (usual)**<think></think><|action_start|>X Y Z ; k1 k2 k3 ; k4 k5 ; k6 ; k7 ; k8 ; k9 k10<|action_end|>**Thinking + action (when necessary)**<think>reasoning</think><|action_start|>X Y Z ; k1 k2 k3 ; k4 k5 ; k6 ; k7 ; k8 ; k9 k10<|action_end|>**Explanation**1. **Mouse Movement**: First, specify the relative displacement X, Y (X>0 means move right, Y>0 means move down) and scroll amount Z (Z>0 means scroll up).2. **Key Sequence**: Then list 6 groups of keys; within each group, keys are separated by spaces, and groups are separated by semicolons.- Each group can contain up to 4 keys.- If a group has no keys, leave it empty but keep the `;`.3. Only output a plain string that conforms to the above format — no line breaks and no quotation marks.**Key Naming Rules**- Number keys `0-9`: use lowercase English words, e.g., `zero` for `0`, `one` for `1`, ... `nine` for `9`.- Function keys `F1-F12`: use capitalized English words, e.g., `One` represents `F1`, `Two` represents `F2`, and so on.- Mouse buttons: use `LB`, `RB`, `MB` for the left, right, and middle mouse button.- Letters: use the uppercase letter, e.g., `A`, `D`, `W`, `S`.- Arrow keys: use `Up`, `Down`, `Left`, `Right`.- Modifier/special keys: `Shift`, `Ctrl`, `Alt`, `Tab`, `Caps`, `Esc`, `Space`, `Enter`, `Back` (backspace), `Delete`, `Insert`, `Home`, `End`, `Pause`.97 unmodified lines989910010110210397 unmodified linesassert "**Action only" not in gwdef test_translate_controls():text = "- ArrowLeft: move left\n- a/d: strafe\n- 1-9: pick item\nPress Escape to pause."out = translate_controls(text)97 unmodified lines989910010110210310410510610710810911011111211311497 unmodified linesassert "**Action only" not in gwdef test_prompt_template_file_matches_builder():root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))with open(os.path.join(root, "prompts", "system_prompt_template.txt")) as f:tpl = f.read().rstrip("\n")keys = {"W": "Move forward", "LB": "Fire"}bindings = "- W -> Move forward\n- LB -> Fire\n- Mouse X Y -> aim / rotate the camera (X>0 right, Y>0 down)"filled = (tpl.replace("{GAME_NAME}", "Doom").replace("{GAME_RULES}", "Kill monsters.").replace("{KEY_BINDINGS}", bindings))assert filled == build_system_prompt("Doom", rules="Kill monsters.", key_bindings=keys)def test_translate_controls():text = "- ArrowLeft: move left\n- a/d: strafe\n- 1-9: pick item\nPress Escape to pause."out = translate_controls(text)
README.md+54-13
models/0p8b_s1_1600h_gs6736/model.safetensorsAdded+3
models/0p8b_s3_1600h_gs6760/model.safetensorsAdded+3
models/2b_s1_1600h_gs6736/model.safetensorsAdded+3
models/2b_s3_1600h_gs6760/model.safetensorsAdded+3
prompts/example_doom_battle1.txtAdded+28
prompts/system_prompt_template.txtAdded+23
tests/test_core.py+11