Skip to content

Commit

Permalink
Merge branch 'ci/configure-mono-repo' of github.com:argilla-io/argill…
Browse files Browse the repository at this point in the history
…a into ci/configure-mono-repo
  • Loading branch information
frascuchon committed Apr 24, 2024
2 parents 2abb546 + 67bc52e commit 08281f5
Show file tree
Hide file tree
Showing 124 changed files with 256 additions and 172 deletions.
1 change: 1 addition & 0 deletions scripts/end2end_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
from typing import Dict, Optional

import papermill

from argilla._constants import DEFAULT_API_KEY


Expand Down
4 changes: 3 additions & 1 deletion src/argilla/client/feedback/training/schemas/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from typing import TYPE_CHECKING, Any, Callable, Dict, Iterator, List, Optional, Tuple, Union

import pandas as pd

from argilla._constants import OPENAI_SEPARATOR, OPENAI_WHITESPACE
from argilla.client.feedback.schemas import (
FeedbackRecord,
Expand Down Expand Up @@ -61,9 +62,10 @@
if TYPE_CHECKING:
import datasets
import spacy
from argilla.client.feedback.dataset import FeedbackDataset
from sentence_transformers import InputExample

from argilla.client.feedback.dataset import FeedbackDataset


class TrainingData(ABC):
formatting_func: Optional[BaseModel] = None
Expand Down
1 change: 1 addition & 0 deletions tests/integration/client/apis/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.

import pytest

from argilla.client import singleton
from argilla.client.apis import AbstractApi, api_compatibility
from argilla.client.sdk._helpers import handle_response_error
Expand Down
6 changes: 3 additions & 3 deletions tests/integration/client/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
from typing import TYPE_CHECKING, Generator, List

import pytest
from argilla_server.models import User
from datasets import Dataset

from argilla import SpanQuestion
from argilla.client.api import log
from argilla.client.datasets import read_datasets
Expand Down Expand Up @@ -57,9 +60,6 @@
TokenClassificationBulkData,
)
from argilla.client.singleton import init
from argilla_server.models import User
from datasets import Dataset

from tests.integration.utils import delete_ignoring_errors

if TYPE_CHECKING:
Expand Down
4 changes: 3 additions & 1 deletion tests/integration/client/feedback/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from typing import TYPE_CHECKING, Any, List

import pytest

