Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
ee6e71e2
Unverified
Commit
ee6e71e2
authored
Feb 22, 2023
by
Sylvain Gugger
Browse files
Fix quality
parent
24b930ad
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
4 deletions
+4
-4
pyproject.toml
pyproject.toml
+1
-1
src/transformers/models/efficientnet/convert_efficientnet_to_pytorch.py
...rs/models/efficientnet/convert_efficientnet_to_pytorch.py
+2
-2
src/transformers/models/gptsan_japanese/modeling_gptsan_japanese.py
...ormers/models/gptsan_japanese/modeling_gptsan_japanese.py
+1
-1
No files found.
pyproject.toml
View file @
ee6e71e2
...
...
@@ -4,7 +4,7 @@ target-version = ['py37']
[tool.ruff]
# Never enforce `E501` (line length violations).
ignore
=
[
"E501"
,
"E741"
,
"W605"
]
ignore
=
[
"C901"
,
"E501"
,
"E741"
,
"W605"
]
select
=
[
"C"
,
"E"
,
"F"
,
"I"
,
"W"
]
line-length
=
119
...
...
src/transformers/models/efficientnet/convert_efficientnet_to_pytorch.py
View file @
ee6e71e2
...
...
@@ -160,7 +160,7 @@ def convert_image_processor(model_name):
# here we list all keys to be renamed (original name on the left, our name on the right)
def
rename_keys
(
original_param_names
):
block_names
=
[
v
.
split
(
"_"
)[
0
].
split
(
"block"
)[
1
]
for
v
in
original_param_names
if
v
.
startswith
(
"block"
)]
block_names
=
sorted
(
list
(
set
(
block_names
))
)
block_names
=
sorted
(
set
(
block_names
))
num_blocks
=
len
(
block_names
)
block_name_mapping
=
{
b
:
str
(
i
)
for
b
,
i
in
zip
(
block_names
,
range
(
num_blocks
))}
...
...
@@ -267,7 +267,7 @@ def convert_efficientnet_checkpoint(model_name, pytorch_dump_folder_path, save_m
tf_params
=
{
param
.
name
:
param
.
numpy
()
for
param
in
tf_params
}
for
param
in
tf_non_train_params
:
tf_params
[
param
.
name
]
=
param
.
numpy
()
tf_param_names
=
[
k
for
k
in
tf_params
.
keys
()
]
tf_param_names
=
list
(
tf_params
.
keys
()
)
# Load HuggingFace model
config
=
get_efficientnet_config
(
model_name
)
...
...
src/transformers/models/gptsan_japanese/modeling_gptsan_japanese.py
View file @
ee6e71e2
...
...
@@ -1029,7 +1029,7 @@ class GPTSanJapaneseModel(GPTSanJapanesePreTrainedModel):
)
# n_layer x batch x n_heads x N x N
# outputs
present_key_value_states
=
tuple
()
if
self
.
config
.
use_cache
or
use_cache
else
None
present_key_value_states
=
()
if
self
.
config
.
use_cache
or
use_cache
else
None
all_hidden_states
=
()
if
self
.
config
.
output_hidden_states
or
output_hidden_states
else
None
all_attentions
=
()
if
self
.
config
.
output_attentions
or
output_attentions
else
None
all_router_probs
=
()
if
self
.
config
.
output_router_logits
or
output_router_logits
else
None
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment