---
title: granite-20b-code-instruct-4bit
canonical_url: "https://www.modelscope.cn/models/mlx-community/granite-20b-code-instruct-4bit"
md_url: "https://www.modelscope.cn/models/mlx-community/granite-20b-code-instruct-4bit.md"
repository: mlx-community/granite-20b-code-instruct-4bit
last_updated: 2024-12-19
license: apache-2.0
pipeline_tag: text-generation
tasks:
  - text-generation
model_type:
  - gpt_bigcode
architectures:
  - GPTBigCodeForCausalLM
base_model:
  - ibm-granite/granite-20b-code-base
base_model_relation: finetune
parameters: 3.1B
tensor_type:
  - U32
  - F16
library_name:
  - mlx
  - safetensors
  - pytorch
frameworks:
  - pytorch
inference_backends:
  - "deploy_task text/emb"
  - "sglang 0.5.2"
  - "vllm 0.9.2"
downloads: 979
stars: 0
tags:
  - code
  - granite
  - mlx
---

# granite-20b-code-instruct-4bit

> granite-20b-code-instruct-4bit - mlx-community 在 ModelScope 开源的模型。mlx-community/granite-20b-code-instruct-4bit

mlx-community/granite-20b-code-instruct-4bit 是 ModelScope 魔搭社区上的 3.1B 参数text-generation模型，采用 apache-2.0 许可，基于 ibm-granite/granite-20b-code-base 构建，可用 deploy_task text/emb、sglang 0.5.2、vllm 0.9.2 部署。

- **Repository**: mlx-community/granite-20b-code-instruct-4bit
- **License**: apache-2.0
- **Tasks**: text-generation
- **Parameters**: 3.1B
- **Base model**: ibm-granite/granite-20b-code-base
- **Inference backends**: deploy_task text/emb, sglang 0.5.2, vllm 0.9.2
- **Tags**: code, granite, mlx
- **Downloads**: 979
- **Stars**: 0
- **Last updated**: 2024-12-19

Source: https://www.modelscope.cn/models/mlx-community/granite-20b-code-instruct-4bit

---

# mlx-community/granite-20b-code-instruct-4bit

The Model [mlx-community/granite-20b-code-instruct-4bit](https://huggingface.co/mlx-community/granite-20b-code-instruct-4bit) was converted to MLX format from [ibm-granite/granite-20b-code-instruct](https://huggingface.co/ibm-granite/granite-20b-code-instruct) using mlx-lm version **0.13.0**.

## Use with mlx

```bash
pip install mlx-lm
```

```python
from mlx_lm import load, generate

model, tokenizer = load("mlx-community/granite-20b-code-instruct-4bit")
response = generate(model, tokenizer, prompt="hello", verbose=True)
```
