Browse Source

fixing a error in configs and main

master
Faeze 2 years ago
parent
commit
aed56fb7ef
3 changed files with 26 additions and 23 deletions
  1. 11
    7
      data/twitter/config.py
  2. 12
    9
      data/weibo/config.py
  3. 3
    7
      main.py

+ 11
- 7
data/twitter/config.py View File

batch_size = 128 batch_size = 128
epochs = 100 epochs = 100
num_workers = 2 num_workers = 2
head_lr = 1e-03
image_encoder_lr = 1e-04
text_encoder_lr = 1e-04
head_lr = 0.0254
image_encoder_lr = 0.0005
text_encoder_lr = 2.0e-05
attention_lr = 1e-3 attention_lr = 1e-3
classification_lr = 1e-03
classification_lr = 0.0034


head_weight_decay = 0.001
attention_weight_decay = 0.001
classification_weight_decay = 0.001
dropout = 0.5
hidden_size = 128
projection_size = 64

head_weight_decay = 0.05
attention_weight_decay = 0.05
classification_weight_decay = 0.05


device = torch.device("cuda:1" if torch.cuda.is_available() else "cpu") device = torch.device("cuda:1" if torch.cuda.is_available() else "cpu")



+ 12
- 9
data/weibo/config.py View File

import torch import torch
from transformers import BertTokenizer, BertModel, BertConfig


from data.config import Config from data.config import Config
from data.weibo.data_loader import WeiboDatasetLoader from data.weibo.data_loader import WeiboDatasetLoader
batch_size = 100 batch_size = 100
epochs = 100 epochs = 100
num_workers = 1 num_workers = 1
head_lr = 1e-03
image_encoder_lr = 1e-02
text_encoder_lr = 1e-05
weight_decay = 0.001
classification_lr = 1e-02
head_lr = 0.0085
image_encoder_lr = 1.0e-05
text_encoder_lr = 0.00016
weight_decay = 0.00015
classification_lr = 0.00149


device = torch.device("cuda:1" if torch.cuda.is_available() else "cpu")
hidden_size = 128
projection_size = 64
dropout = 0.5

device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")


image_model_name = '../../../../../media/external_10TB/10TB/ghorbanpoor/vit-base-patch16-224' image_model_name = '../../../../../media/external_10TB/10TB/ghorbanpoor/vit-base-patch16-224'
image_embedding = 768 image_embedding = 768
text_encoder_model = "../../../../../media/external_10TB/10TB/ghorbanpoor/xlnet-base-chinese"
text_encoder_model = "../../../../../media/external_10TB/10TB/ghorbanpoor/bert-base-chinese"
# text_encoder_model = "/home/faeze/PycharmProjects/new_fake_news_detectioin/bert/bert-base-uncased" # text_encoder_model = "/home/faeze/PycharmProjects/new_fake_news_detectioin/bert/bert-base-uncased"
text_tokenizer = "../../../../../media/external_10TB/10TB/ghorbanpoor/xlnet-base-chinese"
text_tokenizer = "../../../../../media/external_10TB/10TB/ghorbanpoor/bert-base-chinese"
# text_tokenizer = "/home/faeze/PycharmProjects/new_fake_news_detectioin/bert/bert-base-uncased" # text_tokenizer = "/home/faeze/PycharmProjects/new_fake_news_detectioin/bert/bert-base-uncased"
text_embedding = 768 text_embedding = 768
max_length = 200 max_length = 200

+ 3
- 7
main.py View File

else: else:
config.output_path += 'logs/' + args.data + '_' + str(args.extra) config.output_path += 'logs/' + args.data + '_' + str(args.extra)


use_optuna = True
if not args.extra or 'temp' in args.extra:
config.output_path = str(args.extra)
use_optuna = False


make_directory(config.output_path) make_directory(config.output_path)


# config.writer = SummaryWriter(config.output_path) # config.writer = SummaryWriter(config.output_path)


if args.use_optuna and use_optuna:
if args.use_optuna is not None:
optuna_main(config, args.use_optuna) optuna_main(config, args.use_optuna)
elif args.just_test:
elif args.just_test is not None:
test_main(config, args.just_test) test_main(config, args.just_test)
elif args.use_lime:
elif args.use_lime is not None:
lime_main(config, args.use_lime) lime_main(config, args.use_lime)
else: else:
torch_main(config) torch_main(config)

Loading…
Cancel
Save