Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into alekseymalakhov11-upd…
Browse files Browse the repository at this point in the history
…ate-docs-and-poetry
  • Loading branch information
Малахов Алексей Павлович committed Sep 22, 2024
2 parents 90e119b + 2b9f206 commit 6b74df2
Show file tree
Hide file tree
Showing 23 changed files with 1,213 additions and 29 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,4 @@ gpu = ["faiss-gpu", "xformers", "vllm"]

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
build-backend = "poetry.core.masonry.api"
3 changes: 2 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,8 @@ disable=
W0622,
# Too many ancestors
R0901,

# logging-fstring-interpolation
W1203,
ignore=
data
ignore-patterns=
3 changes: 1 addition & 2 deletions turbo_alignment/common/data/multimodal/registry.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from allenai_common import Registrable

from turbo_alignment.common.registry import Registrable
from turbo_alignment.settings.modality import Modality


Expand Down
4 changes: 4 additions & 0 deletions turbo_alignment/common/registry/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from turbo_alignment.common.registry.from_params import FromParams
from turbo_alignment.common.registry.lazy import Lazy
from turbo_alignment.common.registry.params import Params
from turbo_alignment.common.registry.registrable import Registrable
17 changes: 17 additions & 0 deletions turbo_alignment/common/registry/checks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# mypy: ignore-errors
import logging
from typing import Any

logger = logging.getLogger(__name__)


class ConfigurationError(Exception):
def __reduce__(self) -> str | tuple[Any, ...]:
return type(self), (self.message,)

def __init__(self, message: str):
super().__init__()
self.message = message

def __str__(self):
return self.message
24 changes: 24 additions & 0 deletions turbo_alignment/common/registry/file_utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# mypy: ignore-errors
import logging
import os
from pathlib import Path

import cached_path as _cached_path

logger = logging.getLogger(__name__)


def cached_path(
url_or_filename: str | os.PathLike,
cache_dir: str | Path = None,
extract_archive: bool = False,
force_extract: bool = False,
) -> str:
return str(
_cached_path.cached_path(
url_or_filename,
cache_dir=cache_dir,
extract_archive=extract_archive,
force_extract=force_extract,
)
)
Loading

0 comments on commit 6b74df2

Please sign in to comment.