lewtun HF staff commited on
Commit
17bb4cf
1 Parent(s): 2f20a76

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +10 -4
README.md CHANGED
@@ -60,13 +60,19 @@ In particular, the model was evaluated on some categories of gender biases, prop
60
 
61
  Use the code below to get started with the model.
62
 
 
 
63
  ```python
 
64
  from transformers import pipeline
65
 
66
- pipe = pipeline("text-generation", model="HuggingFaceH4/starchat-alpha")
67
- # Inputs use chat tokens
68
- inputs = "<|system|>\n<|end|>\n<|user|>How can I sort a list in Python?<|end|>\n<|assistant|>"
69
- outputs = pipe(inputs)
 
 
 
70
  ```
71
 
72
 
 
60
 
61
  Use the code below to get started with the model.
62
 
63
+ Here's how you can run the model using the `pipeline()` function from 🤗 Transformers:
64
+
65
  ```python
66
+ import torch
67
  from transformers import pipeline
68
 
69
+ pipe = pipeline("text-generation", model="HuggingFaceH4/starchat-alpha", torch_dtype=torch.bfloat16, device_map="auto")
70
+
71
+ prompt_template = "<|system|>\n<|end|>\n<|user|>\n{query}<|end|>\n<|assistant|>"
72
+ prompt = prompt_template.format(query="How do I sort a list in Python?")
73
+ # We use a special <|end|> token with ID 49155 to denote ends of a turn
74
+ outputs = pipe(prompt, max_new_tokens=256, do_sample=True, temperature=0.2, top_k=50, top_p=0.95, eos_token_id=49155)
75
+ # You can sort a list in Python by using the sort() method. Here's an example:\n\n```\nnumbers = [3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5]\nnumbers.sort()\nprint(numbers)\n```\n\nThis will sort the list in place and print the sorted list.
76
  ```
77
 
78