Update README.md
Browse files
README.md
CHANGED
@@ -11,15 +11,15 @@ This is the [Salesforce/codegen2-1B](https://huggingface.co/Salesforce/codegen2-
|
|
11 |
|
12 |
An example of how to do inference on this model:
|
13 |
```python
|
|
|
14 |
from optimum.intel.openvino import OVModelForCausalLM
|
15 |
-
from transformers import AutoTokenizer, pipeline
|
16 |
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
print(
|
24 |
```
|
25 |
|
|
|
11 |
|
12 |
An example of how to do inference on this model:
|
13 |
```python
|
14 |
+
from transformers import AutoTokenizer
|
15 |
from optimum.intel.openvino import OVModelForCausalLM
|
|
|
16 |
|
17 |
+
tokenizer = AutoTokenizer.from_pretrained("helenai/Salesforce-codegen2-1B-ov")
|
18 |
+
model = OVModelForCausalLM.from_pretrained("helenai/Salesforce-codegen2-1B-ov")
|
19 |
+
|
20 |
+
text = "def hello_world():"
|
21 |
+
input_ids = tokenizer(text, return_tensors="pt").input_ids
|
22 |
+
generated_ids = model.generate(input_ids, max_length=128)
|
23 |
+
print(tokenizer.decode(generated_ids[0], skip_special_tokens=True))
|
24 |
```
|
25 |
|