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
OpenDAS
Megatron-LM
Commits
0694205c
Commit
0694205c
authored
Oct 08, 2021
by
Jared Casper
Browse files
Updating text_generation_cli.py
parent
da77a836
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
tools/text_generation_cli.py
tools/text_generation_cli.py
+3
-3
No files found.
tools/text_generation_cli.py
View file @
0694205c
...
@@ -25,10 +25,10 @@ if __name__ == "__main__":
...
@@ -25,10 +25,10 @@ if __name__ == "__main__":
url
=
sys
.
argv
[
1
]
url
=
sys
.
argv
[
1
]
while
True
:
while
True
:
sentence
=
raw_input
(
"Enter prompt: "
)
sentence
=
raw_input
(
"Enter prompt: "
)
max_len
=
int
(
input
(
"Enter number tokens
output
: "
))
tokens_to_generate
=
int
(
input
(
"Enter number
of
tokens
to generate
: "
))
data
=
json
.
dumps
({
"
sentence
s"
:
[
sentence
],
"
max_len"
:
max_len
})
data
=
json
.
dumps
({
"
prompt
s"
:
[
sentence
],
"
tokens_to_generate"
:
tokens_to_generate
})
req
=
PutRequest
(
url
,
data
,
{
'Content-Type'
:
'application/json'
})
req
=
PutRequest
(
url
,
data
,
{
'Content-Type'
:
'application/json'
})
response
=
urllib2
.
urlopen
(
req
)
response
=
urllib2
.
urlopen
(
req
)
resp_sentences
=
json
.
load
(
response
)
resp_sentences
=
json
.
load
(
response
)
print
(
"Megatron Response: "
)
print
(
"Megatron Response: "
)
print
(
resp_sentences
[
"
sentences
"
][
0
])
print
(
resp_sentences
[
"
text
"
][
0
])
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