Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

error: unrecognized arguments: - pytorch code in colab

I tried to run my code on google colab. but I get this message (error: unrecognized arguments)when I'm trying to call this function :

def parse_opts():
 parser = argparse.ArgumentParser()
 parser.add_argument(
     '--root_path',
     default='/root/data/ActivityNet',
     type=str,
     help='Root directory path of data')
  parser.add_argument(
     '--video_path',
     default='video_kinetics_jpg',
     type=str,
     help='Directory path of Videos')
 args = parser.parse_args()

return args

but this is failed and I get this error

tester_video.py: error: unrecognized arguments: cifar_comp_20_200_0.01_0.1 20 10 0.01 0.1

I tried to use Easydict but it seems its not working thinks

like image 706
Daniel Afrimi Avatar asked May 03 '26 15:05

Daniel Afrimi


1 Answers

The problem only appears in Jupyter notebook/lab/colab.

Change

args = parser.parse_args()

to

args = parser.parse_args(args=[])

and it should fix it.

like image 91
Joe Zhou Avatar answered May 06 '26 12:05

Joe Zhou



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!