"...git@developer.sourcefind.cn:chenpangpang/transformers.git" did not exist on "b0d539ccad090c8949c1740a9758b4152fad5f72"
Unverified Commit 773314ab authored by fxmarty's avatar fxmarty Committed by GitHub
Browse files

replace logger.warn by logger.warning (#19068)

parent 5e636eee
...@@ -257,11 +257,11 @@ class PTtoTFCommand(BaseTransformersCLICommand): ...@@ -257,11 +257,11 @@ class PTtoTFCommand(BaseTransformersCLICommand):
if architectures is None: # No architecture defined -- use auto classes if architectures is None: # No architecture defined -- use auto classes
pt_class = getattr(import_module("transformers"), "AutoModel") pt_class = getattr(import_module("transformers"), "AutoModel")
tf_class = getattr(import_module("transformers"), "TFAutoModel") tf_class = getattr(import_module("transformers"), "TFAutoModel")
self._logger.warn("No detected architecture, using AutoModel/TFAutoModel") self._logger.warning("No detected architecture, using AutoModel/TFAutoModel")
else: # Architecture defined -- use it else: # Architecture defined -- use it
if len(architectures) > 1: if len(architectures) > 1:
raise ValueError(f"More than one architecture was found, aborting. (architectures = {architectures})") raise ValueError(f"More than one architecture was found, aborting. (architectures = {architectures})")
self._logger.warn(f"Detected architecture: {architectures[0]}") self._logger.warning(f"Detected architecture: {architectures[0]}")
pt_class = getattr(import_module("transformers"), architectures[0]) pt_class = getattr(import_module("transformers"), architectures[0])
try: try:
tf_class = getattr(import_module("transformers"), "TF" + architectures[0]) tf_class = getattr(import_module("transformers"), "TF" + architectures[0])
...@@ -336,9 +336,9 @@ class PTtoTFCommand(BaseTransformersCLICommand): ...@@ -336,9 +336,9 @@ class PTtoTFCommand(BaseTransformersCLICommand):
repo.git_add(auto_lfs_track=True) repo.git_add(auto_lfs_track=True)
repo.git_commit(commit_message) repo.git_commit(commit_message)
repo.git_push(blocking=True) # this prints a progress bar with the upload 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.warning(f"TF weights pushed into {self._model_name}")
elif not self._no_pr: elif not self._no_pr:
self._logger.warn("Uploading the weights into a new PR...") self._logger.warning("Uploading the weights into a new PR...")
commit_descrition = ( commit_descrition = (
"Model converted by the [`transformers`' `pt_to_tf`" "Model converted by the [`transformers`' `pt_to_tf`"
" CLI](https://github.com/huggingface/transformers/blob/main/src/transformers/commands/pt_to_tf.py). " " CLI](https://github.com/huggingface/transformers/blob/main/src/transformers/commands/pt_to_tf.py). "
...@@ -375,4 +375,4 @@ class PTtoTFCommand(BaseTransformersCLICommand): ...@@ -375,4 +375,4 @@ class PTtoTFCommand(BaseTransformersCLICommand):
repo_type="model", repo_type="model",
create_pr=True, create_pr=True,
) )
self._logger.warn(f"PR open in {hub_pr_url}") self._logger.warning(f"PR open in {hub_pr_url}")
...@@ -1107,14 +1107,14 @@ else: ...@@ -1107,14 +1107,14 @@ else:
if cache_version < 1: if cache_version < 1:
if is_offline_mode(): if is_offline_mode():
logger.warn( logger.warning(
"You are offline and the cache for model files in Transformers v4.22.0 has been updated while your local " "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 " "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 " "`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." "your cache be updated automatically, then you can go back to offline mode."
) )
else: else:
logger.warn( logger.warning(
"The cache for model files in Transformers v4.22.0 has been updated. Migrating your old cache. This is a " "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 " "one-time only operation. You can interrupt this and resume the migration later on by calling "
"`transformers.utils.move_cache()`." "`transformers.utils.move_cache()`."
...@@ -1138,7 +1138,7 @@ if cache_version < 1: ...@@ -1138,7 +1138,7 @@ if cache_version < 1:
with open(cache_version_file, "w") as f: with open(cache_version_file, "w") as f:
f.write("1") f.write("1")
except Exception: except Exception:
logger.warn( logger.warning(
f"There was a problem when trying to write in your cache folder ({TRANSFORMERS_CACHE}). You should set " 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." "the environment variable TRANSFORMERS_CACHE to a writable directory."
) )
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment