Triangle104 commited on
Commit
3571394
·
verified ·
1 Parent(s): f20669b

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +36 -0
README.md CHANGED
@@ -17,6 +17,42 @@ base_model: HuggingFaceTB/SmolLM2-135M-Instruct
17
  This model was converted to GGUF format from [`HuggingFaceTB/SmolLM2-135M-Instruct`](https://huggingface.co/HuggingFaceTB/SmolLM2-135M-Instruct) using llama.cpp via the ggml.ai's [GGUF-my-repo](https://huggingface.co/spaces/ggml-org/gguf-my-repo) space.
18
  Refer to the [original model card](https://huggingface.co/HuggingFaceTB/SmolLM2-135M-Instruct) for more details on the model.
19
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  ## Use with llama.cpp
21
  Install llama.cpp through brew (works on Mac and Linux)
22
 
 
17
  This model was converted to GGUF format from [`HuggingFaceTB/SmolLM2-135M-Instruct`](https://huggingface.co/HuggingFaceTB/SmolLM2-135M-Instruct) using llama.cpp via the ggml.ai's [GGUF-my-repo](https://huggingface.co/spaces/ggml-org/gguf-my-repo) space.
18
  Refer to the [original model card](https://huggingface.co/HuggingFaceTB/SmolLM2-135M-Instruct) for more details on the model.
19
 
20
+ ---
21
+ Model details:
22
+ -
23
+ SmolLM2 is a family of compact language models available in three size: 135M, 360M, and 1.7B parameters. They are capable of solving a wide range of tasks while being lightweight enough to run on-device.
24
+
25
+ SmolLM2 demonstrates significant advances over its predecessor SmolLM1, particularly in instruction following, knowledge, reasoning. The 135M model was trained on 2 trillion tokens using a diverse dataset combination: FineWeb-Edu, DCLM, The Stack, along with new filtered datasets we curated and will release soon. We developed the instruct version through supervised fine-tuning (SFT) using a combination of public datasets and our own curated datasets. We then applied Direct Preference Optimization (DPO) using UltraFeedback.
26
+
27
+ The instruct model additionally supports tasks such as text rewriting, summarization and function calling (for the 1.7B) thanks to datasets developed by Argilla such as Synth-APIGen-v0.1. You can find the SFT dataset here: https://huggingface.co/datasets/HuggingFaceTB/smol-smoltalk and finetuning code at https://github.com/huggingface/alignment-handbook/tree/main/recipes/smollm2
28
+ How to use
29
+ Transformers
30
+
31
+ pip install transformers
32
+
33
+ from transformers import AutoModelForCausalLM, AutoTokenizer
34
+ checkpoint = "HuggingFaceTB/SmolLM2-135M-Instruct"
35
+
36
+ device = "cuda" # for GPU usage or "cpu" for CPU usage
37
+ tokenizer = AutoTokenizer.from_pretrained(checkpoint)
38
+ # for multiple GPUs install accelerate and do `model = AutoModelForCausalLM.from_pretrained(checkpoint, device_map="auto")`
39
+ model = AutoModelForCausalLM.from_pretrained(checkpoint).to(device)
40
+
41
+ messages = [{"role": "user", "content": "What is gravity?"}]
42
+ input_text=tokenizer.apply_chat_template(messages, tokenize=False)
43
+ print(input_text)
44
+ inputs = tokenizer.encode(input_text, return_tensors="pt").to(device)
45
+ outputs = model.generate(inputs, max_new_tokens=50, temperature=0.2, top_p=0.9, do_sample=True)
46
+ print(tokenizer.decode(outputs[0]))
47
+
48
+ Chat in TRL
49
+
50
+ You can also use the TRL CLI to chat with the model from the terminal:
51
+
52
+ pip install trl
53
+ trl chat --model_name_or_path HuggingFaceTB/SmolLM2-135M-Instruct --device cpu
54
+
55
+ ---
56
  ## Use with llama.cpp
57
  Install llama.cpp through brew (works on Mac and Linux)
58