github-actions[bot] commited on
Commit
4645abc
·
1 Parent(s): b4a3b1c

Deploy from GitHub - 2026-01-19 08:03:59

Browse files
Files changed (1) hide show
  1. app.py +5 -7
app.py CHANGED
@@ -513,15 +513,13 @@ class TransformerNet(nn.Module):
513
  if not mapped:
514
  mapped_state_dict[name] = v
515
 
516
- # Map .weight/.bias to .gamma/.beta for InstanceNorm
 
517
  final_state_dict = {}
518
  for key, value in mapped_state_dict.items():
519
- if key.endswith('.norm.weight'):
520
- final_state_dict[key[:-6] + 'gamma'] = value
521
- elif key.endswith('.norm.bias'):
522
- final_state_dict[key[:-5] + '.beta'] = value
523
- else:
524
- final_state_dict[key] = value
525
 
526
  self.load_state_dict(final_state_dict, strict=False)
527
 
 
513
  if not mapped:
514
  mapped_state_dict[name] = v
515
 
516
+ # Filter out running_mean and running_var (BatchNorm params not needed for InstanceNorm)
517
+ # Keep .weight and .bias as-is since InstanceNorm uses these names
518
  final_state_dict = {}
519
  for key, value in mapped_state_dict.items():
520
+ if key.endswith('.running_mean') or key.endswith('.running_var'):
521
+ continue # Skip BatchNorm-specific parameters
522
+ final_state_dict[key] = value
 
 
 
523
 
524
  self.load_state_dict(final_state_dict, strict=False)
525