Update README.md
Browse files
README.md
CHANGED
@@ -28,7 +28,23 @@ We conducted continued pretraining using Japanese data on the English language m
|
|
28 |
## Usage
|
29 |
|
30 |
```python
|
31 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
```
|
33 |
|
34 |
## Model Details
|
|
|
28 |
## Usage
|
29 |
|
30 |
```python
|
31 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
32 |
+
tokenizer = AutoTokenizer.from_pretrained("stabilityai/japanese-mistral-7b-v0.1-base")
|
33 |
+
model = AutoModelForCausalLM.from_pretrained(
|
34 |
+
"stabilityai/japanese-mistral-7b-v0.1-base",
|
35 |
+
trust_remote_code=True,
|
36 |
+
torch_dtype="auto",
|
37 |
+
)
|
38 |
+
model.cuda()
|
39 |
+
inputs = tokenizer("AI で科学研究を加速するには、", return_tensors="pt").to("cuda")
|
40 |
+
tokens = model.generate(
|
41 |
+
**inputs,
|
42 |
+
max_new_tokens=64,
|
43 |
+
temperature=0.75,
|
44 |
+
top_p=0.95,
|
45 |
+
do_sample=True,
|
46 |
+
)
|
47 |
+
print(tokenizer.decode(tokens[0], skip_special_tokens=True))
|
48 |
```
|
49 |
|
50 |
## Model Details
|