Skip to content

Renaming Structured Data Classification task to Tabular Classification #48

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

Closed
wants to merge 3 commits into from
Closed
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
6 changes: 3 additions & 3 deletions api_inference_community/validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def all_rows_must_have_same_length(cls, table: Dict[str, List[str]]):
raise ValueError("All rows in the table must be the same length")


class StructuredDataClassificationInputsCheck(BaseModel):
class TabularClassificationInputsCheck(BaseModel):
data: Dict[str, List[str]]

@validator("data")
Expand Down Expand Up @@ -177,7 +177,7 @@ class StringInput(BaseModel):
"feature-extraction": StringOrStringBatchInputCheck,
"sentence-similarity": SentenceSimilarityInputsCheck,
"table-question-answering": TableQuestionAnsweringInputsCheck,
"structured-data-classification": StructuredDataClassificationInputsCheck,
"tabular-classification": TabularClassificationInputsCheck,
"fill-mask": StringInput,
"summarization": StringInput,
"text2text-generation": StringInput,
Expand Down Expand Up @@ -228,7 +228,7 @@ def check_inputs(inputs, tag):
"sentence-similarity",
"fill-mask",
"table-question-answering",
"structured-data-classification",
"tabular-classification",
"summarization",
"text2text-generation",
"text-classification",
Expand Down
4 changes: 1 addition & 3 deletions docker_images/adapter_transformers/app/pipelines/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@
from app.pipelines.question_answering import QuestionAnsweringPipeline
from app.pipelines.sentence_similarity import SentenceSimilarityPipeline
from app.pipelines.speech_segmentation import SpeechSegmentationPipeline
from app.pipelines.structured_data_classification import (
StructuredDataClassificationPipeline,
)
from app.pipelines.tabular_classification import TabularClassificationPipeline
from app.pipelines.text_classification import TextClassificationPipeline
from app.pipelines.text_to_speech import TextToSpeechPipeline
from app.pipelines.token_classification import TokenClassificationPipeline
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
from app.pipelines import Pipeline


class StructuredDataClassificationPipeline(Pipeline):
class TabularClassificationPipeline(Pipeline):
def __init__(self, model_id: str):
# IMPLEMENT_THIS
# Preload all the elements you are going to need at inference.
# For instance your model, processors, tokenizer that might be needed.
# This function is only called once, so do all the heavy processing I/O here
raise NotImplementedError(
"Please implement StructuredDataClassificationPipeline __init__ function"
"Please implement TabularClassificationPipeline __init__ function"
)

