Instructions to use TheBloke/Falcon-7B-Instruct-GPTQ with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use TheBloke/Falcon-7B-Instruct-GPTQ with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="TheBloke/Falcon-7B-Instruct-GPTQ", trust_remote_code=True)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("TheBloke/Falcon-7B-Instruct-GPTQ", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use TheBloke/Falcon-7B-Instruct-GPTQ with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "TheBloke/Falcon-7B-Instruct-GPTQ" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "TheBloke/Falcon-7B-Instruct-GPTQ", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/TheBloke/Falcon-7B-Instruct-GPTQ
- SGLang
How to use TheBloke/Falcon-7B-Instruct-GPTQ 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 "TheBloke/Falcon-7B-Instruct-GPTQ" \ --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": "TheBloke/Falcon-7B-Instruct-GPTQ", "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 "TheBloke/Falcon-7B-Instruct-GPTQ" \ --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": "TheBloke/Falcon-7B-Instruct-GPTQ", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use TheBloke/Falcon-7B-Instruct-GPTQ with Docker Model Runner:
docker model run hf.co/TheBloke/Falcon-7B-Instruct-GPTQ
Thanks for sharing! Just notice that you have uploaded the 64 group size
Would 128 groups size, the suggested one, be better?
There isn't really a 'suggested' groupsize. 128 has tended to be default for Llama models under 30B in size, but I believe that's more from convention than based on any hard testing. It is possible that for Llama models a groupsize of <128 could increase VRAM usage too much for certain GPUs, eg going over an 8GB or 12Gb threshold, but I'm not certain that's the case.
However Falcon 7B is behaving differently. VRAM usage doesn't seem to be an issue as I was able to return 2000 tokens in under 8GB VRAM usage. VRAM usage seems to grow very little as context increases on this model, which is quite different to Llama. I'm not yet sure why that is.
So as group_size = 64 improves inference quality a little, I have gone for that. Maybe I could have done 32 even.
There isn't really a 'suggested' groupsize. 128 has tended to be default for Llama models under 30B in size, but I believe that's more from convention than based on any hard testing. It is possible that for Llama models a groupsize of <128 could increase VRAM usage too much for certain GPUs, eg going over an 8GB or 12Gb threshold, but I'm not certain that's the case.
However Falcon 7B is behaving differently. VRAM usage doesn't seem to be an issue as I was able to return 2000 tokens in under 8GB VRAM usage. VRAM usage seems to grow very little as context increases on this model, which is quite different to Llama. I'm not yet sure why that is.
So as group_size = 64 improves inference quality a little, I have gone for that. Maybe I could have done 32 even.
Thank! Valuable observation there!
Due to multi-query attention the model only needs to save one k,v per position instead of num_heads, for the 7b this corresponds to a factor of 71 :)
Oh thanks @Seledorn that's really interesting !