Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
language:
|
3 |
+
- ja
|
4 |
+
tags:
|
5 |
+
- causal-lm
|
6 |
+
pipeline_tag: text-generation
|
7 |
+
license: apache-2.0
|
8 |
+
extra_gated_fields:
|
9 |
+
Name: text
|
10 |
+
Email: text
|
11 |
+
Country: text
|
12 |
+
Organization or Affiliation: text
|
13 |
+
I allow Stability AI to contact me about information related to its models and research: checkbox
|
14 |
+
---
|
15 |
+
|
16 |
+
# Nocturn 7B
|
17 |
+
|
18 |
+
## Model Description
|
19 |
+
|
20 |
+
This is a 7B-parameter decoder-only Japanese language model fine-tuned on novel datasets, built on top of the base model Japanese Stable LM Base Gamma 7B. [Japanese Stable LM Instruct Gamma 7B](https://huggingface.co/stabilityai/japanese-stablelm-instruct-gamma-7b)
|
21 |
+
|
22 |
+
## Usage
|
23 |
+
|
24 |
+
Ensure you are using Transformers 4.34.0 or newer.
|
25 |
+
|
26 |
+
```python
|
27 |
+
import torch
|
28 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
29 |
+
|
30 |
+
tokenizer = AutoTokenizer.from_pretrained("Elizezen/Nocturn-7B")
|
31 |
+
model = AutoModelForCausalLM.from_pretrained(
|
32 |
+
"Elizezen/Nocturn-7B",
|
33 |
+
torch_dtype="auto",
|
34 |
+
)
|
35 |
+
model.eval()
|
36 |
+
|
37 |
+
if torch.cuda.is_available():
|
38 |
+
model = model.to("cuda")
|
39 |
+
|
40 |
+
input_ids = tokenizer.encode(
|
41 |
+
"吾輩は猫である。名前はまだない",,
|
42 |
+
add_special_tokens=True,
|
43 |
+
return_tensors="pt"
|
44 |
+
)
|
45 |
+
|
46 |
+
tokens = model.generate(
|
47 |
+
input_ids.to(device=model.device),
|
48 |
+
max_new_tokens=512,
|
49 |
+
temperature=1,
|
50 |
+
top_p=0.95,
|
51 |
+
do_sample=True,
|
52 |
+
)
|
53 |
+
|
54 |
+
out = tokenizer.decode(tokens[0][input_ids.shape[1]:], skip_special_tokens=True).strip()
|
55 |
+
print(out)
|
56 |
+
```
|
57 |
+
|
58 |
+
### Intended Use
|
59 |
+
|
60 |
+
The model is mainly intended to be used for generating novels. It may not be so capable with instruction-based responses.
|