Instructions to use tiiuae/Falcon3-7B-Instruct with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use tiiuae/Falcon3-7B-Instruct with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="tiiuae/Falcon3-7B-Instruct") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("tiiuae/Falcon3-7B-Instruct") model = AutoModelForCausalLM.from_pretrained("tiiuae/Falcon3-7B-Instruct") 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
- vLLM
How to use tiiuae/Falcon3-7B-Instruct with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "tiiuae/Falcon3-7B-Instruct" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "tiiuae/Falcon3-7B-Instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/tiiuae/Falcon3-7B-Instruct
- SGLang
How to use tiiuae/Falcon3-7B-Instruct 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 "tiiuae/Falcon3-7B-Instruct" \ --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": "tiiuae/Falcon3-7B-Instruct", "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 "tiiuae/Falcon3-7B-Instruct" \ --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": "tiiuae/Falcon3-7B-Instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use tiiuae/Falcon3-7B-Instruct with Docker Model Runner:
docker model run hf.co/tiiuae/Falcon3-7B-Instruct
Upload tokenizer
Browse files- special_tokens_map.json +1 -1
- tokenizer.json +0 -9
- tokenizer_config.json +2 -11
special_tokens_map.json
CHANGED
|
@@ -32,7 +32,7 @@
|
|
| 32 |
"single_word": false
|
| 33 |
},
|
| 34 |
"pad_token": {
|
| 35 |
-
"content": "<
|
| 36 |
"lstrip": false,
|
| 37 |
"normalized": false,
|
| 38 |
"rstrip": false,
|
|
|
|
| 32 |
"single_word": false
|
| 33 |
},
|
| 34 |
"pad_token": {
|
| 35 |
+
"content": "<|endoftext|>",
|
| 36 |
"lstrip": false,
|
| 37 |
"normalized": false,
|
| 38 |
"rstrip": false,
|
tokenizer.json
CHANGED
|
@@ -18218,15 +18218,6 @@
|
|
| 18218 |
"rstrip": false,
|
| 18219 |
"normalized": false,
|
| 18220 |
"special": true
|
| 18221 |
-
},
|
| 18222 |
-
{
|
| 18223 |
-
"id": 131072,
|
| 18224 |
-
"content": "<pad>",
|
| 18225 |
-
"single_word": false,
|
| 18226 |
-
"lstrip": false,
|
| 18227 |
-
"rstrip": false,
|
| 18228 |
-
"normalized": false,
|
| 18229 |
-
"special": true
|
| 18230 |
}
|
| 18231 |
],
|
| 18232 |
"normalizer": null,
|
|
|
|
| 18218 |
"rstrip": false,
|
| 18219 |
"normalized": false,
|
| 18220 |
"special": true
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18221 |
}
|
| 18222 |
],
|
| 18223 |
"normalizer": null,
|
tokenizer_config.json
CHANGED
|
@@ -16192,14 +16192,6 @@
|
|
| 16192 |
"rstrip": false,
|
| 16193 |
"single_word": false,
|
| 16194 |
"special": true
|
| 16195 |
-
},
|
| 16196 |
-
"131072": {
|
| 16197 |
-
"content": "<pad>",
|
| 16198 |
-
"lstrip": false,
|
| 16199 |
-
"normalized": false,
|
| 16200 |
-
"rstrip": false,
|
| 16201 |
-
"single_word": false,
|
| 16202 |
-
"special": true
|
| 16203 |
}
|
| 16204 |
},
|
| 16205 |
"additional_special_tokens": [
|
|
@@ -16230,8 +16222,7 @@
|
|
| 16230 |
"chat_template": "{% for message in messages %}{% if message['role'] == 'system' %}{{ '<|system|>\n' + message['content'] + '\n' }}{% elif message['role'] == 'user' %}{{ '<|user|>\n' + message['content'] + '\n' }}{% elif message['role'] == 'assistant' %}{% if not loop.last %}{{ '<|assistant|>\n' + message['content'] + eos_token + '\n' }}{% else %}{{ '<|assistant|>\n' + message['content'] + eos_token }}{% endif %}{% endif %}{% if loop.last and add_generation_prompt %}{{ '<|assistant|>\n' }}{% endif %}{% endfor %}",
|
| 16231 |
"clean_up_tokenization_spaces": true,
|
| 16232 |
"eos_token": "<|endoftext|>",
|
| 16233 |
-
"model_max_length":
|
| 16234 |
-
"pad_token": "<
|
| 16235 |
"tokenizer_class": "PreTrainedTokenizerFast"
|
| 16236 |
}
|
| 16237 |
-
|
|
|
|
| 16192 |
"rstrip": false,
|
| 16193 |
"single_word": false,
|
| 16194 |
"special": true
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16195 |
}
|
| 16196 |
},
|
| 16197 |
"additional_special_tokens": [
|
|
|
|
| 16222 |
"chat_template": "{% for message in messages %}{% if message['role'] == 'system' %}{{ '<|system|>\n' + message['content'] + '\n' }}{% elif message['role'] == 'user' %}{{ '<|user|>\n' + message['content'] + '\n' }}{% elif message['role'] == 'assistant' %}{% if not loop.last %}{{ '<|assistant|>\n' + message['content'] + eos_token + '\n' }}{% else %}{{ '<|assistant|>\n' + message['content'] + eos_token }}{% endif %}{% endif %}{% if loop.last and add_generation_prompt %}{{ '<|assistant|>\n' }}{% endif %}{% endfor %}",
|
| 16223 |
"clean_up_tokenization_spaces": true,
|
| 16224 |
"eos_token": "<|endoftext|>",
|
| 16225 |
+
"model_max_length": 8192,
|
| 16226 |
+
"pad_token": "<|endoftext|>",
|
| 16227 |
"tokenizer_class": "PreTrainedTokenizerFast"
|
| 16228 |
}
|
|
|