def setup(self, stage: str) -> None:
        """Setup WinCLIP model.

        This method:
        - Sets the class name used in the prompt ensemble
        - Collects text embeddings for zero-shot inference
        - Collects reference images for few-shot inference if ``k_shot > 0``

        Note:
            This hook is called before the model is moved to the target device.
        """
        del stage
        if self.is_setup:
            return

        # get class name
        self.class_name = self._get_class_name()
        ref_images = None

        # get reference images
        if self.k_shot:
            if self.few_shot_source:
                logger.info("Loading reference images from %s", self.few_shot_source)
                reference_dataset = PredictDataset(
                    self.few_shot_source,
                    transform=self.pre_processor.test_transform if self.pre_processor else None,
                )
                dataloader = DataLoader(reference_dataset, batch_size=1, shuffle=False)
            else:
                logger.info("Collecting reference images from training dataset")
                dataloader = self.trainer.datamodule.train_dataloader()

            ref_images = self.collect_reference_images(dataloader)

        # call setup to initialize the model
        self.model.setup(self.class_name, ref_images)
        self.is_setup = True
Setup WinCLIP model.

        This method:
        - Sets the class name used in the prompt ensemble
        - Collects text embeddings for zero-shot inference
        - Collects reference images for few-shot inference if ``k_shot > 0``

        Note:
            This hook is called before the model is moved to the target device.
        
src/anomalib/models/image/winclip/lightning_model.py