Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
曾经的那一瞬间
Models
提交
3421f8c6
M
Models
项目概览
曾经的那一瞬间
/
Models
大约 1 年 前同步成功
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
Models
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
3421f8c6
编写于
10月 26, 2020
作者:
H
Hongkun Yu
提交者:
A. Unique TensorFlower
10月 26, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Internal change
PiperOrigin-RevId: 339113572
上级
b95fa6e1
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
184 addition
and
3 deletion
+184
-3
official/common/registry_imports.py
official/common/registry_imports.py
+2
-2
official/nlp/configs/__init__.py
official/nlp/configs/__init__.py
+17
-1
official/nlp/configs/experiments/glue_mnli_matched.yaml
official/nlp/configs/experiments/glue_mnli_matched.yaml
+49
-0
official/nlp/configs/finetuning_experiments.py
official/nlp/configs/finetuning_experiments.py
+100
-0
official/nlp/configs/models/bert_en_uncased_base.yaml
official/nlp/configs/models/bert_en_uncased_base.yaml
+16
-0
未找到文件。
official/common/registry_imports.py
浏览文件 @
3421f8c6
...
...
@@ -13,8 +13,8 @@
# limitations under the License.
# ==============================================================================
"""All necessary imports for registration."""
# pylint: disable=unused-import
from
official.nlp
import
tasks
as
nlp_task
from
official.nlp
import
configs
from
official.nlp
import
tasks
from
official.utils.testing
import
mock_task
from
official.vision
import
beta
official/nlp/configs/__init__.py
浏览文件 @
3421f8c6
# Lint as: python3
# Copyright 2020 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""Configs package definition."""
from
official.nlp.configs
import
finetuning_experiments
official/nlp/configs/experiments/glue_mnli_matched.yaml
0 → 100644
浏览文件 @
3421f8c6
task
:
hub_module_url
:
'
'
model
:
num_classes
:
3
init_checkpoint
:
'
'
metric_type
:
'
accuracy'
train_data
:
drop_remainder
:
true
global_batch_size
:
32
input_path
:
'
'
is_training
:
true
seq_length
:
128
label_type
:
'
int'
validation_data
:
drop_remainder
:
false
global_batch_size
:
32
input_path
:
'
'
is_training
:
false
seq_length
:
128
label_type
:
'
int'
trainer
:
checkpoint_interval
:
3000
optimizer_config
:
learning_rate
:
polynomial
:
# 100% of train_steps.
decay_steps
:
36813
end_learning_rate
:
0.0
initial_learning_rate
:
3.0e-05
power
:
1.0
type
:
polynomial
optimizer
:
type
:
adamw
warmup
:
polynomial
:
power
:
1
# ~10% of train_steps.
warmup_steps
:
3681
type
:
polynomial
steps_per_loop
:
1000
summary_interval
:
1000
# Training data size 392,702 examples, 3 epochs.
train_steps
:
36813
validation_interval
:
6135
# Eval data size = 9815 examples.
validation_steps
:
307
best_checkpoint_export_subdir
:
'
best_ckpt'
best_checkpoint_eval_metric
:
'
cls_accuracy'
best_checkpoint_metric_comp
:
'
higher'
official/nlp/configs/finetuning_experiments.py
0 → 100644
浏览文件 @
3421f8c6
# Copyright 2020 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""Finetuning experiment configurations."""
# pylint: disable=g-doc-return-or-yield,line-too-long
from
official.core
import
config_definitions
as
cfg
from
official.core
import
exp_factory
from
official.modeling
import
optimization
from
official.nlp.data
import
question_answering_dataloader
from
official.nlp.data
import
sentence_prediction_dataloader
from
official.nlp.tasks
import
question_answering
from
official.nlp.tasks
import
sentence_prediction
@
exp_factory
.
register_config_factory
(
'bert/sentence_prediction'
)
def
bert_sentence_prediction
()
->
cfg
.
ExperimentConfig
:
r
"""BERT GLUE."""
config
=
cfg
.
ExperimentConfig
(
task
=
sentence_prediction
.
SentencePredictionConfig
(
train_data
=
sentence_prediction_dataloader
.
SentencePredictionDataConfig
(),
validation_data
=
sentence_prediction_dataloader
.
SentencePredictionDataConfig
(
is_training
=
False
,
drop_remainder
=
False
)),
trainer
=
cfg
.
TrainerConfig
(
optimizer_config
=
optimization
.
OptimizationConfig
({
'optimizer'
:
{
'type'
:
'adamw'
,
'adamw'
:
{
'weight_decay_rate'
:
0.01
,
'exclude_from_weight_decay'
:
[
'LayerNorm'
,
'layer_norm'
,
'bias'
],
}
},
'learning_rate'
:
{
'type'
:
'polynomial'
,
'polynomial'
:
{
'initial_learning_rate'
:
3e-5
,
'end_learning_rate'
:
0.0
,
}
},
'warmup'
:
{
'type'
:
'polynomial'
}
})),
restrictions
=
[
'task.train_data.is_training != None'
,
'task.validation_data.is_training != None'
])
config
.
task
.
model
.
encoder
.
type
=
'bert'
return
config
@
exp_factory
.
register_config_factory
(
'bert/squad'
)
def
bert_squad
()
->
cfg
.
ExperimentConfig
:
"""BERT Squad V1/V2."""
config
=
cfg
.
ExperimentConfig
(
task
=
question_answering
.
QuestionAnsweringConfig
(
train_data
=
question_answering_dataloader
.
QADataConfig
(),
validation_data
=
question_answering_dataloader
.
QADataConfig
()),
trainer
=
cfg
.
TrainerConfig
(
optimizer_config
=
optimization
.
OptimizationConfig
({
'optimizer'
:
{
'type'
:
'adamw'
,
'adamw'
:
{
'weight_decay_rate'
:
0.01
,
'exclude_from_weight_decay'
:
[
'LayerNorm'
,
'layer_norm'
,
'bias'
],
}
},
'learning_rate'
:
{
'type'
:
'polynomial'
,
'polynomial'
:
{
'initial_learning_rate'
:
8e-5
,
'end_learning_rate'
:
0.0
,
}
},
'warmup'
:
{
'type'
:
'polynomial'
}
})),
restrictions
=
[
'task.train_data.is_training != None'
,
'task.validation_data.is_training != None'
])
config
.
task
.
model
.
encoder
.
type
=
'bert'
return
config
official/nlp/configs/models/bert_en_uncased_base.yaml
0 → 100644
浏览文件 @
3421f8c6
task
:
model
:
encoder
:
type
:
bert
bert
:
attention_dropout_rate
:
0.1
dropout_rate
:
0.1
hidden_activation
:
gelu
hidden_size
:
768
initializer_range
:
0.02
intermediate_size
:
3072
max_position_embeddings
:
512
num_attention_heads
:
12
num_layers
:
12
type_vocab_size
:
2
vocab_size
:
30522
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录