Skip to content

arg parser doesn't work in a lot of situations #468

Closed
@HDCharles

Description

@HDCharles

see https://github.com/pytorch/torchchat/blob/main/torchchat.py#L98-L104

this code breaks arguments into flag_args and positional_args but makes the assumption that all flag_args will consist of two pieces i.e. -- if the flag_arg doesn't have that form, it causes problems
so something like

... --compile --dtype bfloat16 -> ERROR

since compile only has one part, it throws off the '2 step jump' and stores [--compile, --dtype] as one arg and then sees bfloat16 and thinks its a positional arg. Note if --compile is the last arg it doesn't cause this issue.

... --tasks -> ERROR

the tasks argument has a similar issue unless you use exactly 1 task. If you to --tasks you either

A) if --tasks is not the last argument supplied, you get [--tasks, ] stored as 1 arg and gets parsed as a positional arg
B) if --tasks is the last argument supplied, then no rearrangement happens since its already at the end, but all other positional args get moved after --tasks so when parsed --tasks becomes a list with [, , <positional_arg1>...etc] rather than <positional_arg1> being parsed as a positional arg.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions