Spaces:
Running
Running
fix the None error
Browse files
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()
|