Text Generation
Transformers
Safetensors
qwen2
code
software-engineering
agent
conversational
text-generation-inference
Instructions to use TIGER-Lab/FIM-7B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use TIGER-Lab/FIM-7B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="TIGER-Lab/FIM-7B") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("TIGER-Lab/FIM-7B") model = AutoModelForCausalLM.from_pretrained("TIGER-Lab/FIM-7B", 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-7B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "TIGER-Lab/FIM-7B" # 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-7B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/TIGER-Lab/FIM-7B
- SGLang
How to use TIGER-Lab/FIM-7B 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-7B" \ --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-7B", "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-7B" \ --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-7B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use TIGER-Lab/FIM-7B with Docker Model Runner:
docker model run hf.co/TIGER-Lab/FIM-7B
Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# FIM-7B Inference on SWE-Bench Verified
|
| 2 |
+
|
| 3 |
+
This guide describes how to run the **FIM-7B** checkpoint on SWE-Bench Verified (and Lite) with the R2E-Gym agent scaffold in this repository.
|
| 4 |
+
|
| 5 |
+
## Model
|
| 6 |
+
|
| 7 |
+
Local path: `models/FIM-7B/` (checkpoints are gitignored; do not commit them).
|
| 8 |
+
|
| 9 |
+
- Base model: `Qwen/Qwen2.5-Coder-7B-Instruct`
|
| 10 |
+
- FIM mid-training: `train/FIM_Midtrain_7B.yaml`
|
| 11 |
+
- Post-training: SFT on R2E-Gym agent trajectories
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
## 1. Serve the model with vLLM
|
| 15 |
+
|
| 16 |
+
```bash
|
| 17 |
+
CUDA_VISIBLE_DEVICES=0 \
|
| 18 |
+
VLLM_ALLOW_LONG_MAX_MODEL_LEN=1 \
|
| 19 |
+
.venv-vllm/bin/python -m vllm.entrypoints.openai.api_server \
|
| 20 |
+
--model models/FIM-7B \
|
| 21 |
+
--served-model-name FIM-7B \
|
| 22 |
+
--host 127.0.0.1 \
|
| 23 |
+
--port 8400 \
|
| 24 |
+
--tensor-parallel-size 1 \
|
| 25 |
+
--max-model-len 65536 \
|
| 26 |
+
--hf-overrides '{"max_position_embeddings": 65536}' \
|
| 27 |
+
--enable-prefix-caching \
|
| 28 |
+
--gpu-memory-utilization 0.9 \
|
| 29 |
+
> vllm_fim7b.log 2>&1 &
|
| 30 |
+
```
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
Wait until the server is up (model load takes ~1 minute):
|
| 34 |
+
|
| 35 |
+
```bash
|
| 36 |
+
curl -s http://127.0.0.1:8400/v1/models
|
| 37 |
+
```
|
| 38 |
+
|
| 39 |
+
## 2. Run the agent on SWE-Bench Verified
|
| 40 |
+
|
| 41 |
+
```bash
|
| 42 |
+
export OPENAI_API_KEY=EMPTY
|
| 43 |
+
export LLM_BASE_URL="http://127.0.0.1:8400/v1"
|
| 44 |
+
|
| 45 |
+
uv run python src/r2egym/agenthub/run/edit.py runagent_multiple \
|
| 46 |
+
--dataset "R2E-Gym/SWE-Bench-Verified" \
|
| 47 |
+
--split "test" \
|
| 48 |
+
--start_idx 0 \
|
| 49 |
+
--k 500 \
|
| 50 |
+
--traj_dir "./traj" \
|
| 51 |
+
--exp_name "FIM-7B_swebench_verified_r1" \
|
| 52 |
+
--llm_name "openai/FIM-7B" \
|
| 53 |
+
--scaffold "r2egym" \
|
| 54 |
+
--backend "docker" \
|
| 55 |
+
--use_fn_calling False \
|
| 56 |
+
--temperature 0 \
|
| 57 |
+
--max_steps 40 \
|
| 58 |
+
--max_steps_absolute 100 \
|
| 59 |
+
--max_workers 6 \
|
| 60 |
+
--max_reward_calc_time 1200 \
|
| 61 |
+
--max_tokens 65536 \
|
| 62 |
+
--use_existing True
|
| 63 |
+
```
|