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
773314ab
Unverified
Commit
773314ab
authored
Sep 16, 2022
by
fxmarty
Committed by
GitHub
Sep 16, 2022
Browse files
replace logger.warn by logger.warning (#19068)
parent
5e636eee
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
8 deletions
+8
-8
src/transformers/commands/pt_to_tf.py
src/transformers/commands/pt_to_tf.py
+5
-5
src/transformers/utils/hub.py
src/transformers/utils/hub.py
+3
-3
No files found.
src/transformers/commands/pt_to_tf.py
View file @
773314ab
...
...
@@ -257,11 +257,11 @@ class PTtoTFCommand(BaseTransformersCLICommand):
if
architectures
is
None
:
# No architecture defined -- use auto classes
pt_class
=
getattr
(
import_module
(
"transformers"
),
"AutoModel"
)
tf_class
=
getattr
(
import_module
(
"transformers"
),
"TFAutoModel"
)
self
.
_logger
.
warn
(
"No detected architecture, using AutoModel/TFAutoModel"
)
self
.
_logger
.
warn
ing
(
"No detected architecture, using AutoModel/TFAutoModel"
)
else
:
# Architecture defined -- use it
if
len
(
architectures
)
>
1
:
raise
ValueError
(
f
"More than one architecture was found, aborting. (architectures =
{
architectures
}
)"
)
self
.
_logger
.
warn
(
f
"Detected architecture:
{
architectures
[
0
]
}
"
)
self
.
_logger
.
warn
ing
(
f
"Detected architecture:
{
architectures
[
0
]
}
"
)
pt_class
=
getattr
(
import_module
(
"transformers"
),
architectures
[
0
])
try
:
tf_class
=
getattr
(
import_module
(
"transformers"
),
"TF"
+
architectures
[
0
])
...
...
@@ -336,9 +336,9 @@ class PTtoTFCommand(BaseTransformersCLICommand):
repo
.
git_add
(
auto_lfs_track
=
True
)
repo
.
git_commit
(
commit_message
)
repo
.
git_push
(
blocking
=
True
)
# this prints a progress bar with the upload
self
.
_logger
.
warn
(
f
"TF weights pushed into
{
self
.
_model_name
}
"
)
self
.
_logger
.
warn
ing
(
f
"TF weights pushed into
{
self
.
_model_name
}
"
)
elif
not
self
.
_no_pr
:
self
.
_logger
.
warn
(
"Uploading the weights into a new PR..."
)
self
.
_logger
.
warn
ing
(
"Uploading the weights into a new PR..."
)
commit_descrition
=
(
"Model converted by the [`transformers`' `pt_to_tf`"
" CLI](https://github.com/huggingface/transformers/blob/main/src/transformers/commands/pt_to_tf.py). "
...
...
@@ -375,4 +375,4 @@ class PTtoTFCommand(BaseTransformersCLICommand):
repo_type
=
"model"
,
create_pr
=
True
,
)
self
.
_logger
.
warn
(
f
"PR open in
{
hub_pr_url
}
"
)
self
.
_logger
.
warn
ing
(
f
"PR open in
{
hub_pr_url
}
"
)
src/transformers/utils/hub.py
View file @
773314ab
...
...
@@ -1107,14 +1107,14 @@ else:
if
cache_version
<
1
:
if
is_offline_mode
():
logger
.
warn
(
logger
.
warn
ing
(
"You are offline and the cache for model files in Transformers v4.22.0 has been updated while your local "
"cache seems to be the one of a previous version. It is very likely that all your calls to any "
"`from_pretrained()` method will fail. Remove the offline mode and enable internet connection to have "
"your cache be updated automatically, then you can go back to offline mode."
)
else
:
logger
.
warn
(
logger
.
warn
ing
(
"The cache for model files in Transformers v4.22.0 has been updated. Migrating your old cache. This is a "
"one-time only operation. You can interrupt this and resume the migration later on by calling "
"`transformers.utils.move_cache()`."
...
...
@@ -1138,7 +1138,7 @@ if cache_version < 1:
with
open
(
cache_version_file
,
"w"
)
as
f
:
f
.
write
(
"1"
)
except
Exception
:
logger
.
warn
(
logger
.
warn
ing
(
f
"There was a problem when trying to write in your cache folder (
{
TRANSFORMERS_CACHE
}
). You should set "
"the environment variable TRANSFORMERS_CACHE to a writable directory."
)
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