Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
a53a0c51
Unverified
Commit
a53a0c51
authored
Nov 14, 2023
by
Joao Gante
Committed by
GitHub
Nov 14, 2023
Browse files
Generate: `GenerationConfig.from_pretrained` can return unused kwargs (#27488)
parent
5468ab35
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
3 deletions
+8
-3
src/transformers/generation/configuration_utils.py
src/transformers/generation/configuration_utils.py
+8
-3
No files found.
src/transformers/generation/configuration_utils.py
View file @
a53a0c51
...
...
@@ -750,6 +750,11 @@ class GenerationConfig(PushToHubMixin):
else
:
logger
.
info
(
f
"loading configuration file
{
configuration_file
}
from cache at
{
resolved_config_file
}
"
)
if
kwargs
.
get
(
"return_unused_kwargs"
)
is
True
:
config
,
unused_kwargs
=
cls
.
from_dict
(
config_dict
,
**
kwargs
)
config
.
_original_object_hash
=
hash
(
config
)
# Hash to detect whether the instance was modified
return
config
,
unused_kwargs
else
:
config
=
cls
.
from_dict
(
config_dict
,
**
kwargs
)
config
.
_original_object_hash
=
hash
(
config
)
# Hash to detect whether the instance was modified
return
config
...
...
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