jpterry commited on
Commit
e2e3f07
·
1 Parent(s): 9441457

added automodelimage

Browse files
Files changed (1) hide show
  1. app.py +17 -16
app.py CHANGED
@@ -253,22 +253,23 @@ def predict_and_analyze(model_name, num_channels, dim, input_channel, image):
253
  # model = EfficientNetPreTrained.from_pretrained(model_loading_name)
254
  # model = AutoModel.from_pretrained(model_loading_name, trust_remote_code=True)
255
 
256
- model = EfficientNet(dropout=hparams.dropout,
257
- num_channels=hparams.num_channels,
258
- num_classes=hparams.num_classes,
259
- size=hparams.size,
260
- stochastic_depth_prob=hparams.stochastic_depth_prob,
261
- width_mult=hparams.width_mult,
262
- depth_mult=hparams.depth_mult,)
263
-
264
- model_url = cached_download(hf_hub_url(model_loading_name, filename="pytorch_model.bin"))
265
- print(model_url)
266
-
267
- loaded = torch.load(model_url, map_location='cpu')
268
- print(loaded)
269
-
270
- model.load_state_dict(loaded)
271
- print(model)
 
272
 
273
  # model = EfficientNetPreTrained(config)
274
  # config.register_for_auto_class()
 
253
  # model = EfficientNetPreTrained.from_pretrained(model_loading_name)
254
  # model = AutoModel.from_pretrained(model_loading_name, trust_remote_code=True)
255
 
256
+ model = AutoModelForImageClassification.from_pretrained(model_loading_name)
257
+
258
+ # model = EfficientNet(dropout=hparams.dropout,
259
+ # num_channels=hparams.num_channels,
260
+ # num_classes=hparams.num_classes,
261
+ # size=hparams.size,
262
+ # stochastic_depth_prob=hparams.stochastic_depth_prob,
263
+ # width_mult=hparams.width_mult,
264
+ # depth_mult=hparams.depth_mult,)
265
+ # model_url = cached_download(hf_hub_url(model_loading_name, filename="pytorch_model.bin"))
266
+ # print(model_url)
267
+
268
+ # loaded = torch.load(model_url, map_location='cpu')
269
+ # print(loaded)
270
+
271
+ # model.load_state_dict(loaded)
272
+ # print(model)
273
 
274
  # model = EfficientNetPreTrained(config)
275
  # config.register_for_auto_class()