---
title: Llama-2-7b-mlx
canonical_url: "https://www.modelscope.cn/models/mlx-community/Llama-2-7b-mlx"
md_url: "https://www.modelscope.cn/models/mlx-community/Llama-2-7b-mlx.md"
repository: mlx-community/Llama-2-7b-mlx
last_updated: 2025-02-06
license: llama2
pipeline_tag: text-generation
tasks:
  - text-generation
model_type:
  - llama
library_name:
  - mlx
  - pytorch
frameworks:
  - pytorch
downloads: 995
stars: 0
tags:
  - facebook
  - meta
  - llama
  - llama-2
  - mlx
---

# Llama-2-7b-mlx

> Llama-2-7b-mlx - mlx-community 在 ModelScope 开源的模型。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…

mlx-community/Llama-2-7b-mlx 是 ModelScope 魔搭社区上的text-generation模型，采用 llama2 许可。

- **Repository**: mlx-community/Llama-2-7b-mlx
- **License**: llama2
- **Tasks**: text-generation
- **Tags**: facebook, meta, llama, llama-2, mlx
- **Downloads**: 995
- **Stars**: 0
- **Last updated**: 2025-02-06

Source: https://www.modelscope.cn/models/mlx-community/Llama-2-7b-mlx

---

# **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.

```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-mlx mlx-llama/Llama-2-7b-mlx

# Run example
python mlx-examples/llama/llama.py --prompt "My name is" Llama-2-7b-mlx/ Llama-2-7b-mlx/tokenizer.model
```

Please, refer to the [original model card](https://huggingface.co/meta-llama/Llama-2-7b/tree/main) for details on Llama 2.
