-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathargs.py
More file actions
23 lines (21 loc) · 1.13 KB
/
args.py
File metadata and controls
23 lines (21 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import torch
class Config(object):
"""配置参数"""
def __init__(self):
self.model_name = 'Transformer'
self.embedding_pretrained = None # 预训练词向量
self.device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu') # 设备
self.dropout = 0.5 # 随机失活
self.num_classes = 14 # 类别数
self.num_epochs = 20 # epoch数
self.batch_size = 128 # mini-batch大小
self.pad_size = 256 # 每句话处理成的长度(短填长切)
self.n_vocab = None#这里需要读取数据的部分进行赋值
self.learning_rate = 5e-4 # 学习率
self.embed = 300 # 词向量维度
self.dim_model = 300
self.hidden = 1024
self.last_hidden = 512
self.num_head = 5
self.num_encoder = 2
self.n_splits = 5#k折交叉验证