forked from docs/doc-exports
Reviewed-by: Pruthi, Vineet <vineet.pruthi@t-systems.com> Co-authored-by: Lai, Weijian <laiweijian4@huawei.com> Co-committed-by: Lai, Weijian <laiweijian4@huawei.com>
2.1 KiB
2.1 KiB
Failed to Parse Parameters and Log Error Occurs
Symptom
The ModelArts training job failed to parse parameters, and the following error occurs:
error: unrecognized arguments: --data_url=xxx://xxx/xxx
absl.flags._exceptions.UnrecognizedFlagError:Unknown command line flag 'task_index'
Possible Cause
In the training environment, the system may transfer other parameter names that are not defined in the Python script. As a result, the parameters failed to be parsed, and an error occurs in the log.
Solution
Replace args = parser.parse_args() with the args, unparsed = parser.parse_known_args() parsing method. The following is a code example.
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--data_url', type=str, default=None, help='obs path of dataset')
args, unparsed = parser.parse_known_args()
Parent topic: In-Cloud Migration Adaptation Issues