pvduy commited on
Commit
7441303
1 Parent(s): 167fa29

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +64 -8
README.md CHANGED
@@ -28,14 +28,7 @@ license: other
28
 
29
  ## Usage
30
 
31
- `StableLM 2 Zephyr 1.6B` uses the following instruction format:
32
- ```
33
- <|user|>
34
- Which famous math number begins with 1.6 ...?<|endoftext|>
35
- <|assistant|>
36
- The number you are referring to is 1.618033988749895. This is the famous value known as the golden ratio<|endoftext|>
37
- ```
38
-
39
  This format is also available through the tokenizer's `apply_chat_template` method:
40
 
41
  ```python
@@ -65,6 +58,69 @@ tokens = model.generate(
65
  print(tokenizer.decode(tokens[0], skip_special_tokens=False))
66
  ```
67
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68
  ## Model Details
69
 
70
  * **Developed by**: [Stability AI](https://stability.ai/)
 
28
 
29
  ## Usage
30
 
31
+ `StableLM 2 Chat` uses the following instruction ChatML format
 
 
 
 
 
 
 
32
  This format is also available through the tokenizer's `apply_chat_template` method:
33
 
34
  ```python
 
58
  print(tokenizer.decode(tokens[0], skip_special_tokens=False))
59
  ```
60
 
61
+ StableLM 2 Chat also supports function call usage this is an example how you can use it:
62
+ ```python
63
+ system_prompt_func = """\
64
+ You are a helpful assistant with access to the following functions. You must use them if required -\n
65
+ [
66
+ {
67
+ "type": "function",
68
+ "function": {
69
+ "name": "TextToImage",
70
+ "description": "This function able to creating, drawing, or illustrating an image from a text prompt.",
71
+ "parameters": {
72
+ "type": "object",
73
+ "properties": {
74
+ "prompt": {
75
+ "type": "string",
76
+ "description": "The description of image that user wanto to create."
77
+ }
78
+ },
79
+ "required": [
80
+ "prompt"
81
+ ]
82
+ }
83
+ }
84
+ },
85
+ {
86
+ "type": "function",
87
+ "function": {
88
+ "name": "EditImage",
89
+ "description": "This is capable of changing, editing, adjusting, or modifying an image by describing changes to the image through a text prompt.",
90
+ "parameters": {
91
+ "type": "object",
92
+ "properties": {
93
+ "prompt": {
94
+ "type": "string",
95
+ "description": "The instruction used to edit the image."
96
+ }
97
+ },
98
+ "required": [
99
+ "prompt"
100
+ ]
101
+ }
102
+ }
103
+ }
104
+ ]
105
+ """
106
+ messages = [{'role': 'system', 'content': system_prompt_func}, "user": "Help me to generate a picture of Eiffel Tower in the night!"]
107
+ inputs = tokenizer.apply_chat_template(
108
+ prompt,
109
+ add_generation_prompt=True,
110
+ return_tensors='pt'
111
+ )
112
+
113
+ tokens = model.generate(
114
+ inputs.to(model.device),
115
+ max_new_tokens=1024,
116
+ temperature=0.5,
117
+ do_sample=True
118
+ )
119
+
120
+ print(tokenizer.decode(tokens[0], skip_special_tokens=False))
121
+ ```
122
+
123
+
124
  ## Model Details
125
 
126
  * **Developed by**: [Stability AI](https://stability.ai/)