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 Settings
- 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
Unsupervised learning with unlabled data
I'm very much still learning my way around LLMs, but I see where some LLMs (e.g. CustomGPT, IngestAI) allow you to fine tune simply by providing raw, unlabeled text. For example, providing training manuals for operating some complex system, supposedly can be used to fine tune an LLM around giving advice related to operating that system. Maybe I have the training manuals for flying a small airplane... :-)
Question: Can falcon-7b and/or 40b be fine tuned using this kind of raw, unlabeled data? If so, where can I find instructions or an example of doing so?
I apologize for the rudimentary question.
Thanks in advance for any suggestions that anyone may have.
I think we can fine-tune the model using masked/causal language modelling techniques given unlabelled text. Here the labels would be the next word token or masked tokens. I am trying to do the same for one of the pretrained models but haven't gotten sufficient enough memorisation of training data. So not sure how well it works.
Any solution?
Any solution?
Not by me. I wonder if I've got a square peg/round hole problem here. Everywhere I look, fine tuning on these LLMs is done with labeled data. I'm very new to all this, so I'm not sure if I'm even asking good questions. I've got another potential application for falcon that I'm banging my head on, too. This stuff is incredible, but not for the faint at heart.
So far, the only solution I have found is for older models like mT5 and BERT. You can find more information and examples in the following link:
GitHub - Hugging Face Transformers Examples
If anyone has a link for unsupervised training specifically for Falcon, please let us know. I would greatly appreciate it!