<jupyter_start><jupyter_text>![image.png](attachment:7a9d7eee-5602-4ddf-b21d-6cdbc5c903ba.png)<jupyter_code># 加上图片信息
config["use_img"] = True
config
train_set, valid_set, test_set = load_glove_vgg_data(split811data, config)
Counter(train_set.y), Counter(valid_set.y), Counter(test_set.y)
batch_size = 128
workers = 2
train_loader, valid_loader, test_loader = get_loader(batch_size, workers, collate_fn, train_set, valid_set, test_set)
model = Model(config).cuda()
loss = nn.CrossEntropyLoss()
model, get_parameter_number(model), loss
y_true, y_pred, _loss = predict(model, valid_loader, loss)
evalute(y_true, y_pred), Counter(y_pred)
%%time
_interval = 5
lr = 1e-3
epoches = 50
stoping_step = 10
optimizer = get_regal_optimizer(model, optim.AdamW, lr)

viz = get_Visdom()
batch_loss_drawer = VisdomScalar(viz, f"batch_loss interval:{_interval}")
epoch_loss_drawer = VisdomScalar(viz, f"Train and valid loss", 2)
acc_drawer = VisdomScalar(viz, "Train and valid accuracy", 2)
text_writer = VisdomTextWriter(viz, "Training")

batch_loss = []
train_loss = []
valid_loss = []
train_acc = []
valid_acc = []

res, model = train_visdom_v2(model, optimizer, loss, viz, train_loader,
                          valid_loader, epoches, batch_loss, batch_loss_drawer,
                          train_loss, valid_loss, epoch_loss_drawer,
                          train_acc, valid_acc, acc_drawer, text_writer,
                         _interval=_interval, early_stop=stoping_step)
res
eval_model(model, test_loader, loss)<jupyter_output>/home/ly/miniconda3/envs/torch1.6.0/lib/python3.7/site-packages/torch/nn/modules/rnn.py:738: UserWarning: RNN module weights are not part of single contiguous chunk of memory. This means they need to be compacted at every call, possibly greatly increasing memory usage. To compact weights again call flatten_parameters(). (Triggered internally at  /opt/conda/conda-bld/pytorch_1595629427478/work/aten/src/ATen/native/cudnn/RNN.cpp:1234.)
  self.num_layers, self.dropout, self.training, self.bidirectional)
{'fraction_non_alphanumeric': 0.10848126232741617, 'fraction_numerical': 0.028599605522682446, 'mean_word_length': 5.002958579881657, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '415403', 'license': 'MIT', 'n_tokens_mistral': 763, 'n_tokens_neox': 725, 'n_words': 149, 'path': 'experiments/bigru_vgg_1.ipynb', 'repo_name': 'yang-233/mmsa', 'size': '2028'}