INNER CODE UNIT · Python

hash

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

    def hash(self):
        id_hash = self._hash_list(self.ids)
        images_hash = self._hash_list(self.images)
        caption_hash = self._hash_list(self.captions)
        return hashlib.sha256((id_hash+images_hash+caption_hash).encode()).hexdigest()

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"

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…