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
b3595cf0
Unverified
Commit
b3595cf0
authored
Apr 15, 2024
by
Sai-Suraj-27
Committed by
GitHub
Apr 15, 2024
Browse files
fix: Replaced deprecated `typing.Text` with `str` (#30230)
typing.Text is deprecated. Use str instead
parent
f0107862
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
9 deletions
+9
-9
examples/research_projects/tapex/wikisql_utils.py
examples/research_projects/tapex/wikisql_utils.py
+2
-2
src/transformers/models/tapas/tokenization_tapas.py
src/transformers/models/tapas/tokenization_tapas.py
+7
-7
No files found.
examples/research_projects/tapex/wikisql_utils.py
View file @
b3595cf0
...
@@ -21,7 +21,7 @@ import re
...
@@ -21,7 +21,7 @@ import re
# The following script is adapted from the script of TaPas.
# The following script is adapted from the script of TaPas.
# Original: https://github.com/google-research/tapas/master/wikisql_utils.py
# Original: https://github.com/google-research/tapas/master/wikisql_utils.py
from
typing
import
Any
,
List
,
Text
from
typing
import
Any
,
List
EMPTY_ANSWER
=
"none"
EMPTY_ANSWER
=
"none"
...
@@ -114,7 +114,7 @@ class _Operator(enum.Enum):
...
@@ -114,7 +114,7 @@ class _Operator(enum.Enum):
class
_Condition
:
class
_Condition
:
"""Represents an SQL where clauses (e.g A = "a" or B > 5)."""
"""Represents an SQL where clauses (e.g A = "a" or B > 5)."""
column
:
Text
column
:
str
operator
:
_Operator
operator
:
_Operator
cmp_value
:
Any
cmp_value
:
Any
...
...
src/transformers/models/tapas/tokenization_tapas.py
View file @
b3595cf0
...
@@ -24,7 +24,7 @@ import os
...
@@ -24,7 +24,7 @@ import os
import
re
import
re
import
unicodedata
import
unicodedata
from
dataclasses
import
dataclass
from
dataclasses
import
dataclass
from
typing
import
Callable
,
Dict
,
Generator
,
List
,
Optional
,
Text
,
Tuple
,
Union
from
typing
import
Callable
,
Dict
,
Generator
,
List
,
Optional
,
Tuple
,
Union
import
numpy
as
np
import
numpy
as
np
...
@@ -70,19 +70,19 @@ class TokenCoordinates:
...
@@ -70,19 +70,19 @@ class TokenCoordinates:
@
dataclass
@
dataclass
class
TokenizedTable
:
class
TokenizedTable
:
rows
:
List
[
List
[
List
[
Text
]]]
rows
:
List
[
List
[
List
[
str
]]]
selected_tokens
:
List
[
TokenCoordinates
]
selected_tokens
:
List
[
TokenCoordinates
]
@
dataclass
(
frozen
=
True
)
@
dataclass
(
frozen
=
True
)
class
SerializedExample
:
class
SerializedExample
:
tokens
:
List
[
Text
]
tokens
:
List
[
str
]
column_ids
:
List
[
int
]
column_ids
:
List
[
int
]
row_ids
:
List
[
int
]
row_ids
:
List
[
int
]
segment_ids
:
List
[
int
]
segment_ids
:
List
[
int
]
def
_is_inner_wordpiece
(
token
:
Text
):
def
_is_inner_wordpiece
(
token
:
str
):
return
token
.
startswith
(
"##"
)
return
token
.
startswith
(
"##"
)
...
@@ -2224,14 +2224,14 @@ class NumericValueSpan:
...
@@ -2224,14 +2224,14 @@ class NumericValueSpan:
@
dataclass
@
dataclass
class
Cell
:
class
Cell
:
text
:
Text
text
:
str
numeric_value
:
Optional
[
NumericValue
]
=
None
numeric_value
:
Optional
[
NumericValue
]
=
None
@
dataclass
@
dataclass
class
Question
:
class
Question
:
original_text
:
Text
# The original raw question string.
original_text
:
str
# The original raw question string.
text
:
Text
# The question string after normalization.
text
:
str
# The question string after normalization.
numeric_spans
:
Optional
[
List
[
NumericValueSpan
]]
=
None
numeric_spans
:
Optional
[
List
[
NumericValueSpan
]]
=
None
...
...
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