motexture commited on
Commit
71b7bf0
1 Parent(s): a8a818a

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +58 -1
README.md CHANGED
@@ -13,4 +13,61 @@ tags:
13
  - coder
14
  - model
15
  - small
16
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  - coder
14
  - model
15
  - small
16
+ ---
17
+
18
+ # SmolLCoder-360M-Instruct
19
+
20
+ ## Introduction
21
+
22
+ iTech-1B-Instruct is an IT assistant, a fine-tuned version of Llama-3.2.1B-Instruct trained on the iData dataset.
23
+
24
+ ## Quickstart
25
+
26
+ Here provides a code snippet with `apply_chat_template` to show you how to load the tokenizer and model and how to generate contents.
27
+
28
+ ```python
29
+ from transformers import AutoModelForCausalLM, AutoTokenizer
30
+ device = "cuda" # the device to load the model onto
31
+
32
+ model = AutoModelForCausalLM.from_pretrained(
33
+ "motexture/SmolLCoder-360M-Instruct",
34
+ torch_dtype="auto",
35
+ device_map="auto"
36
+ )
37
+ tokenizer = AutoTokenizer.from_pretrained("motexture/SmolLCoder-360M-Instruct")
38
+
39
+ prompt = "Write a C++ program that demonstrates the concept of separate compilation and linkage using namespaces and header files. The program should consist of multiple source files, each containing a portion of the program's code, and a header file that contains the interface information for the program.\n\nThe program should define a namespace my_namespace that contains a class MyClass with a member function print() that takes an integer as an argument. The program should also define a function main() that uses an object of the MyClass class to print a message.\n\nThe program should be compiled and linked separately, with each source file being compiled individually and then linked together to form the final executable."
40
+ messages = [
41
+ {"role": "system", "content": "You are a helpful assistant."},
42
+ {"role": "user", "content": prompt}
43
+ ]
44
+ text = tokenizer.apply_chat_template(
45
+ messages,
46
+ tokenize=False,
47
+ add_generation_prompt=True
48
+ )
49
+ model_inputs = tokenizer([text], return_tensors="pt").to(device)
50
+
51
+ generated_ids = model.generate(
52
+ model_inputs.input_ids,
53
+ max_new_tokens=4096
54
+ )
55
+ generated_ids = [
56
+ output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
57
+ ]
58
+
59
+ response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
60
+ ```
61
+
62
+ ## License
63
+
64
+ [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0)
65
+
66
+ ## Citation
67
+ ```bash
68
+ @misc{allal2024SmolLM2,
69
+ title={SmolLM2 - with great data, comes great performance},
70
+ author={Loubna Ben Allal and Anton Lozhkov and Elie Bakouch and Gabriel Martín Blázquez and Lewis Tunstall and Agustín Piqueres and Andres Marafioti and Cyril Zakka and Leandro von Werra and Thomas Wolf},
71
+ year={2024},
72
+ }
73
+ ```