Update README.md
Browse files
README.md
CHANGED
|
@@ -8,4 +8,24 @@ Gnerative Pretrained Tranformer with 3 Billion parameters for Norwegian. The mod
|
|
| 8 |
|
| 9 |
It belongs to NorGLM, a suite of pretrained Norwegian Generative Language Models. NorGLM can be used for non-commercial purposes.
|
| 10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
More training and evaluation details and papers will come soon!
|
|
|
|
| 8 |
|
| 9 |
It belongs to NorGLM, a suite of pretrained Norwegian Generative Language Models. NorGLM can be used for non-commercial purposes.
|
| 10 |
|
| 11 |
+
## Run the Model
|
| 12 |
+
```python
|
| 13 |
+
import torch
|
| 14 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 15 |
+
|
| 16 |
+
model_id = "NorGLM/NorGPT-3B-continue"
|
| 17 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
| 18 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 19 |
+
model_id,
|
| 20 |
+
device_map='auto',
|
| 21 |
+
torch_dtype=torch.bfloat16
|
| 22 |
+
)
|
| 23 |
+
|
| 24 |
+
text = "Tom ønsket å gå på barene med venner"
|
| 25 |
+
inputs = tokenizer(text, return_tensors="pt")
|
| 26 |
+
outputs = model.generate(**inputs, max_new_tokens=20)
|
| 27 |
+
```
|
| 28 |
+
|
| 29 |
+
## Note
|
| 30 |
+
|
| 31 |
More training and evaluation details and papers will come soon!
|