Skip to content

Commit

Permalink
Fix for when prompt contains an odd num of apostrophes (#4660)
Browse files Browse the repository at this point in the history
The apostrophes in args.user_args are mixed with the single quotes used
to enclose x in the parsing code.

For example,
`deepspeed --num_nodes 1 --num_gpus 8 --no_local_rank run_generation.py
--model_name_or_path tiiuae/falcon-40b --max_new_tokens 128 --prompt
"I'm a student"`

instead of (which doesn't work):
`deepspeed --num_nodes 1 --num_gpus 8 --no_local_rank run_generation.py
--model_name_or_path tiiuae/falcon-40b --max_new_tokens 128 --prompt
'I'm a student'`

To resolve this issue, we can make a change to enclose x in double
quotes instead of single quotes.

Co-authored-by: Logan Adams <114770087+loadams@users.noreply.github.com>
  • Loading branch information
oelayan7 and loadams authored Nov 15, 2023
1 parent 25e9cd5 commit 00e7dc5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion deepspeed/launcher/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ def main(args=None):
args = parse_args(args)

# For when argparse interprets remaining args as a single string
args.user_args = shlex.split(" ".join(list(map(lambda x: x if x.startswith("-") else f"'{x}'", args.user_args))))
args.user_args = shlex.split(" ".join(list(map(lambda x: x if x.startswith("-") else f'"{x}"', args.user_args))))

if args.elastic_training:
assert args.master_addr != "", "Master Addr is required when elastic training is enabled"
Expand Down

0 comments on commit 00e7dc5

Please sign in to comment.