Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
a7501f6f
Unverified
Commit
a7501f6f
authored
Jun 09, 2023
by
Arthur
Committed by
GitHub
Jun 09, 2023
Browse files
[BlenderBotSmall] Update doc example (#24092)
* small tokenizer uses `__start__` and `__end__` * fix PR doctest
parent
5af3a1aa
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
src/transformers/models/blenderbot_small/modeling_blenderbot_small.py
...mers/models/blenderbot_small/modeling_blenderbot_small.py
+4
-4
No files found.
src/transformers/models/blenderbot_small/modeling_blenderbot_small.py
View file @
a7501f6f
...
@@ -536,14 +536,14 @@ BLENDERBOT_SMALL_GENERATION_EXAMPLE = r"""
...
@@ -536,14 +536,14 @@ BLENDERBOT_SMALL_GENERATION_EXAMPLE = r"""
Human: I'm not sure
Human: I'm not sure
>>> NEXT_UTTERANCE = (
>>> NEXT_UTTERANCE = (
... "My friends are cool but they eat too many carbs.
</s> <s>
what kind of carbs do they eat? "
... "My friends are cool but they eat too many carbs.
__end__ __start__
what kind of carbs do they eat? "
... "i don't know much about carbs
</s>
"
... "i don't know much about carbs
__end__
"
... "
<s>
I'm not sure."
... "
__start__
I'm not sure."
... )
... )
>>> inputs = tokenizer([NEXT_UTTERANCE], return_tensors="pt")
>>> inputs = tokenizer([NEXT_UTTERANCE], return_tensors="pt")
>>> next_reply_ids = model.generate(**inputs)
>>> next_reply_ids = model.generate(**inputs)
>>> print("Bot: ", tokenizer.batch_decode(next_reply_ids, skip_special_tokens=True)[0])
>>> print("Bot: ", tokenizer.batch_decode(next_reply_ids, skip_special_tokens=True)[0])
Bot: they eat a lot of carbs. carbs are high in fat, protein, and
carbohydr
at
e
s.
Bot: they eat a lot of carbs. carbs are high in fat, protein, and
f
ats.
```
```
"""
"""
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment