pawlo2013 commited on
Commit
2a60a24
·
1 Parent(s): 770f882

fix the None error

Browse files
Files changed (1) hide show
  1. app.py +4 -0
app.py CHANGED
@@ -85,6 +85,10 @@ def show_final_layer_attention_maps(
85
  # Forward pass through the model
86
  outputs = model(**tensor, output_attentions=True)
87
 
 
 
 
 
88
  # Scale image to [0, 1]
89
  image = image - image.min()
90
  image = image / image.max()
 
85
  # Forward pass through the model
86
  outputs = model(**tensor, output_attentions=True)
87
 
88
+ if outputs.attentions is None:
89
+ print("Attention outputs are None.")
90
+ return None
91
+
92
  # Scale image to [0, 1]
93
  image = image - image.min()
94
  image = image / image.max()