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
7d9d5cea
Unverified
Commit
7d9d5cea
authored
Jan 08, 2024
by
Hz, Ji
Committed by
GitHub
Jan 08, 2024
Browse files
remove two deprecated function (#28220)
parent
0c2121f9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
1 addition
and
37 deletions
+1
-37
src/transformers/utils/__init__.py
src/transformers/utils/__init__.py
+0
-2
src/transformers/utils/import_utils.py
src/transformers/utils/import_utils.py
+1
-35
No files found.
src/transformers/utils/__init__.py
View file @
7d9d5cea
...
@@ -194,9 +194,7 @@ from .import_utils import (
...
@@ -194,9 +194,7 @@ from .import_utils import (
is_training_run_on_sagemaker
,
is_training_run_on_sagemaker
,
is_vision_available
,
is_vision_available
,
requires_backends
,
requires_backends
,
tf_required
,
torch_only_method
,
torch_only_method
,
torch_required
,
)
)
from
.peft_utils
import
(
from
.peft_utils
import
(
ADAPTER_CONFIG_NAME
,
ADAPTER_CONFIG_NAME
,
...
...
src/transformers/utils/import_utils.py
View file @
7d9d5cea
...
@@ -24,7 +24,7 @@ import subprocess
...
@@ -24,7 +24,7 @@ import subprocess
import
sys
import
sys
import
warnings
import
warnings
from
collections
import
OrderedDict
from
collections
import
OrderedDict
from
functools
import
lru_cache
,
wraps
from
functools
import
lru_cache
from
itertools
import
chain
from
itertools
import
chain
from
types
import
ModuleType
from
types
import
ModuleType
from
typing
import
Any
,
Tuple
,
Union
from
typing
import
Any
,
Tuple
,
Union
...
@@ -1303,40 +1303,6 @@ class DummyObject(type):
...
@@ -1303,40 +1303,6 @@ class DummyObject(type):
requires_backends
(
cls
,
cls
.
_backends
)
requires_backends
(
cls
,
cls
.
_backends
)
def
torch_required
(
func
):
warnings
.
warn
(
"The method `torch_required` is deprecated and will be removed in v4.36. Use `requires_backends` instead."
,
FutureWarning
,
)
# Chose a different decorator name than in tests so it's clear they are not the same.
@
wraps
(
func
)
def
wrapper
(
*
args
,
**
kwargs
):
if
is_torch_available
():
return
func
(
*
args
,
**
kwargs
)
else
:
raise
ImportError
(
f
"Method `
{
func
.
__name__
}
` requires PyTorch."
)
return
wrapper
def
tf_required
(
func
):
warnings
.
warn
(
"The method `tf_required` is deprecated and will be removed in v4.36. Use `requires_backends` instead."
,
FutureWarning
,
)
# Chose a different decorator name than in tests so it's clear they are not the same.
@
wraps
(
func
)
def
wrapper
(
*
args
,
**
kwargs
):
if
is_tf_available
():
return
func
(
*
args
,
**
kwargs
)
else
:
raise
ImportError
(
f
"Method `
{
func
.
__name__
}
` requires TF."
)
return
wrapper
def
is_torch_fx_proxy
(
x
):
def
is_torch_fx_proxy
(
x
):
if
is_torch_fx_available
():
if
is_torch_fx_available
():
import
torch.fx
import
torch.fx
...
...
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