加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
config.py 1.60 KB
一键复制 编辑 原始数据 按行查看 历史
fengquanli 提交于 2021-01-06 05:08 . original
class GPT2Config(object):
def __init__(
self,
vocab_size_or_config_json_file=12491,
n_positions=1024,
n_ctx=512,
n_embd=768,
n_layer=6,
n_head=6,
layer_norm_epsilon=1e-5,
initializer_range=0.02,
):
self.vocab_size = vocab_size_or_config_json_file
self.n_ctx = n_ctx
self.n_positions = n_positions
self.n_embd = n_embd
self.n_layer = n_layer
self.n_head = n_head
self.layer_norm_epsilon = layer_norm_epsilon
self.initializer_range = initializer_range
class TransformerConfig(object):
def __init__(
self,
d_model=768,
n_layers=12,
heads=12,
dropout=0.0,
load_weights='weights'
):
self.d_model = d_model
self.n_layers = n_layers
self.heads = heads
self.dropout = dropout
self.load_weights = load_weights
class GPT2Config(object):
def __init__(
self,
vocab_size_or_config_json_file=12491,
n_positions=1024,
n_ctx=1024,
n_embd=768,
n_layer=12,
n_head=12,
layer_norm_epsilon=1e-5,
initializer_range=0.02,
):
self.vocab_size = vocab_size_or_config_json_file
self.n_ctx = n_ctx
self.n_positions = n_positions
self.n_embd = n_embd
self.n_layer = n_layer
self.n_head = n_head
self.layer_norm_epsilon = layer_norm_epsilon
self.initializer_range = initializer_range
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化