Instructions to use mlx-community/Llama-2-7b-chat-mlx with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use mlx-community/Llama-2-7b-chat-mlx with MLX:
# Make sure mlx-lm is installed # pip install --upgrade mlx-lm # if on a CUDA device, also pip install mlx[cuda] # Generate text with mlx-lm from mlx_lm import load, generate model, tokenizer = load("mlx-community/Llama-2-7b-chat-mlx") prompt = "Once upon a time in" text = generate(model, tokenizer, prompt=prompt, verbose=True) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- MLX LM
How to use mlx-community/Llama-2-7b-chat-mlx with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Generate some text mlx_lm.generate --model "mlx-community/Llama-2-7b-chat-mlx" --prompt "Once upon a time"
- Atomic Chat
|
Download README.md from mlx-community/Llama-2-7b-chat-mlx: direct link, hf CLI and curl.
- Browser
- Download file 1.16 kB
-
https://huggingface.co/mlx-community/Llama-2-7b-chat-mlx/resolve/main/README.md
- Command line
-
hf download hf://mlx-community/Llama-2-7b-chat-mlx/README.md
-
curl -L -o README.md https://huggingface.co/mlx-community/Llama-2-7b-chat-mlx/resolve/main/README.md
1.16 kB
| pipeline_tag: text-generation | |
| library_name: mlx | |
| inference: false | |
| tags: | |
| - meta | |
| - llama | |
| - llama-2 | |
| - mlx | |
| license: llama2 | |
| # **Llama 2** | |
| Llama 2 is a collection of pretrained and fine-tuned generative text models ranging in scale from 7 billion to 70 billion parameters. This is the repository for the 7B fine-tuned model, in `npz` format suitable for use in Apple's MLX framework. | |
| Weights have been converted to `float16` from the original `bfloat16` type, because `numpy` is not compatible with `bfloat16` out of the box. | |
| How to use with [MLX](https://github.com/ml-explore/mlx). | |
| ```bash | |
| # Install mlx, mlx-examples, huggingface-cli | |
| pip install mlx | |
| pip install huggingface_hub hf_transfer | |
| git clone https://github.com/ml-explore/mlx-examples.git | |
| # Download model | |
| export HF_HUB_ENABLE_HF_TRANSFER=1 | |
| huggingface-cli download --local-dir Llama-2-7b-chat-mlx mlx-llama/Llama-2-7b-chat-mlx | |
| # Run example | |
| python mlx-examples/llama/llama.py --prompt "My name is " Llama-2-7b-chat-mlx/ Llama-2-7b-chat-mlx/tokenizer.model | |
| ``` | |
| Please, refer to the [original model card](https://huggingface.co/meta-llama/Llama-2-7b-chat) for details on Llama 2. | |