Update README.md
Browse files
README.md
CHANGED
@@ -54,12 +54,21 @@ The usage is straightforward and very similar to any other instruction fine-tune
|
|
54 |
|
55 |
```python
|
56 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
|
|
57 |
checkpoint_name="ArmelR/starcoder-gradio-v0"
|
58 |
model = AutoModelForCausalLM.from_pretrained(checkpoint_name)
|
59 |
tokenizer = AutoTokenizer.from_pretrained(checkpoint_name)
|
|
|
60 |
prompt = "Create a gradio application that help to convert temperature in celcius into temperature in Fahrenheit"
|
61 |
inputs = tokenizer(f"Question: {prompt}\n\nAnswer: ", return_tensors="pt")
|
62 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
input_len=len(inputs["input_ids"])
|
64 |
print(tokenizer.decode(outputs[0][input_len:]))
|
65 |
```
|
|
|
54 |
|
55 |
```python
|
56 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
57 |
+
|
58 |
checkpoint_name="ArmelR/starcoder-gradio-v0"
|
59 |
model = AutoModelForCausalLM.from_pretrained(checkpoint_name)
|
60 |
tokenizer = AutoTokenizer.from_pretrained(checkpoint_name)
|
61 |
+
|
62 |
prompt = "Create a gradio application that help to convert temperature in celcius into temperature in Fahrenheit"
|
63 |
inputs = tokenizer(f"Question: {prompt}\n\nAnswer: ", return_tensors="pt")
|
64 |
+
|
65 |
+
outputs = model.generate(
|
66 |
+
inputs["input_ids"],
|
67 |
+
temperature=0.2,
|
68 |
+
top_p=0.95,
|
69 |
+
max_new_tokens=200
|
70 |
+
)
|
71 |
+
|
72 |
input_len=len(inputs["input_ids"])
|
73 |
print(tokenizer.decode(outputs[0][input_len:]))
|
74 |
```
|