Problem in passing value to parser argument
Running my code including this line:
def parse_args():
    parser = argparse.ArgumentParser(description='test with parser')
    parser.add_argument(&quot;--model&quot;, type=str, default= &quot;E:\Script\weights\resnext101.pth&quot;)

I got this error:
OSError: [Errno 22] Invalid argument: 'E:\\Script\\weights\resnext101.pth'

What is the error for and how I can fix it?

You aren't passing a path ending with the name resnext101.pth; you are passing a path ending with the name weights␍esnext101.pth, which contains a literal carriage return.
Use a raw string literal to protect all backslashes from expansion, regardless of the character that follows the backslash.
parser.add_argument(&quot;--model&quot;, type=str, default= r&quot;E:\Script\weights\resnext101.pth&quot;)

