Commit 0694205c authored by Jared Casper's avatar Jared Casper
Browse files

Updating text_generation_cli.py

parent da77a836
...@@ -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({"sentences": [sentence], "max_len":max_len}) data = json.dumps({"prompts": [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])
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment