Update README.md
Browse files
README.md
CHANGED
@@ -40,7 +40,7 @@ generate_text = pipeline(
|
|
40 |
)
|
41 |
|
42 |
res = generate_text(
|
43 |
-
"
|
44 |
min_new_tokens=2,
|
45 |
max_new_tokens=256,
|
46 |
do_sample=False,
|
@@ -55,11 +55,11 @@ print(res[0]["generated_text"])
|
|
55 |
You can print a sample prompt after the preprocessing step to see how it is feed to the tokenizer:
|
56 |
|
57 |
```python
|
58 |
-
print(generate_text.preprocess("
|
59 |
```
|
60 |
|
61 |
```bash
|
62 |
-
<|prompt
|
63 |
```
|
64 |
|
65 |
Alternatively, if you prefer to not use `trust_remote_code=True` you can download [h2oai_pipeline.py](h2oai_pipeline.py), store it alongside your notebook, and construct the pipeline yourself from the loaded model and tokenizer:
|
@@ -83,7 +83,7 @@ model = AutoModelForCausalLM.from_pretrained(
|
|
83 |
generate_text = H2OTextGenerationPipeline(model=model, tokenizer=tokenizer)
|
84 |
|
85 |
res = generate_text(
|
86 |
-
"
|
87 |
min_new_tokens=2,
|
88 |
max_new_tokens=256,
|
89 |
do_sample=False,
|
|
|
40 |
)
|
41 |
|
42 |
res = generate_text(
|
43 |
+
"日本で一番高い山は富士山ですが、二番目に高い山は?",
|
44 |
min_new_tokens=2,
|
45 |
max_new_tokens=256,
|
46 |
do_sample=False,
|
|
|
55 |
You can print a sample prompt after the preprocessing step to see how it is feed to the tokenizer:
|
56 |
|
57 |
```python
|
58 |
+
print(generate_text.preprocess("日本で一番高い山は富士山ですが、二番目に高い山は?")["prompt_text"])
|
59 |
```
|
60 |
|
61 |
```bash
|
62 |
+
<|prompt|>日本で一番高い山は富士山ですが、二番目に高い山は?</s><|answer|>
|
63 |
```
|
64 |
|
65 |
Alternatively, if you prefer to not use `trust_remote_code=True` you can download [h2oai_pipeline.py](h2oai_pipeline.py), store it alongside your notebook, and construct the pipeline yourself from the loaded model and tokenizer:
|
|
|
83 |
generate_text = H2OTextGenerationPipeline(model=model, tokenizer=tokenizer)
|
84 |
|
85 |
res = generate_text(
|
86 |
+
"日本で一番高い山は富士山ですが、二番目に高い山は?",
|
87 |
min_new_tokens=2,
|
88 |
max_new_tokens=256,
|
89 |
do_sample=False,
|