INNER CODE UNIT · Python

FashionCLIP

patrickjohncyh/fashion-clip · fashion_clip/fashion_clip.py:95

class FashionCLIP:
    """
    FashionCLIP class takes:
        1. FCLIPModel Name / Path
        2. FCLIPDataset
    Then, it generates required embeddings based on the dataset
    OR if a pre-processed versions exists then pull it from S3?
    Need a reliable method of determining if pre-processed version exists -- use hash of the dataset_model?
    """

    def __init__(self, model_name, dataset: FCLIPDataset = None, normalize=True, approx=True, auth_token=None):
        self.device = "cuda" if torch.cuda.is_available() else "mps" if torch.mps.is_available() else "cpu"
        self.model_name = model_name
        self.model, self.preprocess, self.model_hash = self._load_model(model_name, auth_token=auth_token)
        self.model = self.model.to(self.device)
        self.dataset = dataset
        if self.dataset:
            self.dataset_hash = self.dataset.hash()

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…