import torch from data.config import Config from data.twitter.data_loader import TwitterDatasetLoader class TwitterConfig(Config): name = 'twitter' DatasetLoader = TwitterDatasetLoader data_path = '/twitter/' output_path = '' train_image_path = data_path + 'images_train/' validation_image_path = data_path + 'images_validation/' test_image_path = data_path + 'images_test/' train_text_path = data_path + 'twitter_train_translated.csv' validation_text_path = data_path + 'twitter_validation_translated.csv' test_text_path = data_path + 'twitter_test_translated.csv' batch_size = 128 epochs = 100 num_workers = 2 head_lr = 1e-03 image_encoder_lr = 1e-04 text_encoder_lr = 1e-04 attention_lr = 1e-3 classification_lr = 1e-03 head_weight_decay = 0.001 attention_weight_decay = 0.001 classification_weight_decay = 0.001 device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu") image_model_name = 'vit-base-patch16-224' image_embedding = 768 text_encoder_model = "bert-base-uncased" text_tokenizer = "bert-base-uncased" text_embedding = 768 max_length = 32 pretrained = True trainable = False temperature = 1.0 classes = ['real', 'fake'] class_weights = [1, 1] wanted_accuracy = 0.76 def optuna(self, trial): self.head_lr = trial.suggest_loguniform('head_lr', 1e-5, 1e-1) self.image_encoder_lr = trial.suggest_loguniform('image_encoder_lr', 1e-6, 1e-3) self.text_encoder_lr = trial.suggest_loguniform('text_encoder_lr', 1e-6, 1e-3) self.classification_lr = trial.suggest_loguniform('classification_lr', 1e-5, 1e-1) self.head_weight_decay = trial.suggest_loguniform('head_weight_decay', 1e-5, 1e-1) # self.attention_weight_decay = trial.suggest_loguniform('attention_weight_decay', 1e-5, 1e-1) self.classification_weight_decay = trial.suggest_loguniform('classification_weight_decay', 1e-5, 1e-1) # self.projection_size = trial.suggest_categorical('projection_size', [256, 128, 64]) # self.hidden_size = trial.suggest_categorical('hidden_size', [256, 128, 64, ]) # self.dropout = trial.suggest_categorical('drop_out', [0.1, 0.3, 0.5, ])