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
fd8a3556
Commit
fd8a3556
authored
Apr 08, 2019
by
Benjamin Mann
Browse files
fix run_gpt2.py
parent
94980b52
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
1 deletion
+4
-1
examples/run_gpt2.py
examples/run_gpt2.py
+4
-1
No files found.
examples/run_gpt2.py
View file @
fd8a3556
...
@@ -83,7 +83,8 @@ def run_model():
...
@@ -83,7 +83,8 @@ def run_model():
elif
args
.
length
>
model
.
config
.
n_ctx
:
elif
args
.
length
>
model
.
config
.
n_ctx
:
raise
ValueError
(
"Can't get samples longer than window size: %s"
%
model
.
config
.
n_ctx
)
raise
ValueError
(
"Can't get samples longer than window size: %s"
%
model
.
config
.
n_ctx
)
while
not
args
.
unconditional
:
while
True
:
context_tokens
=
[]
if
not
args
.
unconditional
:
if
not
args
.
unconditional
:
raw_text
=
input
(
"Model prompt >>> "
)
raw_text
=
input
(
"Model prompt >>> "
)
while
not
raw_text
:
while
not
raw_text
:
...
@@ -106,6 +107,8 @@ def run_model():
...
@@ -106,6 +107,8 @@ def run_model():
print
(
"="
*
40
+
" SAMPLE "
+
str
(
generated
)
+
" "
+
"="
*
40
)
print
(
"="
*
40
+
" SAMPLE "
+
str
(
generated
)
+
" "
+
"="
*
40
)
print
(
text
)
print
(
text
)
print
(
"="
*
80
)
print
(
"="
*
80
)
if
args
.
unconditional
:
break
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
run_model
()
run_model
()
...
...
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