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
fdd78d91
Unverified
Commit
fdd78d91
authored
Jun 13, 2023
by
Nicolas Patry
Committed by
GitHub
Jun 13, 2023
Browse files
Improving error message when using `use_safetensors=True`. (#24232)
parent
74b846ca
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
0 deletions
+5
-0
src/transformers/modeling_utils.py
src/transformers/modeling_utils.py
+5
-0
No files found.
src/transformers/modeling_utils.py
View file @
fdd78d91
...
@@ -2445,6 +2445,11 @@ class PreTrainedModel(nn.Module, ModuleUtilsMixin, GenerationMixin, PushToHubMix
...
@@ -2445,6 +2445,11 @@ class PreTrainedModel(nn.Module, ModuleUtilsMixin, GenerationMixin, PushToHubMix
f
"
{
pretrained_model_name_or_path
}
but there is a file for Flax weights. Use `from_flax=True`"
f
"
{
pretrained_model_name_or_path
}
but there is a file for Flax weights. Use `from_flax=True`"
" to load this model from those weights."
" to load this model from those weights."
)
)
elif
use_safetensors
:
raise
EnvironmentError
(
f
"Error no file named
{
_add_variant
(
SAFE_WEIGHTS_NAME
,
variant
)
}
found in directory"
f
"
{
pretrained_model_name_or_path
}
."
)
else
:
else
:
raise
EnvironmentError
(
raise
EnvironmentError
(
f
"Error no file named
{
_add_variant
(
WEIGHTS_NAME
,
variant
)
}
,
{
TF2_WEIGHTS_NAME
}
,"
f
"Error no file named
{
_add_variant
(
WEIGHTS_NAME
,
variant
)
}
,
{
TF2_WEIGHTS_NAME
}
,"
...
...
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