|
Download README.md from srmty/smollm2-python-coder: direct link, hf CLI and curl.
- Browser
- Download file 1.17 kB
-
https://huggingface.co/srmty/smollm2-python-coder/resolve/main/README.md
- Command line
-
hf download hf://srmty/smollm2-python-coder/README.md
-
curl -L -o README.md https://huggingface.co/srmty/smollm2-python-coder/resolve/main/README.md
1.17 kB
| 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"]) | |
| ``` |