Text Generation
Transformers
Safetensors
qwen3
code
software-engineering
agent
conversational
text-generation-inference
Instructions to use TIGER-Lab/FIM-8B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use TIGER-Lab/FIM-8B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="TIGER-Lab/FIM-8B") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("TIGER-Lab/FIM-8B") model = AutoModelForCausalLM.from_pretrained("TIGER-Lab/FIM-8B", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use TIGER-Lab/FIM-8B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "TIGER-Lab/FIM-8B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "TIGER-Lab/FIM-8B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/TIGER-Lab/FIM-8B
- SGLang
How to use TIGER-Lab/FIM-8B 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 "TIGER-Lab/FIM-8B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "TIGER-Lab/FIM-8B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "TIGER-Lab/FIM-8B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "TIGER-Lab/FIM-8B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use TIGER-Lab/FIM-8B with Docker Model Runner:
docker model run hf.co/TIGER-Lab/FIM-8B
Add files using upload-large-folder tool
Browse files- .gitattributes +1 -0
- README.md +88 -0
- chat_template.jinja +7 -0
- config.json +73 -0
- generation_config.json +12 -0
- model.safetensors +3 -0
- tokenizer.json +3 -0
- tokenizer_config.json +31 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
library_name: transformers
|
| 4 |
+
pipeline_tag: text-generation
|
| 5 |
+
base_model:
|
| 6 |
+
- Qwen/Qwen3-8B
|
| 7 |
+
tags:
|
| 8 |
+
- code
|
| 9 |
+
- software-engineering
|
| 10 |
+
- agent
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
# FIM-8B Inference on SWE-Bench Verified
|
| 14 |
+
|
| 15 |
+
This guide describes how to run the **FIM-8B** checkpoint on SWE-Bench Verified (and Lite). Unlike FIM-7B and FIM-14B (R2E-Gym scaffold), this model is post-trained on SWE-Lego trajectories and is evaluated with the SWE-Lego setup: OpenHands `CodeActAgent` for inference and the official SWE-bench harness for scoring.
|
| 16 |
+
|
| 17 |
+
## Model
|
| 18 |
+
|
| 19 |
+
Local path: `models/FIM-8B/` (checkpoints are gitignored; do not commit them).
|
| 20 |
+
|
| 21 |
+
- Base model: `Qwen/Qwen3-8B`
|
| 22 |
+
- FIM mid-training: FIM v2/v3 data
|
| 23 |
+
- Post-training: SFT on SWE-Lego trajectories
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
## 1. Serve the model with vLLM
|
| 27 |
+
|
| 28 |
+
```bash
|
| 29 |
+
CUDA_VISIBLE_DEVICES=0 \
|
| 30 |
+
python -m vllm.entrypoints.openai.api_server \
|
| 31 |
+
--model models/FIM-8B \
|
| 32 |
+
--served-model-name FIM-8B \
|
| 33 |
+
--host 127.0.0.1 \
|
| 34 |
+
--port 8400 \
|
| 35 |
+
--tensor-parallel-size 1 \
|
| 36 |
+
--max-model-len 163840 \
|
| 37 |
+
--max-num-seqs 16 \
|
| 38 |
+
--gpu-memory-utilization 0.9 \
|
| 39 |
+
> vllm_fim8b.log 2>&1 &
|
| 40 |
+
```
|
| 41 |
+
|
| 42 |
+
The checkpoint ships `max_position_embeddings: 163840` and its own chat template, so no rope or template overrides are needed.
|
| 43 |
+
|
| 44 |
+
Wait until the server is up (model load takes ~1 minute):
|
| 45 |
+
|
| 46 |
+
```bash
|
| 47 |
+
curl -s http://127.0.0.1:8400/v1/models
|
| 48 |
+
```
|
| 49 |
+
|
| 50 |
+
## 2. Run the agent on SWE-Bench Verified
|
| 51 |
+
|
| 52 |
+
Inference uses OpenHands 0.53.0. Define the LLM in `config.toml`:
|
| 53 |
+
|
| 54 |
+
```toml
|
| 55 |
+
[llm.eval_fim]
|
| 56 |
+
model = "openai/FIM-8B"
|
| 57 |
+
base_url = "http://127.0.0.1:8400/v1"
|
| 58 |
+
api_key = "EMPTY"
|
| 59 |
+
temperature = 0.0
|
| 60 |
+
max_input_tokens = 147456
|
| 61 |
+
max_output_tokens = 16384
|
| 62 |
+
native_tool_calling = false
|
| 63 |
+
```
|
| 64 |
+
|
| 65 |
+
From the OpenHands checkout:
|
| 66 |
+
|
| 67 |
+
```bash
|
| 68 |
+
env USE_HINT_TEXT=false \
|
| 69 |
+
INSTRUCTION_TEMPLATE_NAME=swe_default.j2 \
|
| 70 |
+
ENABLE_PLAN_MODE=false \
|
| 71 |
+
ADD_IN_CONTEXT_LEARNING_EXAMPLE=false \
|
| 72 |
+
poetry run python evaluation/benchmarks/swe_bench/run_infer.py \
|
| 73 |
+
--config-file config.toml \
|
| 74 |
+
--agent-cls CodeActAgent \
|
| 75 |
+
--llm-config llm.eval_fim \
|
| 76 |
+
--max-iterations 100 \
|
| 77 |
+
--eval-num-workers 1 \
|
| 78 |
+
--eval-output-dir ./eval_out \
|
| 79 |
+
--dataset princeton-nlp/SWE-bench_Verified \
|
| 80 |
+
--split test \
|
| 81 |
+
--mode swe
|
| 82 |
+
```
|
| 83 |
+
|
| 84 |
+
For SWE-Bench Lite, use `--dataset princeton-nlp/SWE-bench_Lite`.
|
| 85 |
+
|
| 86 |
+
## 3. Score with the SWE-bench harness
|
| 87 |
+
|
| 88 |
+
Convert the OpenHands `output.jsonl` to a predictions file with `evaluation/benchmarks/swe_bench/scripts/eval/convert_oh_output_to_swe_json.py`, then evaluate it with the official SWE-bench harness (`python -m swebench.harness.run_evaluation`). The reported score is `resolved_instances / total_instances`.
|
chat_template.jinja
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{% if messages[0]['role'] == 'system' %}{% set loop_messages = messages[1:] %}{% set system_message = messages[0]['content'] %}{% else %}{% set loop_messages = messages %}{% endif %}{% if system_message is defined %}{{ '<|im_start|>system
|
| 2 |
+
' + system_message + '<|im_end|>
|
| 3 |
+
' }}{% endif %}{% for message in loop_messages %}{% set content = message['content'] %}{% if message['role'] == 'user' %}{{ '<|im_start|>user
|
| 4 |
+
' + content + '<|im_end|>
|
| 5 |
+
<|im_start|>assistant
|
| 6 |
+
' }}{% elif message['role'] == 'assistant' %}{{ content + '<|im_end|>
|
| 7 |
+
' }}{% endif %}{% endfor %}
|
config.json
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"Qwen3ForCausalLM"
|
| 4 |
+
],
|
| 5 |
+
"attention_bias": false,
|
| 6 |
+
"attention_dropout": 0.0,
|
| 7 |
+
"bos_token_id": null,
|
| 8 |
+
"dtype": "bfloat16",
|
| 9 |
+
"eos_token_id": 151645,
|
| 10 |
+
"head_dim": 128,
|
| 11 |
+
"hidden_act": "silu",
|
| 12 |
+
"hidden_size": 4096,
|
| 13 |
+
"initializer_range": 0.02,
|
| 14 |
+
"intermediate_size": 12288,
|
| 15 |
+
"layer_types": [
|
| 16 |
+
"full_attention",
|
| 17 |
+
"full_attention",
|
| 18 |
+
"full_attention",
|
| 19 |
+
"full_attention",
|
| 20 |
+
"full_attention",
|
| 21 |
+
"full_attention",
|
| 22 |
+
"full_attention",
|
| 23 |
+
"full_attention",
|
| 24 |
+
"full_attention",
|
| 25 |
+
"full_attention",
|
| 26 |
+
"full_attention",
|
| 27 |
+
"full_attention",
|
| 28 |
+
"full_attention",
|
| 29 |
+
"full_attention",
|
| 30 |
+
"full_attention",
|
| 31 |
+
"full_attention",
|
| 32 |
+
"full_attention",
|
| 33 |
+
"full_attention",
|
| 34 |
+
"full_attention",
|
| 35 |
+
"full_attention",
|
| 36 |
+
"full_attention",
|
| 37 |
+
"full_attention",
|
| 38 |
+
"full_attention",
|
| 39 |
+
"full_attention",
|
| 40 |
+
"full_attention",
|
| 41 |
+
"full_attention",
|
| 42 |
+
"full_attention",
|
| 43 |
+
"full_attention",
|
| 44 |
+
"full_attention",
|
| 45 |
+
"full_attention",
|
| 46 |
+
"full_attention",
|
| 47 |
+
"full_attention",
|
| 48 |
+
"full_attention",
|
| 49 |
+
"full_attention",
|
| 50 |
+
"full_attention",
|
| 51 |
+
"full_attention"
|
| 52 |
+
],
|
| 53 |
+
"max_position_embeddings": 163840.0,
|
| 54 |
+
"max_window_layers": 36,
|
| 55 |
+
"model_type": "qwen3",
|
| 56 |
+
"num_attention_heads": 32,
|
| 57 |
+
"num_hidden_layers": 36,
|
| 58 |
+
"num_key_value_heads": 8,
|
| 59 |
+
"pad_token_id": 151643,
|
| 60 |
+
"rms_norm_eps": 1e-06,
|
| 61 |
+
"rope_parameters": {
|
| 62 |
+
"factor": 4.0,
|
| 63 |
+
"original_max_position_embeddings": 40960,
|
| 64 |
+
"rope_theta": 1000000,
|
| 65 |
+
"rope_type": "yarn"
|
| 66 |
+
},
|
| 67 |
+
"sliding_window": null,
|
| 68 |
+
"tie_word_embeddings": false,
|
| 69 |
+
"transformers_version": "5.0.0",
|
| 70 |
+
"use_cache": false,
|
| 71 |
+
"use_sliding_window": false,
|
| 72 |
+
"vocab_size": 151936
|
| 73 |
+
}
|
generation_config.json
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"do_sample": true,
|
| 3 |
+
"eos_token_id": [
|
| 4 |
+
151645,
|
| 5 |
+
151643
|
| 6 |
+
],
|
| 7 |
+
"pad_token_id": 151643,
|
| 8 |
+
"temperature": 0.6,
|
| 9 |
+
"top_k": 20,
|
| 10 |
+
"top_p": 0.95,
|
| 11 |
+
"transformers_version": "5.0.0"
|
| 12 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:86a69ce2ed5edd997d442770367c0f767924cefcd5797ef32dbc778116a159ee
|
| 3 |
+
size 16381517208
|
tokenizer.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:be75606093db2094d7cd20f3c2f385c212750648bd6ea4fb2bf507a6a4c55506
|
| 3 |
+
size 11422650
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"add_prefix_space": false,
|
| 3 |
+
"backend": "tokenizers",
|
| 4 |
+
"bos_token": null,
|
| 5 |
+
"clean_up_tokenization_spaces": false,
|
| 6 |
+
"eos_token": "<|im_end|>",
|
| 7 |
+
"errors": "replace",
|
| 8 |
+
"extra_special_tokens": [
|
| 9 |
+
"<|im_start|>",
|
| 10 |
+
"<|im_end|>",
|
| 11 |
+
"<|object_ref_start|>",
|
| 12 |
+
"<|object_ref_end|>",
|
| 13 |
+
"<|box_start|>",
|
| 14 |
+
"<|box_end|>",
|
| 15 |
+
"<|quad_start|>",
|
| 16 |
+
"<|quad_end|>",
|
| 17 |
+
"<|vision_start|>",
|
| 18 |
+
"<|vision_end|>",
|
| 19 |
+
"<|vision_pad|>",
|
| 20 |
+
"<|image_pad|>",
|
| 21 |
+
"<|video_pad|>"
|
| 22 |
+
],
|
| 23 |
+
"is_local": true,
|
| 24 |
+
"model_max_length": 131072,
|
| 25 |
+
"model_specific_special_tokens": {},
|
| 26 |
+
"pad_token": "<|endoftext|>",
|
| 27 |
+
"padding_side": "right",
|
| 28 |
+
"split_special_tokens": false,
|
| 29 |
+
"tokenizer_class": "Qwen2Tokenizer",
|
| 30 |
+
"unk_token": null
|
| 31 |
+
}
|