Instructions to use tiiuae/falcon-7b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use tiiuae/falcon-7b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="tiiuae/falcon-7b", trust_remote_code=True)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("tiiuae/falcon-7b", trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained("tiiuae/falcon-7b", trust_remote_code=True) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use tiiuae/falcon-7b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "tiiuae/falcon-7b" # 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-7b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/tiiuae/falcon-7b
- SGLang
How to use tiiuae/falcon-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 "tiiuae/falcon-7b" \ --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-7b", "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-7b" \ --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-7b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use tiiuae/falcon-7b with Docker Model Runner:
docker model run hf.co/tiiuae/falcon-7b
Is it possible to add TF Weights
Hello everyone,
Thanks again for your amazing work and making it available for everyone.
I would like to download the tii-uae/falcon model on my computer, however due to security reasons in my organization I cannot download the .bin files .
I was able to download and use models when they do have TensorFlow weights such as this one : https://huggingface.co/facebook/dino-vitb16/tree/main
Thank you again,
Best regards,
Hi @mb-data96 , unfortunately none of us in the Falcon team are very familiar with TensorFlow. We will leave this issue open should someone from the community want to contribute the TF weights.
Hi @FalconLLM , thank you for answer.
I finally bypass the .bin restriction in my organization via the following steps (if they might help someone in a similar case) :
- Download on my personnal laptop.
- Compress it into a .7z file (.zip didn't seem to work fine on my computer).
- Upload it in my private HuggingFace Model Hub.
- Download it as a .7z file in my organization and uncompress it. (Existing .bin files are not restricted in my organization, only incoming/downloaded ones are restricted)
Regards,
Hi @FalconLLM ,
I am tryin to convert it but it will so easy from your side
I think it is just 2 lines https://huggingface.co/transformers/v3.3.1/model_sharing.html#make-your-model-work-on-all-frameworks
I need TensorFlow to contribute by adding it in KerasNLP check here:
https://github.com/keras-team/keras-nlp/issues/1072