Instructions to use tiiuae/falcon-40b-instruct with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use tiiuae/falcon-40b-instruct with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="tiiuae/falcon-40b-instruct", trust_remote_code=True)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("tiiuae/falcon-40b-instruct", trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained("tiiuae/falcon-40b-instruct", trust_remote_code=True) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use tiiuae/falcon-40b-instruct with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "tiiuae/falcon-40b-instruct" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "tiiuae/falcon-40b-instruct", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/tiiuae/falcon-40b-instruct
- SGLang
How to use tiiuae/falcon-40b-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/falcon-40b-instruct" \ --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": "tiiuae/falcon-40b-instruct", "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 "tiiuae/falcon-40b-instruct" \ --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": "tiiuae/falcon-40b-instruct", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use tiiuae/falcon-40b-instruct with Docker Model Runner:
docker model run hf.co/tiiuae/falcon-40b-instruct
Matt commited on
Commit ·
bb9e6c5
1
Parent(s): 1e7fdcc
Move to in-library checkpoint
Browse files- config.json +7 -10
- generation_config.json +4 -4
- tokenizer_config.json +5 -1
config.json
CHANGED
|
@@ -2,13 +2,9 @@
|
|
| 2 |
"alibi": false,
|
| 3 |
"apply_residual_connection_post_layernorm": false,
|
| 4 |
"architectures": [
|
| 5 |
-
"
|
| 6 |
],
|
| 7 |
"attention_dropout": 0.0,
|
| 8 |
-
"auto_map": {
|
| 9 |
-
"AutoConfig": "configuration_RW.RWConfig",
|
| 10 |
-
"AutoModelForCausalLM": "modelling_RW.RWForCausalLM"
|
| 11 |
-
},
|
| 12 |
"bias": false,
|
| 13 |
"bos_token_id": 11,
|
| 14 |
"eos_token_id": 11,
|
|
@@ -16,13 +12,14 @@
|
|
| 16 |
"hidden_size": 8192,
|
| 17 |
"initializer_range": 0.02,
|
| 18 |
"layer_norm_epsilon": 1e-05,
|
| 19 |
-
"model_type": "
|
| 20 |
-
"
|
| 21 |
-
"
|
| 22 |
-
"
|
|
|
|
| 23 |
"parallel_attn": true,
|
| 24 |
"torch_dtype": "bfloat16",
|
| 25 |
"transformers_version": "4.26.0",
|
| 26 |
"use_cache": true,
|
| 27 |
"vocab_size": 65024
|
| 28 |
-
}
|
|
|
|
| 2 |
"alibi": false,
|
| 3 |
"apply_residual_connection_post_layernorm": false,
|
| 4 |
"architectures": [
|
| 5 |
+
"FalconForCausalLM"
|
| 6 |
],
|
| 7 |
"attention_dropout": 0.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
"bias": false,
|
| 9 |
"bos_token_id": 11,
|
| 10 |
"eos_token_id": 11,
|
|
|
|
| 12 |
"hidden_size": 8192,
|
| 13 |
"initializer_range": 0.02,
|
| 14 |
"layer_norm_epsilon": 1e-05,
|
| 15 |
+
"model_type": "falcon",
|
| 16 |
+
"new_decoder_architecture": true,
|
| 17 |
+
"num_attention_heads": 128,
|
| 18 |
+
"num_hidden_layers": 60,
|
| 19 |
+
"num_kv_heads": 8,
|
| 20 |
"parallel_attn": true,
|
| 21 |
"torch_dtype": "bfloat16",
|
| 22 |
"transformers_version": "4.26.0",
|
| 23 |
"use_cache": true,
|
| 24 |
"vocab_size": 65024
|
| 25 |
+
}
|
generation_config.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
{
|
| 2 |
"_from_model_config": true,
|
| 3 |
-
"bos_token_id":
|
| 4 |
-
"eos_token_id":
|
| 5 |
-
"transformers_version": "4.
|
| 6 |
-
}
|
|
|
|
| 1 |
{
|
| 2 |
"_from_model_config": true,
|
| 3 |
+
"bos_token_id": 11,
|
| 4 |
+
"eos_token_id": 11,
|
| 5 |
+
"transformers_version": "4.31.0.dev0"
|
| 6 |
+
}
|
tokenizer_config.json
CHANGED
|
@@ -1,8 +1,12 @@
|
|
| 1 |
{
|
| 2 |
"add_prefix_space": false,
|
| 3 |
"eos_token": "<|endoftext|>",
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
"model_max_length": 2048,
|
| 5 |
"name_or_path": "tiiuae/falcon_tokenizer",
|
| 6 |
"special_tokens_map_file": null,
|
| 7 |
"tokenizer_class": "PreTrainedTokenizerFast"
|
| 8 |
-
}
|
|
|
|
| 1 |
{
|
| 2 |
"add_prefix_space": false,
|
| 3 |
"eos_token": "<|endoftext|>",
|
| 4 |
+
"model_input_names": [
|
| 5 |
+
"input_ids",
|
| 6 |
+
"attention_mask"
|
| 7 |
+
],
|
| 8 |
"model_max_length": 2048,
|
| 9 |
"name_or_path": "tiiuae/falcon_tokenizer",
|
| 10 |
"special_tokens_map_file": null,
|
| 11 |
"tokenizer_class": "PreTrainedTokenizerFast"
|
| 12 |
+
}
|