FIM-SE
Collection
Empowering Character-level Text Infilling by Eliminating Sub-Tokens β’ 5 items β’ Updated
How to use SenseLLM/FIM-SE-CL-13B with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="SenseLLM/FIM-SE-CL-13B") # Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("SenseLLM/FIM-SE-CL-13B")
model = AutoModelForCausalLM.from_pretrained("SenseLLM/FIM-SE-CL-13B")How to use SenseLLM/FIM-SE-CL-13B with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "SenseLLM/FIM-SE-CL-13B"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "SenseLLM/FIM-SE-CL-13B",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'docker model run hf.co/SenseLLM/FIM-SE-CL-13B
How to use SenseLLM/FIM-SE-CL-13B with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "SenseLLM/FIM-SE-CL-13B" \
--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": "SenseLLM/FIM-SE-CL-13B",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'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 "SenseLLM/FIM-SE-CL-13B" \
--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": "SenseLLM/FIM-SE-CL-13B",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'How to use SenseLLM/FIM-SE-CL-13B with Docker Model Runner:
docker model run hf.co/SenseLLM/FIM-SE-CL-13B
π Paper β’ π Repo β’ π€ Models
FIM-SE stands for Fill-In-the-Middle with both Starting and Ending character constraints. The proposed method addresses character-level infilling tasks by utilizing a line-level format to avoid predicting any sub-token in inference.
| Model | Checkpoint | Size | License |
|---|---|---|---|
| FIM-SE-CL-7B | π€ HF Link | 7B | Llama2 |
| FIM-SE-CL-34B | π€ HF Link | 13B | Llama2 |
| FIM-SE-SC-1B | π€ HF Link | 1B | StarCoder |
| FIM-SE-SC-15B | π€ HF Link | 15B | StarCoder |
As shown in the figure, the prompt is organized as
<PRE>R-Prefix<SUF>R-Suffix<START>L-Prefix<END>F-Suffix<MID>
Please refer to our GitHub Repo for more technical details.
If you find this repo useful for your research, please kindly cite our paper:
@misc{ren2024empowering,
title={Empowering Character-level Text Infilling by Eliminating Sub-Tokens},
author={Houxing Ren and Mingjie Zhan and Zhongyuan Wu and Hongsheng Li},
year={2024},
eprint={2405.17103},
archivePrefix={arXiv},
primaryClass={cs.CL}
}
We thank the following amazing projects that truly inspired us: