Why the error information "unrecognized arguments" return?
When I tried to use ArgumentParser() class to define the argument &quot;epochs&quot; as the training epoch of my CNN model with PyTorch, the system informed me this error. This is my code block:
# 2.1 define super arguments (training epochs for example)

import argparse
parser = argparse.ArgumentParser()
parser.add_argument('-e', '--epochs', default=10, type=int, 
                    help='number of epochs to train the VAE for')
args = vars(parser.parse_args())

epochs = args['epochs']

When I executed it, the error was thrown out as:
usage: ipykernel_launcher.py [-h] [-e EPOCHS]
ipykernel_launcher.py: error: unrecognized arguments: -f /root/.local/share/jupyter/runtime/kernel-ae55ea85-75ab-4308-8b6a-3319e5b09a40.json
An exception has occurred, use %tb to see the full traceback.

SystemExit: 2

I do not know what this error information means and how to fix it. I never made any extra arguments with the prompt &quot;-f&quot;. How can I deal with this error? Many thanks!!

From your error message, I guess you are running the code in the jupyter notebook environment.
In jupyter notebook, if you want to use argparse, please modify the code to the following form：
args = vars(parser.parse_args(args=[]))
