---
title: starcoderbase-1b-pruned50-quant
canonical_url: "https://www.modelscope.cn/models/nm-testing/starcoderbase-1b-pruned50-quant"
md_url: "https://www.modelscope.cn/models/nm-testing/starcoderbase-1b-pruned50-quant.md"
repository: nm-testing/starcoderbase-1b-pruned50-quant
last_updated: 2025-02-26
pipeline_tag: text-generation
tasks:
  - text-generation
model_type:
  - gpt_bigcode
architectures:
  - GPTBigCodeForCausalLM
library_name:
  - pytorch
frameworks:
  - pytorch
inference_backends:
  - "deploy_task text/emb"
  - "sglang 0.5.2"
  - "vllm 0.9.2"
downloads: 615
stars: 0
---

# starcoderbase-1b-pruned50-quant

> starcoderbase-1b-pruned50-quant - nm-testing 在 ModelScope 开源的模型。

nm-testing/starcoderbase-1b-pruned50-quant 是 ModelScope 魔搭社区上的text-generation模型，可用 deploy_task text/emb、sglang 0.5.2、vllm 0.9.2 部署。

- **Repository**: nm-testing/starcoderbase-1b-pruned50-quant
- **Tasks**: text-generation
- **Inference backends**: deploy_task text/emb, sglang 0.5.2, vllm 0.9.2
- **Downloads**: 615
- **Stars**: 0
- **Last updated**: 2025-02-26

Source: https://www.modelscope.cn/models/nm-testing/starcoderbase-1b-pruned50-quant

---

```python
model_id = "mgoin/starcoderbase-1b-pruned50-quant"

# Load model with SparseAutoModel
from sparseml.transformers.utils import SparseAutoModel
from transformers import AutoConfig

config = AutoConfig.from_pretrained(model_id)  # Why does SparseAutoModel need config?
model = SparseAutoModel.text_generation_from_pretrained(model_id, config=config)

# Apply recipe to model
# Note: Really annoying we can't grab the recipe.yaml present in the uploaded model
# and you need this separate apply_recipe_structure_to_model function
from sparseml.pytorch.model_load.helpers import apply_recipe_structure_to_model
from huggingface_hub import hf_hub_download
import os

recipe_path = hf_hub_download(repo_id=model_id, filename="recipe.yaml")
apply_recipe_structure_to_model(
    model=model, recipe_path=recipe_path, model_path=os.path.dirname(recipe_path)
)

# Regular HF inference
from transformers import AutoTokenizer

tokenizer = AutoTokenizer.from_pretrained(model_id)
inputs = tokenizer.encode("def print_hello_world():", return_tensors="pt")
outputs = model.generate(inputs)
print(tokenizer.decode(outputs[0]))
"""
def print_hello_world():
    print("Hello World!")

print_hello_world
"""
```