from argilla.client import singleton
from argilla.client.feedback.dataset.local.dataset import FeedbackDataset
from argilla.client.feedback.schemas.metadata import (
Expand All @@ -29,9 +30,10 @@
from argilla.feedback import TrainingTask

if TYPE_CHECKING:
from pytest_mock import MockerFixture

from argilla.client.feedback.schemas.types import AllowedFieldTypes, AllowedQuestionTypes
from argilla.client.sdk.users.models import UserModel as User
from pytest_mock import MockerFixture


@pytest.fixture
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@
import tempfile
from typing import TYPE_CHECKING, List, Type, Union

import argilla.client.singleton
import datasets
import pytest

import argilla.client.singleton
from argilla import ResponseSchema, User, Workspace
from argilla.client.feedback.config import DatasetConfig
from argilla.client.feedback.constants import FETCHING_BATCH_SIZE
Expand All @@ -38,10 +39,10 @@
from argilla.feedback import SpanValueSchema

if TYPE_CHECKING:
from argilla.client.feedback.schemas.types import AllowedFieldTypes, AllowedQuestionTypes
from argilla_server.models import User as ServerUser
from sqlalchemy.ext.asyncio import AsyncSession

from argilla.client.feedback.schemas.types import AllowedFieldTypes, AllowedQuestionTypes
from tests.integration.helpers import SecuredClient


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from typing import Callable

import pytest

from argilla.client.feedback.dataset import FeedbackDataset
from argilla.client.feedback.schemas import (
LabelQuestion,
Expand Down
10 changes: 5 additions & 5 deletions tests/integration/client/feedback/dataset/remote/test_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,13 @@
from typing import TYPE_CHECKING, Any, List, Tuple, Type
from uuid import UUID

import pytest
from argilla_server.models import User as ServerUser
from argilla_server.settings import settings
from sqlalchemy.ext.asyncio import AsyncSession

import argilla as rg
import argilla.client.singleton
import pytest
from argilla import FeedbackRecord, SuggestionSchema
from argilla.client.feedback.dataset import FeedbackDataset
from argilla.client.feedback.dataset.remote.dataset import RemoteFeedbackDataset
Expand All @@ -45,10 +49,6 @@
from argilla.client.sdk.commons.errors import ValidationApiError
from argilla.client.sdk.users.models import UserRole
from argilla.client.workspaces import Workspace
from argilla_server.models import User as ServerUser
from argilla_server.settings import settings
from sqlalchemy.ext.asyncio import AsyncSession

from tests.factories import (
DatasetFactory,
RecordFactory,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,11 @@
from typing import List, Union
from uuid import UUID

import argilla.client.singleton
import pytest
from argilla_server.models import User
from sqlalchemy.ext.asyncio import AsyncSession

import argilla.client.singleton
from argilla import SortBy, TextField, TextQuestion
from argilla.client.feedback.dataset.local.dataset import FeedbackDataset
from argilla.client.feedback.schemas.enums import ResponseStatusFilter
Expand All @@ -35,9 +38,6 @@
from argilla.client.feedback.schemas.types import AllowedFieldTypes, AllowedQuestionTypes
from argilla.client.sdk.users.models import UserRole
from argilla.client.workspaces import Workspace
from argilla_server.models import User
from sqlalchemy.ext.asyncio import AsyncSession

from tests.factories import (
DatasetFactory,
RecordFactory,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import argilla.client.singleton as rg
import pytest

import argilla.client.singleton as rg
from argilla import User, ValueSchema, Workspace
from argilla.client.feedback.schemas.enums import ResponseStatus
from argilla.client.sdk.users.models import UserRole
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
# limitations under the License.
from typing import Any, List, Union

import argilla.client.singleton as rg
import pytest

import argilla.client.singleton as rg
from argilla import User, Workspace
from argilla.feedback import (
FeedbackDataset,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@
import re
from uuid import uuid4

import argilla as rg
import pytest

import argilla as rg


@pytest.mark.skipif(os.getenv("HF_HUB_ACCESS_TOKEN") is None, reason="`HF_HUB_ACCESS_TOKEN` is not set")
class TestSuiteHuggingFaceDatasetMixin:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
from typing import TYPE_CHECKING, Callable, List, Union

import pytest

from argilla.client.feedback.schemas import (
FeedbackRecord,
LabelQuestion,
Expand All @@ -30,7 +31,6 @@
from argilla.client.feedback.unification import LabelQuestionUnification
from argilla.client.models import Framework
from argilla.feedback import ArgillaTrainer, FeedbackDataset, TrainingTask

from tests.integration.client.feedback.helpers import (
formatting_func_chat_completion,
formatting_func_dpo,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
from typing import List

import pytest
from typing_extensions import TYPE_CHECKING

from argilla import init
from argilla.client.feedback.dataset.local.dataset import FeedbackDataset
from argilla.client.feedback.integrations.sentencetransformers import SentenceTransformersExtractor
from argilla.client.feedback.schemas.fields import TextField
from argilla.client.feedback.schemas.questions import TextQuestion
from argilla.client.feedback.schemas.records import FeedbackRecord
from typing_extensions import TYPE_CHECKING

from tests.factories import WorkspaceFactory

if TYPE_CHECKING:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
from typing import List

import pytest
from typing_extensions import TYPE_CHECKING

from argilla import init
from argilla.client.feedback.dataset.local.dataset import FeedbackDataset
from argilla.client.feedback.integrations.textdescriptives import TextDescriptivesExtractor
from argilla.client.feedback.schemas.fields import TextField
from argilla.client.feedback.schemas.questions import TextQuestion
from argilla.client.feedback.schemas.records import FeedbackRecord
from typing_extensions import TYPE_CHECKING

from tests.factories import WorkspaceFactory

if TYPE_CHECKING:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from typing import TYPE_CHECKING, FrozenSet, List, Tuple, Union

import pytest

from argilla import User, init
from argilla.client.feedback.dataset import FeedbackDataset
from argilla.client.feedback.metrics.agreement_metrics import (
Expand All @@ -24,7 +25,6 @@
prepare_dataset_for_annotation_task,
)
from argilla.client.feedback.schemas import FeedbackRecord

from tests.factories import UserFactory, WorkspaceFactory

if TYPE_CHECKING:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
from typing import TYPE_CHECKING, List, Union

import pytest

from argilla import User, init
from argilla.client.feedback.dataset import FeedbackDataset
from argilla.client.feedback.metrics.annotator_metrics import AnnotatorMetric, UnifiedAnnotatorMetric
from argilla.client.feedback.metrics.base import ModelMetricResult
from argilla.client.feedback.schemas import FeedbackRecord

from tests.factories import UserFactory, WorkspaceFactory

if TYPE_CHECKING:
Expand Down
1 change: 1 addition & 0 deletions tests/integration/client/feedback/metrics/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from typing import TYPE_CHECKING, List, Optional, Union

import pytest

from argilla.client.feedback.dataset import FeedbackDataset
from argilla.client.feedback.metrics.utils import (
get_responses_and_suggestions_per_user,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@

from typing import TYPE_CHECKING, List, Type, Union

import pytest

import argilla as rg
import argilla.client.singleton
import pytest
from argilla.client.feedback.dataset.remote.dataset import RemoteFeedbackDataset
from argilla.client.feedback.schemas.remote.metadata import (
RemoteFloatMetadataProperty,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from typing import TYPE_CHECKING

import pytest

from argilla import (
FloatMetadataProperty,
IntegerMetadataProperty,
Expand All @@ -28,7 +29,6 @@
from argilla.client.feedback.schemas.records import FeedbackRecord, SuggestionSchema
from argilla.client.feedback.schemas.remote.records import RemoteFeedbackRecord, RemoteSuggestionSchema
from argilla.client.sdk.users.models import UserRole

from tests.factories import (
DatasetFactory,
RecordFactory,
Expand Down
1 change: 1 addition & 0 deletions tests/integration/client/feedback/test_unification.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.

import pytest

from argilla.client.feedback.schemas import (
FeedbackRecord,
LabelQuestion,
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/client/feedback/training/test_openai.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@

import re

import argilla as rg
import pytest

import argilla as rg
from argilla.client.feedback.training.schemas.return_types import ChatCompletionReturnTypes
from argilla.feedback import ArgillaTrainer, FeedbackDataset, TrainingTask

from tests.integration.client.feedback.helpers import formatting_func_chat_completion


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
from typing import TYPE_CHECKING, Callable, List, Union

import pytest
from sentence_transformers import CrossEncoder, InputExample, SentenceTransformer

from argilla.client.feedback.dataset import FeedbackDataset
from argilla.client.feedback.schemas.fields import TextField
from argilla.client.feedback.schemas.questions import LabelQuestion
Expand All @@ -25,8 +27,6 @@
RatingQuestionUnification,
TrainingTask,
)
from sentence_transformers import CrossEncoder, InputExample, SentenceTransformer

from tests.integration.client.feedback.helpers import (
formatting_func_sentence_transformers,
formatting_func_sentence_transformers_all_lists,
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/client/feedback/training/test_trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
import sys
from pathlib import Path

from transformers import AutoModelForSequenceClassification, AutoTokenizer

from argilla.client.feedback.dataset import FeedbackDataset
from argilla.client.feedback.schemas import (
FeedbackRecord,
Expand All @@ -48,8 +50,6 @@
)
from argilla.client.feedback.unification import LabelQuestionUnification
from argilla.client.models import Framework
from transformers import AutoModelForSequenceClassification, AutoTokenizer

from tests.integration.training.helpers import train_with_cleanup

__OUTPUT_DIR__ = "tmp"
Expand Down
10 changes: 5 additions & 5 deletions tests/integration/client/feedback/training/test_trl.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@
from typing import TYPE_CHECKING, Any, Callable, Dict, Iterator, List

import pytest
from datasets import Dataset, DatasetDict
from peft import LoraConfig, TaskType
from transformers import AutoModelForCausalLM, AutoModelForSequenceClassification, AutoTokenizer
from trl import AutoModelForCausalLMWithValueHead

from argilla.client.feedback.dataset import FeedbackDataset
from argilla.client.feedback.schemas.records import FeedbackRecord
from argilla.client.feedback.training.base import ArgillaTrainer
Expand All @@ -30,11 +35,6 @@
RMReturnTypes,
SFTReturnTypes,
)
from datasets import Dataset, DatasetDict
from peft import LoraConfig, TaskType
from transformers import AutoModelForCausalLM, AutoModelForSequenceClassification, AutoTokenizer
from trl import AutoModelForCausalLMWithValueHead

from tests.integration.client.feedback.helpers import (
formatting_func_dpo,
formatting_func_ppo,
Expand Down
Loading

0 comments on commit 08281f5

Please sign in to comment.