File size: 1,172 Bytes
4b0b4b5
190642a
 
 
 
 
4b0b4b5
190642a
 
 
 
 
 
 
4b0b4b5
 
190642a
4b0b4b5
190642a
4b0b4b5
190642a
4b0b4b5
190642a
4b0b4b5
190642a
4b0b4b5
 
190642a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4b0b4b5
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
---
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
```python
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"])

```