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
0f71c290
Unverified
Commit
0f71c290
authored
Feb 14, 2022
by
lewtun
Committed by
GitHub
Feb 14, 2022
Browse files
Remove redundant error logging in from_pretrained() method (#15631)
* Remove error logging in from_pretrained() method
parent
b090b790
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
29 additions
and
61 deletions
+29
-61
src/transformers/configuration_utils.py
src/transformers/configuration_utils.py
+5
-10
src/transformers/feature_extraction_utils.py
src/transformers/feature_extraction_utils.py
+5
-10
src/transformers/file_utils.py
src/transformers/file_utils.py
+2
-4
src/transformers/modeling_flax_utils.py
src/transformers/modeling_flax_utils.py
+5
-11
src/transformers/modeling_tf_utils.py
src/transformers/modeling_tf_utils.py
+5
-11
src/transformers/modeling_utils.py
src/transformers/modeling_utils.py
+5
-11
src/transformers/tokenization_utils_base.py
src/transformers/tokenization_utils_base.py
+2
-4
No files found.
src/transformers/configuration_utils.py
View file @
0f71c290
...
@@ -602,36 +602,31 @@ class PretrainedConfig(PushToHubMixin):
...
@@ -602,36 +602,31 @@ class PretrainedConfig(PushToHubMixin):
user_agent
=
user_agent
,
user_agent
=
user_agent
,
)
)
except
RepositoryNotFoundError
as
err
:
except
RepositoryNotFoundError
:
logger
.
error
(
err
)
raise
EnvironmentError
(
raise
EnvironmentError
(
f
"
{
pretrained_model_name_or_path
}
is not a local folder and is not a valid model identifier listed on "
f
"
{
pretrained_model_name_or_path
}
is not a local folder and is not a valid model identifier listed on "
"'https://huggingface.co/models'
\n
If this is a private repository, make sure to pass a token having "
"'https://huggingface.co/models'
\n
If this is a private repository, make sure to pass a token having "
"permission to this repo with `use_auth_token` or log in with `huggingface-cli login` and pass "
"permission to this repo with `use_auth_token` or log in with `huggingface-cli login` and pass "
"`use_auth_token=True`."
"`use_auth_token=True`."
)
)
except
RevisionNotFoundError
as
err
:
except
RevisionNotFoundError
:
logger
.
error
(
err
)
raise
EnvironmentError
(
raise
EnvironmentError
(
f
"
{
revision
}
is not a valid git identifier (branch name, tag name or commit id) that exists for this "
f
"
{
revision
}
is not a valid git identifier (branch name, tag name or commit id) that exists for this "
f
"model name. Check the model page at 'https://huggingface.co/
{
pretrained_model_name_or_path
}
' for "
f
"model name. Check the model page at 'https://huggingface.co/
{
pretrained_model_name_or_path
}
' for "
"available revisions."
"available revisions."
)
)
except
EntryNotFoundError
as
err
:
except
EntryNotFoundError
:
logger
.
error
(
err
)
raise
EnvironmentError
(
raise
EnvironmentError
(
f
"
{
pretrained_model_name_or_path
}
does not appear to have a file named
{
configuration_file
}
."
f
"
{
pretrained_model_name_or_path
}
does not appear to have a file named
{
configuration_file
}
."
)
)
except
HTTPError
as
err
:
except
HTTPError
:
logger
.
error
(
err
)
raise
EnvironmentError
(
raise
EnvironmentError
(
"We couldn't connect to 'https://huggingface.co/' to load this model and it looks like "
"We couldn't connect to 'https://huggingface.co/' to load this model and it looks like "
f
"
{
pretrained_model_name_or_path
}
is not the path to a directory conaining a
{
configuration_file
}
"
f
"
{
pretrained_model_name_or_path
}
is not the path to a directory conaining a
{
configuration_file
}
"
"file.
\n
Checkout your internet connection or see how to run the library in offline mode at "
"file.
\n
Checkout your internet connection or see how to run the library in offline mode at "
"'https://huggingface.co/docs/transformers/installation#offline-mode'."
"'https://huggingface.co/docs/transformers/installation#offline-mode'."
)
)
except
EnvironmentError
as
err
:
except
EnvironmentError
:
logger
.
error
(
err
)
raise
EnvironmentError
(
raise
EnvironmentError
(
f
"Can't load config for '
{
pretrained_model_name_or_path
}
'. If you were trying to load it from "
f
"Can't load config for '
{
pretrained_model_name_or_path
}
'. If you were trying to load it from "
"'https://huggingface.co/models', make sure you don't have a local directory with the same name. "
"'https://huggingface.co/models', make sure you don't have a local directory with the same name. "
...
...
src/transformers/feature_extraction_utils.py
View file @
0f71c290
...
@@ -412,36 +412,31 @@ class FeatureExtractionMixin(PushToHubMixin):
...
@@ -412,36 +412,31 @@ class FeatureExtractionMixin(PushToHubMixin):
user_agent
=
user_agent
,
user_agent
=
user_agent
,
)
)
except
RepositoryNotFoundError
as
err
:
except
RepositoryNotFoundError
:
logger
.
error
(
err
)
raise
EnvironmentError
(
raise
EnvironmentError
(
f
"
{
pretrained_model_name_or_path
}
is not a local folder and is not a valid model identifier listed on "
f
"
{
pretrained_model_name_or_path
}
is not a local folder and is not a valid model identifier listed on "
"'https://huggingface.co/models'
\n
If this is a private repository, make sure to pass a token having "
"'https://huggingface.co/models'
\n
If this is a private repository, make sure to pass a token having "
"permission to this repo with `use_auth_token` or log in with `huggingface-cli login` and pass "
"permission to this repo with `use_auth_token` or log in with `huggingface-cli login` and pass "
"`use_auth_token=True`."
"`use_auth_token=True`."
)
)
except
RevisionNotFoundError
as
err
:
except
RevisionNotFoundError
:
logger
.
error
(
err
)
raise
EnvironmentError
(
raise
EnvironmentError
(
f
"
{
revision
}
is not a valid git identifier (branch name, tag name or commit id) that exists for this "
f
"
{
revision
}
is not a valid git identifier (branch name, tag name or commit id) that exists for this "
f
"model name. Check the model page at 'https://huggingface.co/
{
pretrained_model_name_or_path
}
' for "
f
"model name. Check the model page at 'https://huggingface.co/
{
pretrained_model_name_or_path
}
' for "
"available revisions."
"available revisions."
)
)
except
EntryNotFoundError
as
err
:
except
EntryNotFoundError
:
logger
.
error
(
err
)
raise
EnvironmentError
(
raise
EnvironmentError
(
f
"
{
pretrained_model_name_or_path
}
does not appear to have a file named
{
FEATURE_EXTRACTOR_NAME
}
."
f
"
{
pretrained_model_name_or_path
}
does not appear to have a file named
{
FEATURE_EXTRACTOR_NAME
}
."
)
)
except
HTTPError
as
err
:
except
HTTPError
:
logger
.
error
(
err
)
raise
EnvironmentError
(
raise
EnvironmentError
(
"We couldn't connect to 'https://huggingface.co/' to load this model and it looks like "
"We couldn't connect to 'https://huggingface.co/' to load this model and it looks like "
f
"
{
pretrained_model_name_or_path
}
is not the path to a directory conaining a "
f
"
{
pretrained_model_name_or_path
}
is not the path to a directory conaining a "
f
"
{
FEATURE_EXTRACTOR_NAME
}
file.
\n
Checkout your internet connection or see how to run the library in "
f
"
{
FEATURE_EXTRACTOR_NAME
}
file.
\n
Checkout your internet connection or see how to run the library in "
"offline mode at 'https://huggingface.co/docs/transformers/installation#offline-mode'."
"offline mode at 'https://huggingface.co/docs/transformers/installation#offline-mode'."
)
)
except
EnvironmentError
as
err
:
except
EnvironmentError
:
logger
.
error
(
err
)
raise
EnvironmentError
(
raise
EnvironmentError
(
f
"Can't load feature extractor for '
{
pretrained_model_name_or_path
}
'. If you were trying to load it "
f
"Can't load feature extractor for '
{
pretrained_model_name_or_path
}
'. If you were trying to load it "
"from 'https://huggingface.co/models', make sure you don't have a local directory with the same name. "
"from 'https://huggingface.co/models', make sure you don't have a local directory with the same name. "
...
...
src/transformers/file_utils.py
View file @
0f71c290
...
@@ -2302,16 +2302,14 @@ def get_file_from_repo(
...
@@ -2302,16 +2302,14 @@ def get_file_from_repo(
use_auth_token
=
use_auth_token
,
use_auth_token
=
use_auth_token
,
)
)
except
RepositoryNotFoundError
as
err
:
except
RepositoryNotFoundError
:
logger
.
error
(
err
)
raise
EnvironmentError
(
raise
EnvironmentError
(
f
"
{
path_or_repo
}
is not a local folder and is not a valid model identifier "
f
"
{
path_or_repo
}
is not a local folder and is not a valid model identifier "
"listed on 'https://huggingface.co/models'
\n
If this is a private repository, make sure to "
"listed on 'https://huggingface.co/models'
\n
If this is a private repository, make sure to "
"pass a token having permission to this repo with `use_auth_token` or log in with "
"pass a token having permission to this repo with `use_auth_token` or log in with "
"`huggingface-cli login` and pass `use_auth_token=True`."
"`huggingface-cli login` and pass `use_auth_token=True`."
)
)
except
RevisionNotFoundError
as
err
:
except
RevisionNotFoundError
:
logger
.
error
(
err
)
raise
EnvironmentError
(
raise
EnvironmentError
(
f
"
{
revision
}
is not a valid git identifier (branch name, tag name or commit id) that exists "
f
"
{
revision
}
is not a valid git identifier (branch name, tag name or commit id) that exists "
"for this model name. Check the model page at "
"for this model name. Check the model page at "
...
...
src/transformers/modeling_flax_utils.py
View file @
0f71c290
...
@@ -492,23 +492,20 @@ class FlaxPreTrainedModel(PushToHubMixin, FlaxGenerationMixin):
...
@@ -492,23 +492,20 @@ class FlaxPreTrainedModel(PushToHubMixin, FlaxGenerationMixin):
user_agent
=
user_agent
,
user_agent
=
user_agent
,
)
)
except
RepositoryNotFoundError
as
err
:
except
RepositoryNotFoundError
:
logger
.
error
(
err
)
raise
EnvironmentError
(
raise
EnvironmentError
(
f
"
{
pretrained_model_name_or_path
}
is not a local folder and is not a valid model identifier "
f
"
{
pretrained_model_name_or_path
}
is not a local folder and is not a valid model identifier "
"listed on 'https://huggingface.co/models'
\n
If this is a private repository, make sure to pass a "
"listed on 'https://huggingface.co/models'
\n
If this is a private repository, make sure to pass a "
"token having permission to this repo with `use_auth_token` or log in with `huggingface-cli "
"token having permission to this repo with `use_auth_token` or log in with `huggingface-cli "
"login` and pass `use_auth_token=True`."
"login` and pass `use_auth_token=True`."
)
)
except
RevisionNotFoundError
as
err
:
except
RevisionNotFoundError
:
logger
.
error
(
err
)
raise
EnvironmentError
(
raise
EnvironmentError
(
f
"
{
revision
}
is not a valid git identifier (branch name, tag name or commit id) that exists for "
f
"
{
revision
}
is not a valid git identifier (branch name, tag name or commit id) that exists for "
"this model name. Check the model page at "
"this model name. Check the model page at "
f
"'https://huggingface.co/
{
pretrained_model_name_or_path
}
' for available revisions."
f
"'https://huggingface.co/
{
pretrained_model_name_or_path
}
' for available revisions."
)
)
except
EntryNotFoundError
as
err
:
except
EntryNotFoundError
:
logger
.
error
(
err
)
if
filename
==
FLAX_WEIGHTS_NAME
:
if
filename
==
FLAX_WEIGHTS_NAME
:
has_file_kwargs
=
{
"revision"
:
revision
,
"proxies"
:
proxies
,
"use_auth_token"
:
use_auth_token
}
has_file_kwargs
=
{
"revision"
:
revision
,
"proxies"
:
proxies
,
"use_auth_token"
:
use_auth_token
}
if
has_file
(
pretrained_model_name_or_path
,
WEIGHTS_NAME
,
**
has_file_kwargs
):
if
has_file
(
pretrained_model_name_or_path
,
WEIGHTS_NAME
,
**
has_file_kwargs
):
...
@@ -518,7 +515,6 @@ class FlaxPreTrainedModel(PushToHubMixin, FlaxGenerationMixin):
...
@@ -518,7 +515,6 @@ class FlaxPreTrainedModel(PushToHubMixin, FlaxGenerationMixin):
"those weights."
"those weights."
)
)
else
:
else
:
logger
.
error
(
err
)
raise
EnvironmentError
(
raise
EnvironmentError
(
f
"
{
pretrained_model_name_or_path
}
does not appear to have a file named
{
FLAX_WEIGHTS_NAME
}
"
f
"
{
pretrained_model_name_or_path
}
does not appear to have a file named
{
FLAX_WEIGHTS_NAME
}
"
f
"or
{
WEIGHTS_NAME
}
."
f
"or
{
WEIGHTS_NAME
}
."
...
@@ -527,8 +523,7 @@ class FlaxPreTrainedModel(PushToHubMixin, FlaxGenerationMixin):
...
@@ -527,8 +523,7 @@ class FlaxPreTrainedModel(PushToHubMixin, FlaxGenerationMixin):
raise
EnvironmentError
(
raise
EnvironmentError
(
f
"
{
pretrained_model_name_or_path
}
does not appear to have a file named
{
filename
}
."
f
"
{
pretrained_model_name_or_path
}
does not appear to have a file named
{
filename
}
."
)
)
except
HTTPError
as
err
:
except
HTTPError
:
logger
.
error
(
err
)
raise
EnvironmentError
(
raise
EnvironmentError
(
"We couldn't connect to 'https://huggingface.co/' to load this model and it looks like "
"We couldn't connect to 'https://huggingface.co/' to load this model and it looks like "
f
"
{
pretrained_model_name_or_path
}
is not the path to a directory conaining a a file named "
f
"
{
pretrained_model_name_or_path
}
is not the path to a directory conaining a a file named "
...
@@ -536,8 +531,7 @@ class FlaxPreTrainedModel(PushToHubMixin, FlaxGenerationMixin):
...
@@ -536,8 +531,7 @@ class FlaxPreTrainedModel(PushToHubMixin, FlaxGenerationMixin):
"Checkout your internet connection or see how to run the library in offline mode at "
"Checkout your internet connection or see how to run the library in offline mode at "
"'https://huggingface.co/docs/transformers/installation#offline-mode'."
"'https://huggingface.co/docs/transformers/installation#offline-mode'."
)
)
except
EnvironmentError
as
err
:
except
EnvironmentError
:
logger
.
error
(
err
)
raise
EnvironmentError
(
raise
EnvironmentError
(
f
"Can't load the model for '
{
pretrained_model_name_or_path
}
'. If you were trying to load it from "
f
"Can't load the model for '
{
pretrained_model_name_or_path
}
'. If you were trying to load it from "
"'https://huggingface.co/models', make sure you don't have a local directory with the same name. "
"'https://huggingface.co/models', make sure you don't have a local directory with the same name. "
...
...
src/transformers/modeling_tf_utils.py
View file @
0f71c290
...
@@ -1588,23 +1588,20 @@ class TFPreTrainedModel(tf.keras.Model, TFModelUtilsMixin, TFGenerationMixin, Pu
...
@@ -1588,23 +1588,20 @@ class TFPreTrainedModel(tf.keras.Model, TFModelUtilsMixin, TFGenerationMixin, Pu
user_agent
=
user_agent
,
user_agent
=
user_agent
,
)
)
except
RepositoryNotFoundError
as
err
:
except
RepositoryNotFoundError
:
logger
.
error
(
err
)
raise
EnvironmentError
(
raise
EnvironmentError
(
f
"
{
pretrained_model_name_or_path
}
is not a local folder and is not a valid model identifier "
f
"
{
pretrained_model_name_or_path
}
is not a local folder and is not a valid model identifier "
"listed on 'https://huggingface.co/models'
\n
If this is a private repository, make sure to pass a "
"listed on 'https://huggingface.co/models'
\n
If this is a private repository, make sure to pass a "
"token having permission to this repo with `use_auth_token` or log in with `huggingface-cli "
"token having permission to this repo with `use_auth_token` or log in with `huggingface-cli "
"login` and pass `use_auth_token=True`."
"login` and pass `use_auth_token=True`."
)
)
except
RevisionNotFoundError
as
err
:
except
RevisionNotFoundError
:
logger
.
error
(
err
)
raise
EnvironmentError
(
raise
EnvironmentError
(
f
"
{
revision
}
is not a valid git identifier (branch name, tag name or commit id) that exists for "
f
"
{
revision
}
is not a valid git identifier (branch name, tag name or commit id) that exists for "
"this model name. Check the model page at "
"this model name. Check the model page at "
f
"'https://huggingface.co/
{
pretrained_model_name_or_path
}
' for available revisions."
f
"'https://huggingface.co/
{
pretrained_model_name_or_path
}
' for available revisions."
)
)
except
EntryNotFoundError
as
err
:
except
EntryNotFoundError
:
logger
.
error
(
err
)
if
filename
==
TF2_WEIGHTS_NAME
:
if
filename
==
TF2_WEIGHTS_NAME
:
has_file_kwargs
=
{
has_file_kwargs
=
{
"revision"
:
revision
,
"revision"
:
revision
,
...
@@ -1619,7 +1616,6 @@ class TFPreTrainedModel(tf.keras.Model, TFModelUtilsMixin, TFGenerationMixin, Pu
...
@@ -1619,7 +1616,6 @@ class TFPreTrainedModel(tf.keras.Model, TFModelUtilsMixin, TFGenerationMixin, Pu
"those weights."
"those weights."
)
)
else
:
else
:
logger
.
error
(
err
)
raise
EnvironmentError
(
raise
EnvironmentError
(
f
"
{
pretrained_model_name_or_path
}
does not appear to have a file named
{
TF2_WEIGHTS_NAME
}
"
f
"
{
pretrained_model_name_or_path
}
does not appear to have a file named
{
TF2_WEIGHTS_NAME
}
"
f
"or
{
WEIGHTS_NAME
}
."
f
"or
{
WEIGHTS_NAME
}
."
...
@@ -1628,8 +1624,7 @@ class TFPreTrainedModel(tf.keras.Model, TFModelUtilsMixin, TFGenerationMixin, Pu
...
@@ -1628,8 +1624,7 @@ class TFPreTrainedModel(tf.keras.Model, TFModelUtilsMixin, TFGenerationMixin, Pu
raise
EnvironmentError
(
raise
EnvironmentError
(
f
"
{
pretrained_model_name_or_path
}
does not appear to have a file named
{
filename
}
."
f
"
{
pretrained_model_name_or_path
}
does not appear to have a file named
{
filename
}
."
)
)
except
HTTPError
as
err
:
except
HTTPError
:
logger
.
error
(
err
)
raise
EnvironmentError
(
raise
EnvironmentError
(
"We couldn't connect to 'https://huggingface.co/' to load this model and it looks like "
"We couldn't connect to 'https://huggingface.co/' to load this model and it looks like "
f
"
{
pretrained_model_name_or_path
}
is not the path to a directory conaining a a file named "
f
"
{
pretrained_model_name_or_path
}
is not the path to a directory conaining a a file named "
...
@@ -1637,8 +1632,7 @@ class TFPreTrainedModel(tf.keras.Model, TFModelUtilsMixin, TFGenerationMixin, Pu
...
@@ -1637,8 +1632,7 @@ class TFPreTrainedModel(tf.keras.Model, TFModelUtilsMixin, TFGenerationMixin, Pu
"Checkout your internet connection or see how to run the library in offline mode at "
"Checkout your internet connection or see how to run the library in offline mode at "
"'https://huggingface.co/docs/transformers/installation#offline-mode'."
"'https://huggingface.co/docs/transformers/installation#offline-mode'."
)
)
except
EnvironmentError
as
err
:
except
EnvironmentError
:
logger
.
error
(
err
)
raise
EnvironmentError
(
raise
EnvironmentError
(
f
"Can't load the model for '
{
pretrained_model_name_or_path
}
'. If you were trying to load it from "
f
"Can't load the model for '
{
pretrained_model_name_or_path
}
'. If you were trying to load it from "
"'https://huggingface.co/models', make sure you don't have a local directory with the same name. "
"'https://huggingface.co/models', make sure you don't have a local directory with the same name. "
...
...
src/transformers/modeling_utils.py
View file @
0f71c290
...
@@ -1366,23 +1366,20 @@ class PreTrainedModel(nn.Module, ModuleUtilsMixin, GenerationMixin, PushToHubMix
...
@@ -1366,23 +1366,20 @@ class PreTrainedModel(nn.Module, ModuleUtilsMixin, GenerationMixin, PushToHubMix
user_agent
=
user_agent
,
user_agent
=
user_agent
,
)
)
except
RepositoryNotFoundError
as
err
:
except
RepositoryNotFoundError
:
logger
.
error
(
err
)
raise
EnvironmentError
(
raise
EnvironmentError
(
f
"
{
pretrained_model_name_or_path
}
is not a local folder and is not a valid model identifier "
f
"
{
pretrained_model_name_or_path
}
is not a local folder and is not a valid model identifier "
"listed on 'https://huggingface.co/models'
\n
If this is a private repository, make sure to pass a "
"listed on 'https://huggingface.co/models'
\n
If this is a private repository, make sure to pass a "
"token having permission to this repo with `use_auth_token` or log in with `huggingface-cli "
"token having permission to this repo with `use_auth_token` or log in with `huggingface-cli "
"login` and pass `use_auth_token=True`."
"login` and pass `use_auth_token=True`."
)
)
except
RevisionNotFoundError
as
err
:
except
RevisionNotFoundError
:
logger
.
error
(
err
)
raise
EnvironmentError
(
raise
EnvironmentError
(
f
"
{
revision
}
is not a valid git identifier (branch name, tag name or commit id) that exists for "
f
"
{
revision
}
is not a valid git identifier (branch name, tag name or commit id) that exists for "
"this model name. Check the model page at "
"this model name. Check the model page at "
f
"'https://huggingface.co/
{
pretrained_model_name_or_path
}
' for available revisions."
f
"'https://huggingface.co/
{
pretrained_model_name_or_path
}
' for available revisions."
)
)
except
EntryNotFoundError
as
err
:
except
EntryNotFoundError
:
logger
.
error
(
err
)
if
filename
==
WEIGHTS_NAME
:
if
filename
==
WEIGHTS_NAME
:
has_file_kwargs
=
{
has_file_kwargs
=
{
"revision"
:
revision
,
"revision"
:
revision
,
...
@@ -1403,7 +1400,6 @@ class PreTrainedModel(nn.Module, ModuleUtilsMixin, GenerationMixin, PushToHubMix
...
@@ -1403,7 +1400,6 @@ class PreTrainedModel(nn.Module, ModuleUtilsMixin, GenerationMixin, PushToHubMix
"weights."
"weights."
)
)
else
:
else
:
logger
.
error
(
err
)
raise
EnvironmentError
(
raise
EnvironmentError
(
f
"
{
pretrained_model_name_or_path
}
does not appear to have a file named
{
WEIGHTS_NAME
}
, "
f
"
{
pretrained_model_name_or_path
}
does not appear to have a file named
{
WEIGHTS_NAME
}
, "
f
"
{
TF2_WEIGHTS_NAME
}
,
{
TF_WEIGHTS_NAME
}
or
{
FLAX_WEIGHTS_NAME
}
."
f
"
{
TF2_WEIGHTS_NAME
}
,
{
TF_WEIGHTS_NAME
}
or
{
FLAX_WEIGHTS_NAME
}
."
...
@@ -1412,8 +1408,7 @@ class PreTrainedModel(nn.Module, ModuleUtilsMixin, GenerationMixin, PushToHubMix
...
@@ -1412,8 +1408,7 @@ class PreTrainedModel(nn.Module, ModuleUtilsMixin, GenerationMixin, PushToHubMix
raise
EnvironmentError
(
raise
EnvironmentError
(
f
"
{
pretrained_model_name_or_path
}
does not appear to have a file named
{
filename
}
."
f
"
{
pretrained_model_name_or_path
}
does not appear to have a file named
{
filename
}
."
)
)
except
HTTPError
as
err
:
except
HTTPError
:
logger
.
error
(
err
)
raise
EnvironmentError
(
raise
EnvironmentError
(
"We couldn't connect to 'https://huggingface.co/' to load this model and it looks like "
"We couldn't connect to 'https://huggingface.co/' to load this model and it looks like "
f
"
{
pretrained_model_name_or_path
}
is not the path to a directory conaining a a file named "
f
"
{
pretrained_model_name_or_path
}
is not the path to a directory conaining a a file named "
...
@@ -1421,8 +1416,7 @@ class PreTrainedModel(nn.Module, ModuleUtilsMixin, GenerationMixin, PushToHubMix
...
@@ -1421,8 +1416,7 @@ class PreTrainedModel(nn.Module, ModuleUtilsMixin, GenerationMixin, PushToHubMix
"Checkout your internet connection or see how to run the library in offline mode at "
"Checkout your internet connection or see how to run the library in offline mode at "
"'https://huggingface.co/docs/transformers/installation#offline-mode'."
"'https://huggingface.co/docs/transformers/installation#offline-mode'."
)
)
except
EnvironmentError
as
err
:
except
EnvironmentError
:
logger
.
error
(
err
)
raise
EnvironmentError
(
raise
EnvironmentError
(
f
"Can't load the model for '
{
pretrained_model_name_or_path
}
'. If you were trying to load it from "
f
"Can't load the model for '
{
pretrained_model_name_or_path
}
'. If you were trying to load it from "
"'https://huggingface.co/models', make sure you don't have a local directory with the same name. "
"'https://huggingface.co/models', make sure you don't have a local directory with the same name. "
...
...
src/transformers/tokenization_utils_base.py
View file @
0f71c290
...
@@ -1738,16 +1738,14 @@ class PreTrainedTokenizerBase(SpecialTokensMixin, PushToHubMixin):
...
@@ -1738,16 +1738,14 @@ class PreTrainedTokenizerBase(SpecialTokensMixin, PushToHubMixin):
else
:
else
:
raise
error
raise
error
except
RepositoryNotFoundError
as
err
:
except
RepositoryNotFoundError
:
logger
.
error
(
err
)
raise
EnvironmentError
(
raise
EnvironmentError
(
f
"
{
pretrained_model_name_or_path
}
is not a local folder and is not a valid model identifier "
f
"
{
pretrained_model_name_or_path
}
is not a local folder and is not a valid model identifier "
"listed on 'https://huggingface.co/models'
\n
If this is a private repository, make sure to "
"listed on 'https://huggingface.co/models'
\n
If this is a private repository, make sure to "
"pass a token having permission to this repo with `use_auth_token` or log in with "
"pass a token having permission to this repo with `use_auth_token` or log in with "
"`huggingface-cli login` and pass `use_auth_token=True`."
"`huggingface-cli login` and pass `use_auth_token=True`."
)
)
except
RevisionNotFoundError
as
err
:
except
RevisionNotFoundError
:
logger
.
error
(
err
)
raise
EnvironmentError
(
raise
EnvironmentError
(
f
"
{
revision
}
is not a valid git identifier (branch name, tag name or commit id) that exists "
f
"
{
revision
}
is not a valid git identifier (branch name, tag name or commit id) that exists "
"for this model name. Check the model page at "
"for this model name. Check the model page at "
...
...
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