Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
曾经的那一瞬间
Models
提交
2b804387
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,发现更多精彩内容 >>
提交
2b804387
编写于
4月 13, 2023
作者:
N
Neel Kovelamudi
提交者:
A. Unique TensorFlower
4月 13, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fixes improper serialization code route for functional models.
PiperOrigin-RevId: 524097977
上级
6a6ed34d
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
9 addition
and
3 deletion
+9
-3
official/nlp/modeling/layers/position_embedding.py
official/nlp/modeling/layers/position_embedding.py
+1
-1
official/nlp/modeling/layers/transformer_scaffold_test.py
official/nlp/modeling/layers/transformer_scaffold_test.py
+1
-1
official/projects/mosaic/qat/modeling/factory.py
official/projects/mosaic/qat/modeling/factory.py
+1
-0
official/projects/qat/vision/modeling/factory.py
official/projects/qat/vision/modeling/factory.py
+5
-0
official/vision/modeling/layers/nn_blocks_test.py
official/vision/modeling/layers/nn_blocks_test.py
+1
-1
未找到文件。
official/nlp/modeling/layers/position_embedding.py
浏览文件 @
2b804387
...
...
@@ -72,7 +72,7 @@ class PositionEmbedding(tf.keras.layers.Layer):
return
dict
(
list
(
base_config
.
items
())
+
list
(
config
.
items
()))
def
build
(
self
,
input_shape
):
dimension_list
=
input_shape
.
as_list
()
dimension_list
=
input_shape
width
=
dimension_list
[
-
1
]
weight_sequence_length
=
self
.
_max_length
...
...
official/nlp/modeling/layers/transformer_scaffold_test.py
浏览文件 @
2b804387
...
...
@@ -56,7 +56,7 @@ class ValidatedFeedforwardLayer(tf.keras.layers.Layer):
self
.
activation
=
activation
def
build
(
self
,
input_shape
):
hidden_size
=
input_shape
.
as_list
()
[
-
1
]
hidden_size
=
input_shape
[
-
1
]
self
.
_feedforward_dense
=
tf
.
keras
.
layers
.
EinsumDense
(
'...x,xy->...y'
,
output_shape
=
hidden_size
,
...
...
official/projects/mosaic/qat/modeling/factory.py
浏览文件 @
2b804387
...
...
@@ -54,6 +54,7 @@ def build_qat_mosaic_model(
'L2'
:
tf
.
keras
.
regularizers
.
l2
,
}
model
.
use_legacy_config
=
True
# Ensures old Keras serialization format
# Apply QAT to backbone (a tf.keras.Model) first, and then neck and head.
with
tfmot
.
quantization
.
keras
.
quantize_scope
(
scope_dict
):
annotated_backbone
=
tfmot
.
quantization
.
keras
.
quantize_annotate_model
(
...
...
official/projects/qat/vision/modeling/factory.py
浏览文件 @
2b804387
...
...
@@ -104,11 +104,13 @@ def build_qat_classification_model(
return
tfmot
.
quantization
.
keras
.
quantize_annotate_layer
(
layer
)
return
layer
backbone_optimized_model
.
use_legacy_config
=
True
annotated_model
=
tf
.
keras
.
models
.
clone_model
(
backbone_optimized_model
,
clone_function
=
apply_quantization_to_dense
,
)
annotated_model
.
use_legacy_config
=
True
if
quantization
.
change_num_bits
:
optimized_model
=
tfmot
.
quantization
.
keras
.
quantize_apply
(
annotated_model
,
...
...
@@ -236,6 +238,7 @@ def build_qat_segmentation_model(
'L2'
:
tf
.
keras
.
regularizers
.
l2
,
}
model
.
use_legacy_config
=
True
# Ensures old Keras serialization format
# Apply QAT to backbone (a tf.keras.Model) first.
with
tfmot
.
quantization
.
keras
.
quantize_scope
(
scope_dict
):
annotated_backbone
=
tfmot
.
quantization
.
keras
.
quantize_annotate_model
(
...
...
@@ -259,10 +262,12 @@ def build_qat_segmentation_model(
return
tfmot
.
quantization
.
keras
.
quantize_annotate_layer
(
layer
)
return
layer
backbone_optimized_model
.
use_legacy_config
=
True
annotated_model
=
tf
.
keras
.
models
.
clone_model
(
backbone_optimized_model
,
clone_function
=
apply_quantization_to_layers
,
)
annotated_model
.
use_legacy_config
=
True
optimized_model
=
tfmot
.
quantization
.
keras
.
quantize_apply
(
annotated_model
,
scheme
=
schemes
.
Default8BitQuantizeScheme
())
...
...
official/vision/modeling/layers/nn_blocks_test.py
浏览文件 @
2b804387
...
...
@@ -431,7 +431,7 @@ class ValidatedFeedforwardLayer(tf.keras.layers.Layer):
self
.
activation
=
activation
def
build
(
self
,
input_shape
):
hidden_size
=
input_shape
.
as_list
()
[
-
1
]
hidden_size
=
input_shape
[
-
1
]
self
.
_feedforward_dense
=
tf
.
keras
.
layers
.
EinsumDense
(
'...x,xy->...y'
,
output_shape
=
hidden_size
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录