Commit fdc801ed authored by Jared Casper's avatar Jared Casper
Browse files

Merge branch 'check_prompts_is_list' into 'main'

Sending in prompts with the wrong type hangs the server.  This is a check to make sure it's a list

See merge request ADLR/megatron-lm!473
parents f4a8b1d9 2fdd54ec
...@@ -41,6 +41,12 @@ class MegatronGenerate(Resource): ...@@ -41,6 +41,12 @@ class MegatronGenerate(Resource):
return "sentences is no longer used. Replace with prompts", 400 return "sentences is no longer used. Replace with prompts", 400
prompts = request.get_json()["prompts"] prompts = request.get_json()["prompts"]
if not isinstance(prompts, list):
return "prompts is not a list of strings", 400
if len(prompts) == 0:
return "prompts is empty", 400
if len(prompts) > 128: if len(prompts) > 128:
return "Maximum number of prompts is 128", 400 return "Maximum number of prompts is 128", 400
......
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