Edit model card
YAML Metadata Warning: empty or missing yaml metadata in repo card (https://huggingface.co/docs/hub/model-cards#model-card-metadata)

https://huggingface.co/HuggingFaceM4/tiny-random-LlamaForCausalLM

from sparseml.transformers import SparseAutoModelForCausalLM, SparseAutoTokenizer, oneshot
from sparseml.modifiers import SparseGPTModifier

model_id = "HuggingFaceM4/tiny-random-LlamaForCausalLM"
compressed_model_id = "mgoin/tiny-random-LlamaForCausalLM-pruned95-compressed"

# Apply SparseGPT to the model
oneshot(
    model=model_id,
    dataset="open_platypus",
    recipe=SparseGPTModifier(sparsity=0.95),
    output_dir="temp-output",
)

model = SparseAutoModelForCausalLM.from_pretrained("temp-output", torch_dtype="auto")
tokenizer = SparseAutoTokenizer.from_pretrained(model_id)

model.save_pretrained(compressed_model_id.split("/")[-1], save_compressed=True)
tokenizer.save_pretrained(compressed_model_id.split("/")[-1])

# Upload the checkpoint to Hugging Face
from huggingface_hub import HfApi
HfApi().upload_folder(
    folder_path=compressed_model_id.split("/")[-1],
    repo_id=compressed_model_id,
)
Downloads last month
9
Safetensors
Model size
1.22M params
Tensor type
I64
FP16
U8
Inference API
This model does not have enough activity to be deployed to Inference API (serverless) yet. Increase its social visibility and check back later, or deploy to Inference Endpoints (dedicated) instead.