Update README.md
Browse files
README.md
CHANGED
@@ -44,10 +44,28 @@ tokenizer = transformers.AutoTokenizer.from_pretrained(model_id)
|
|
44 |
messages=[
|
45 |
{ 'role': 'user', 'content': "write a quick sort algorithm in python."}
|
46 |
]
|
47 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
|
49 |
-
|
50 |
-
print(tokenizer.decode(outputs[0][len(inputs[0]):], skip_special_tokens=True))
|
51 |
```
|
52 |
|
53 |
### 4. License
|
|
|
44 |
messages=[
|
45 |
{ 'role': 'user', 'content': "write a quick sort algorithm in python."}
|
46 |
]
|
47 |
+
messages = [
|
48 |
+
{"role": "system", "content": "You are world class python programmer with deep expertise in Ploty for data visualisation and analysis. Given a input question and schema, answer with correct python plotly code"},
|
49 |
+
{"role": "user", "content": prompt},
|
50 |
+
]
|
51 |
+
|
52 |
+
input_ids = tokenizer1.apply_chat_template(
|
53 |
+
messages,
|
54 |
+
tokenize=False,
|
55 |
+
add_generation_prompt=True
|
56 |
+
)
|
57 |
+
|
58 |
+
terminators = [
|
59 |
+
tokenizer1.eos_token_id,
|
60 |
+
tokenizer1.convert_tokens_to_ids("<|eot_id|>")
|
61 |
+
]
|
62 |
+
|
63 |
+
input_tokens = tokenizer1.convert_ids_to_tokens(tokenizer1.encode(input_ids))
|
64 |
+
|
65 |
+
results = model1.generate_batch([input_tokens], include_prompt_in_result=False, max_length=700, sampling_temperature=0.6, sampling_topp=0.9, end_token=terminators)
|
66 |
+
output = tokenizer1.decode(results[0].sequences_ids[0])
|
67 |
|
68 |
+
print(output)
|
|
|
69 |
```
|
70 |
|
71 |
### 4. License
|