Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
144cea25
"docs/source/ko/tasks/image_classification.md" did not exist on "2e90c3df8f965ec616faa08e3fb2a1857a1e64b6"
Unverified
Commit
144cea25
authored
Jul 14, 2021
by
Sylvain Gugger
Committed by
GitHub
Jul 14, 2021
Browse files
Fix multiple choice doc examples (#12679)
parent
5dd0c956
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
src/transformers/file_utils.py
src/transformers/file_utils.py
+2
-2
No files found.
src/transformers/file_utils.py
View file @
144cea25
...
@@ -982,7 +982,7 @@ TF_MULTIPLE_CHOICE_SAMPLE = r"""
...
@@ -982,7 +982,7 @@ TF_MULTIPLE_CHOICE_SAMPLE = r"""
>>> choice0 = "It is eaten with a fork and a knife."
>>> choice0 = "It is eaten with a fork and a knife."
>>> choice1 = "It is eaten while held in the hand."
>>> choice1 = "It is eaten while held in the hand."
>>> encoding = tokenizer([
[
prompt, prompt], [choice0, choice1]
]
, return_tensors='tf', padding=True)
>>> encoding = tokenizer([prompt, prompt], [choice0, choice1], return_tensors='tf', padding=True)
>>> inputs = {{k: tf.expand_dims(v, 0) for k, v in encoding.items()}}
>>> inputs = {{k: tf.expand_dims(v, 0) for k, v in encoding.items()}}
>>> outputs = model(inputs) # batch size is 1
>>> outputs = model(inputs) # batch size is 1
...
@@ -1099,7 +1099,7 @@ FLAX_MULTIPLE_CHOICE_SAMPLE = r"""
...
@@ -1099,7 +1099,7 @@ FLAX_MULTIPLE_CHOICE_SAMPLE = r"""
>>> choice0 = "It is eaten with a fork and a knife."
>>> choice0 = "It is eaten with a fork and a knife."
>>> choice1 = "It is eaten while held in the hand."
>>> choice1 = "It is eaten while held in the hand."
>>> encoding = tokenizer([
[
prompt, prompt], [choice0, choice1]
]
, return_tensors='jax', padding=True)
>>> encoding = tokenizer([prompt, prompt], [choice0, choice1], return_tensors='jax', padding=True)
>>> outputs = model(**{{k: v[None, :] for k,v in encoding.items()}})
>>> outputs = model(**{{k: v[None, :] for k,v in encoding.items()}})
>>> logits = outputs.logits
>>> logits = outputs.logits
...
...
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