def __call__(
Expand All @@ -26,5 +26,5 @@ def __call__(
"""
# IMPLEMENT_THIS
raise NotImplementedError(
"Please implement StructuredDataClassificationPipeline __init__ function"
"Please implement TabularClassificationPipeline __init__ function"
)
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@


@skipIf(
"structured-data-classification" not in ALLOWED_TASKS,
"structured-data-classification not implemented",
"tabular-classification" not in ALLOWED_TASKS,
"tabular-classification not implemented",
)
class StructuredDataClassificationTestCase(TestCase):
class TabularClassificationTestCase(TestCase):
def setUp(self):
model_id = TESTABLE_MODELS["structured-data-classification"]
model_id = TESTABLE_MODELS["tabular-classification"]
self.old_model_id = os.getenv("MODEL_ID")
self.old_task = os.getenv("TASK")
os.environ["MODEL_ID"] = model_id
os.environ["TASK"] = "structured-data-classification"
os.environ["TASK"] = "tabular-classification"

from app.main import app

Expand Down
4 changes: 1 addition & 3 deletions docker_images/common/app/pipelines/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
from app.pipelines.question_answering import QuestionAnsweringPipeline
from app.pipelines.sentence_similarity import SentenceSimilarityPipeline
from app.pipelines.speech_segmentation import SpeechSegmentationPipeline
from app.pipelines.structured_data_classification import (
StructuredDataClassificationPipeline,
)
from app.pipelines.tabular_classification import TabularClassificationPipeline
from app.pipelines.text_to_speech import TextToSpeechPipeline
from app.pipelines.token_classification import TokenClassificationPipeline
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
from app.pipelines import Pipeline


class StructuredDataClassificationPipeline(Pipeline):
class TabularClassificationPipeline(Pipeline):
def __init__(self, model_id: str):
# IMPLEMENT_THIS
# Preload all the elements you are going to need at inference.
# For instance your model, processors, tokenizer that might be needed.
# This function is only called once, so do all the heavy processing I/O here
raise NotImplementedError(
"Please implement StructuredDataClassificationPipeline __init__ function"
"Please implement TabularClassificationPipeline __init__ function"
)

def __call__(
Expand All @@ -26,5 +26,5 @@ def __call__(
"""
# IMPLEMENT_THIS
raise NotImplementedError(
"Please implement StructuredDataClassificationPipeline __init__ function"
"Please implement TabularClassificationPipeline __init__ function"
)
4 changes: 2 additions & 2 deletions docker_images/common/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"question-answering",
"sentence-similarity",
"speech-segmentation",
"structured-data-classification",
"tabular-classification",
"text-classification",
"text-to-image",
"text-to-speech",
Expand All @@ -35,7 +35,7 @@
"sentence-similarity",
"fill-mask",
"table-question-answering",
"structured-data-classification",
"tabular-classification",
"summarization",
"text2text-generation",
"text-classification",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@


@skipIf(
"structured-data-classification" not in ALLOWED_TASKS,
"structured-data-classification not implemented",
"tabular-classification" not in ALLOWED_TASKS,
"tabular-classification not implemented",
)
class StructuredDataClassificationTestCase(TestCase):
class TabularClassificationTestCase(TestCase):
def setUp(self):
model_id = TESTABLE_MODELS["structured-data-classification"]
model_id = TESTABLE_MODELS["tabular-classification"]
self.old_model_id = os.getenv("MODEL_ID")
self.old_task = os.getenv("TASK")
os.environ["MODEL_ID"] = model_id
os.environ["TASK"] = "structured-data-classification"
os.environ["TASK"] = "tabular-classification"

from app.main import app

Expand Down
2 changes: 1 addition & 1 deletion docker_images/generic/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# This is very slow the first time as fasttext model is large.
"feature-extraction": ["osanseviero/fasttext_english"],
"image-classification": ["osanseviero/fastai_cat_vs_dog"],
"structured-data-classification": ["osanseviero/wine-quality"],
"tabular-classification": ["osanseviero/wine-quality"],
"text-classification": ["osanseviero/fasttext_nearest"],
"text-to-image": ["osanseviero/BigGAN-deep-128"],
"token-classification": ["osanseviero/en_core_web_sm"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,18 @@


@skipIf(
"structured-data-classification" not in TESTABLE_MODELS,
"structured-data-classification not implemented",
"tabular-classification" not in TESTABLE_MODELS,
"tabular-classification not implemented",
)
@parameterized_class(
[
{"model_id": model_id}
for model_id in TESTABLE_MODELS["structured-data-classification"]
]
[{"model_id": model_id} for model_id in TESTABLE_MODELS["tabular-classification"]]
)
class StructuredDataClassificationTestCase(TestCase):
class TabularClassificationTestCase(TestCase):
def setUp(self):
self.old_model_id = os.getenv("MODEL_ID")
self.old_task = os.getenv("TASK")
os.environ["MODEL_ID"] = self.model_id
os.environ["TASK"] = "structured-data-classification"
os.environ["TASK"] = "tabular-classification"

from app.main import app, get_pipeline

Expand Down
4 changes: 2 additions & 2 deletions docker_images/nemo/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"question-answering",
"sentence-similarity",
"speech-segmentation",
"structured-data-classification",
"tabular-classification",
"text-classification",
"text-to-image",
"text-to-speech",
Expand All @@ -34,7 +34,7 @@
"sentence-similarity",
"fill-mask",
"table-question-answering",
"structured-data-classification",
"tabular-classification",
"summarization",
"text2text-generation",
"text-classification",
Expand Down
4 changes: 1 addition & 3 deletions docker_images/pyannote/app/pipelines/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@
from app.pipelines.question_answering import QuestionAnsweringPipeline
from app.pipelines.sentence_similarity import SentenceSimilarityPipeline
from app.pipelines.speech_segmentation import SpeechSegmentationPipeline
from app.pipelines.structured_data_classification import (
StructuredDataClassificationPipeline,
)
from app.pipelines.tabular_classification import TabularClassificationPipeline
from app.pipelines.text_classification import TextClassificationPipeline
from app.pipelines.text_to_speech import TextToSpeechPipeline
from app.pipelines.token_classification import TokenClassificationPipeline
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
from app.pipelines import Pipeline


class StructuredDataClassificationPipeline(Pipeline):
class TabularClassificationPipeline(Pipeline):
def __init__(self, model_id: str):
# IMPLEMENT_THIS
# Preload all the elements you are going to need at inference.
# For instance your model, processors, tokenizer that might be needed.
# This function is only called once, so do all the heavy processing I/O here
raise NotImplementedError(
"Please implement StructuredDataClassificationPipeline __init__ function"
"Please implement TabularClassificationPipeline __init__ function"
)

def __call__(
Expand All @@ -26,5 +26,5 @@ def __call__(
"""
# IMPLEMENT_THIS
raise NotImplementedError(
"Please implement StructuredDataClassificationPipeline __init__ function"
"Please implement TabularClassificationPipeline __init__ function"
)
4 changes: 2 additions & 2 deletions docker_images/pyannote/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"question-answering",
"sentence-similarity",
"speech-segmentation",
"structured-data-classification",
"tabular-classification",
"text-classification",
"text-to-image",
"text-to-speech",
Expand All @@ -33,7 +33,7 @@
"sentence-similarity",
"fill-mask",
"table-question-answering",
"structured-data-classification",
"tabular-classification",
"summarization",
"text2text-generation",
"text-classification",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@


@skipIf(
"structured-data-classification" not in ALLOWED_TASKS,
"structured-data-classification not implemented",
"tabular-classification" not in ALLOWED_TASKS,
"tabular-classification not implemented",
)
class StructuredDataClassificationTestCase(TestCase):
class TabularClassificationTestCase(TestCase):
def setUp(self):
model_id = TESTABLE_MODELS["structured-data-classification"]
model_id = TESTABLE_MODELS["tabular-classification"]
self.old_model_id = os.getenv("MODEL_ID")
self.old_task = os.getenv("TASK")
os.environ["MODEL_ID"] = model_id
os.environ["TASK"] = "structured-data-classification"
os.environ["TASK"] = "tabular-classification"

from app.main import app

Expand Down
4 changes: 2 additions & 2 deletions docker_images/sklearn/app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from typing import Dict, Type

from api_inference_community.routes import pipeline_route, status_ok
from app.pipelines import Pipeline, StructuredDataClassificationPipeline
from app.pipelines import Pipeline, TabularClassificationPipeline
from starlette.applications import Starlette
from starlette.middleware import Middleware
from starlette.middleware.gzip import GZipMiddleware
Expand Down Expand Up @@ -34,7 +34,7 @@
# directories. Implement directly within the directories.
ALLOWED_TASKS: Dict[str, Type[Pipeline]] = {
# IMPLEMENT_THIS: Add your implemented tasks here!
"structured-data-classification": StructuredDataClassificationPipeline
"tabular-classification": TabularClassificationPipeline
}


Expand Down
4 changes: 1 addition & 3 deletions docker_images/sklearn/app/pipelines/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
from app.pipelines.image_classification import ImageClassificationPipeline
from app.pipelines.question_answering import QuestionAnsweringPipeline
from app.pipelines.sentence_similarity import SentenceSimilarityPipeline
from app.pipelines.structured_data_classification import (
StructuredDataClassificationPipeline,
)
from app.pipelines.tabular_classification import TabularClassificationPipeline
from app.pipelines.text_to_speech import TextToSpeechPipeline
from app.pipelines.token_classification import TokenClassificationPipeline
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
DEFAULT_FILENAME = "sklearn_model.joblib"


class StructuredDataClassificationPipeline(Pipeline):
class TabularClassificationPipeline(Pipeline):
def __init__(self, model_id: str):
self.model = joblib.load(
open(cached_download(hf_hub_url(model_id, DEFAULT_FILENAME)), "rb")
Expand Down
6 changes: 2 additions & 4 deletions docker_images/sklearn/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@
# Must contain at least one example of each implemented pipeline
# Tests do not check the actual values of the model output, so small dummy
# models are recommended for faster tests.
TESTABLE_MODELS: Dict[str, str] = {
"structured-data-classification": "julien-c/wine-quality"
}
TESTABLE_MODELS: Dict[str, str] = {"tabular-classification": "julien-c/wine-quality"}


ALL_TASKS = {
Expand All @@ -20,7 +18,7 @@
"image-classification",
"question-answering",
"sentence-similarity",
"structured-data-classification",
"tabular-classification",
"text-generation",
"text-to-speech",
"token-classification",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@


@skipIf(
"structured-data-classification" not in ALLOWED_TASKS,
"structured-data-classification not implemented",
"tabular-classification" not in ALLOWED_TASKS,
"tabular-classification not implemented",
)
class StructuredDataClassificationTestCase(TestCase):
class TabularClassificationTestCase(TestCase):
def setUp(self):
model_id = TESTABLE_MODELS["structured-data-classification"]
model_id = TESTABLE_MODELS["tabular-classification"]
self.old_model_id = os.getenv("MODEL_ID")
self.old_task = os.getenv("TASK")
os.environ["MODEL_ID"] = model_id
os.environ["TASK"] = "structured-data-classification"
os.environ["TASK"] = "tabular-classification"

from app.main import app

Expand Down
4 changes: 1 addition & 3 deletions docker_images/stanza/app/pipelines/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
from app.pipelines.question_answering import QuestionAnsweringPipeline
from app.pipelines.sentence_similarity import SentenceSimilarityPipeline
from app.pipelines.speech_segmentation import SpeechSegmentationPipeline
from app.pipelines.structured_data_classification import (
StructuredDataClassificationPipeline,
)
from app.pipelines.tabular_classification import TabularClassificationPipeline
from app.pipelines.text_to_speech import TextToSpeechPipeline
from app.pipelines.token_classification import TokenClassificationPipeline
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
from app.pipelines import Pipeline


class StructuredDataClassificationPipeline(Pipeline):
class TabularClassificationPipeline(Pipeline):
def __init__(self, model_id: str):
# IMPLEMENT_THIS
# Preload all the elements you are going to need at inference.
# For instance your model, processors, tokenizer that might be needed.
# This function is only called once, so do all the heavy processing I/O here
raise NotImplementedError(
"Please implement StructuredDataClassificationPipeline __init__ function"
"Please implement TabularClassificationPipeline __init__ function"
)

def __call__(
Expand All @@ -26,5 +26,5 @@ def __call__(
"""
# IMPLEMENT_THIS
raise NotImplementedError(
"Please implement StructuredDataClassificationPipeline __init__ function"
"Please implement TabularaClassificationPipeline __init__ function"
)
Loading