Skip to content

Commit 49def20

Browse files
Fix timm conversion for rersnet (#1814)
1 parent dbaeabd commit 49def20

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

keras_nlp/src/utils/timm/convert_resnet.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ def convert_backbone_config(timm_config):
5656
stackwise_num_strides=[1, 2, 2, 2],
5757
block_type=block_type,
5858
use_pre_activation=use_pre_activation,
59+
input_conv_filters=[64],
60+
input_conv_kernel_sizes=[7],
5961
)
6062

6163

@@ -100,10 +102,10 @@ def port_batch_normalization(keras_layer_name, hf_weight_prefix):
100102
for stack_index in range(num_stacks):
101103
for block_idx in range(backbone.stackwise_num_blocks[stack_index]):
102104
if version == "v1":
103-
keras_name = f"v1_stack{stack_index}_block{block_idx}"
105+
keras_name = f"stack{stack_index}_block{block_idx}"
104106
hf_name = f"layer{stack_index+1}.{block_idx}"
105107
else:
106-
keras_name = f"v2_stack{stack_index}_block{block_idx}"
108+
keras_name = f"stack{stack_index}_block{block_idx}"
107109
hf_name = f"stages.{stack_index}.blocks.{block_idx}"
108110

109111
if version == "v1":

0 commit comments

Comments
 (0)