srmty's picture
Update README.md
190642a verified
|
Raw
History Blame Contribute Delete
1.17 kB
metadata
license: apache-2.0
base_model: HuggingFaceTB/SmolLM2-360M
language:
  - en
pipeline_tag: text-generation
tags:
  - smollm2
  - instruction-tuning
  - supervised-fine-tuning
  - alpaca
  - gpteacher
  - instruction-following
  - small-language-models

SmolLM2-360M Base IT

This is an instruction-tuned version of HuggingFaceTB/SmolLM2-360M.

The model was fine-tuned for general instruction following using Alpaca-style supervised fine-tuning.

Quick Start

import torch
from transformers import pipeline

model_id = "srmty/smollm2-python-coder"

generator = pipeline(
    "text-generation",
    model=model_id,
    tokenizer=model_id,
    torch_dtype=torch.float16 if torch.cuda.is_available() else torch.float32,
    device_map="auto" if torch.cuda.is_available() else None,
)

messages = [
    {
        "role": "user",
        "content": "Write a Python function to check whether a number is prime."
    }
]

output = generator(
    messages,
    max_new_tokens=256,
    do_sample=True,
    temperature=0.7,
    top_p=0.9,
    return_full_text=False,
    pad_token_id=generator.tokenizer.eos_token_id,
)

print(output[0]["generated_text"])