ByteForge commited on
Commit
0c92a8d
1 Parent(s): 5e7482c

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +21 -3
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
- inputs = tokenizer.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt").to(model.device)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
 
49
- outputs = model.generate(inputs, max_new_tokens=512, do_sample=False, top_k=50, top_p=0.95, num_return_sequences=1, eos_token_id=tokenizer.eos_token_id)
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