fix(attention_visualizer): add default value for image_seq_length (#38577)

This commit is contained in:
5pipeline 2025-06-04 20:20:31 +08:00 committed by GitHub
parent 1dc619e59f
commit 82fa68ca14
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -178,6 +178,7 @@ class AttentionMaskVisualizer:
def visualize_attention_mask(self, input_sentence: str, suffix=""):
model = self.model
kwargs = {}
image_seq_length = None
if self.config.model_type in PROCESSOR_MAPPING_NAMES:
img = "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/bee.jpg?download=true"
img = Image.open(requests.get(img, stream=True).raw)