Instructions to use ai21labs/Jamba-v0.1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ai21labs/Jamba-v0.1 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="ai21labs/Jamba-v0.1", trust_remote_code=True)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("ai21labs/Jamba-v0.1", trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained("ai21labs/Jamba-v0.1", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use ai21labs/Jamba-v0.1 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ai21labs/Jamba-v0.1" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ai21labs/Jamba-v0.1", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/ai21labs/Jamba-v0.1
- SGLang
How to use ai21labs/Jamba-v0.1 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 "ai21labs/Jamba-v0.1" \ --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": "ai21labs/Jamba-v0.1", "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 "ai21labs/Jamba-v0.1" \ --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": "ai21labs/Jamba-v0.1", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use ai21labs/Jamba-v0.1 with Docker Model Runner:
docker model run hf.co/ai21labs/Jamba-v0.1
Can you give a short explanation about the benefits and the architecture?
I've read your blogpost, can you elaborate on the advantages of this vs flash attention?
It's true that inherently the attention in transformers is quadratic, but since we have flash attention this issue is solved, while we can still have an arbitrarily large model, right?
Another question that comes in mind, is it fair to assume the hybrid factor is what allowed to push model size and coherency "little bit more" by sort of diluting the mamba elements, but there is still a size limit to the model for various reasons, one of them is coherency?
Also, I failed to find any mentions on what type of data (code? language? which language? how many tokens?) the model was trained?
For the community to make better use of the model we need to know what we are working with :)
+1
The biggest problem is the transformer layer in the architecture!
Even the mamba layer is linear to seqence length, the transformer layer with quadratic attention still requres quadratic memory in both training and inference.
Is mamba only not effective enough to capture long context retrieval?
Hey @SicariusSicariiStuff ,
- We believe that just like flash attention improved performance for attention, same will happen with mamba computations.
- There are more details about the architecture in the paper we released, see if that sheds more light? https://arxiv.org/abs/2403.19887
- We trained on a combination of proprietary and public data, including code. Officially the model supports English, Spanish, Portuguese & French, but we saw it learned pretty well a few other languages as well and can be easily extended to support more languages with little training.