Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Replaced deprecated typing.Text with str #30230

Merged
merged 1 commit into from
Apr 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions examples/research_projects/tapex/wikisql_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

# The following script is adapted from the script of TaPas.
# 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"
Expand Down Expand Up @@ -114,7 +114,7 @@ class _Operator(enum.Enum):
class _Condition:
"""Represents an SQL where clauses (e.g A = "a" or B > 5)."""

column: Text
column: str
operator: _Operator
cmp_value: Any

Expand Down
14 changes: 7 additions & 7 deletions src/transformers/models/tapas/tokenization_tapas.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import re
import unicodedata
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

Expand Down Expand Up @@ -70,19 +70,19 @@ class TokenCoordinates:

@dataclass
class TokenizedTable:
rows: List[List[List[Text]]]
rows: List[List[List[str]]]
selected_tokens: List[TokenCoordinates]


@dataclass(frozen=True)
class SerializedExample:
tokens: List[Text]
tokens: List[str]
column_ids: List[int]
row_ids: List[int]
segment_ids: List[int]


def _is_inner_wordpiece(token: Text):
def _is_inner_wordpiece(token: str):
return token.startswith("##")


Expand Down Expand Up @@ -2224,14 +2224,14 @@ class NumericValueSpan:

@dataclass
class Cell:
text: Text
text: str
numeric_value: Optional[NumericValue] = None


@dataclass
class Question:
original_text: Text # The original raw question string.
text: Text # The question string after normalization.
original_text: str # The original raw question string.
text: str # The question string after normalization.
numeric_spans: Optional[List[NumericValueSpan]] = None


Expand Down