pytorch passing architecture type with argprse
Using Pytorch. When passing architecture type by using the following code:

parser.add_argument('-arch', action='store',
                    dest='arch',
                    default= str('vgg16'))


When using the name of the architecture with the following code:

model = models.__dict__['{!r}'.format(results.arch)](pretrained=True)


I get the following error:


  model = models.dict'{!r}'.format(results.arch)
  KeyError: "'vgg16'"


What am I doing wrong?

You got KeyError meaning your imported models do not include 'vgg16' as one of the known models.
Check what models you do have by printing

print(models.__dict__.keys())


This should allow you to know what models you import and which are missing, then you can look into your imports and see where 'vgg16' got lost.
