Skip to content
This repository was archived by the owner on Nov 11, 2025. It is now read-only.
Open
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
28 changes: 14 additions & 14 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ ci:

repos:
- repo: https://github.com/compilerla/conventional-pre-commit
rev: v2.4.0
rev: v4.3.0
hooks:
- id: conventional-pre-commit
stages: [commit-msg]
Expand All @@ -36,7 +36,7 @@ repos:
]

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v6.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
Expand Down Expand Up @@ -70,71 +70,71 @@ repos:
- id: text-unicode-replacement-char

- repo: https://github.com/Lucas-C/pre-commit-hooks-safety
rev: v1.3.2
rev: v1.4.2
hooks:
- id: python-safety-dependencies-check
files: pyproject.toml

- repo: https://github.com/PyCQA/docformatter
rev: v1.7.5
rev: v1.7.7
hooks:
- id: docformatter

- repo: https://github.com/nbQA-dev/nbQA
rev: 1.7.0
rev: 1.9.1
hooks:
- id: nbqa-check-ast
- id: nbqa-mypy
args: ["--config-file=pyproject.toml"]
- id: nbqa-pyupgrade

- repo: https://github.com/bwhmather/ssort
rev: v0.11.6
rev: 0.15.0
hooks:
- id: ssort

- repo: https://github.com/asottile/pyupgrade
rev: v3.15.0
rev: v3.21.1
hooks:
- id: pyupgrade

- repo: https://github.com/psf/black
rev: 23.10.1
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 25.11.0
hooks:
- id: black
- id: black-jupyter
files: \.ipynb$

- repo: https://github.com/PyCQA/isort
rev: 5.12.0
rev: 7.0.0
hooks:
- id: isort
args: ["--profile=black"]

- repo: https://github.com/PyCQA/pylint
rev: v3.0.1
rev: v4.0.2
hooks:
- id: pylint
args: ["--rcfile=pyproject.toml"]

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.6.1
rev: v1.18.2
hooks:
- id: mypy
args:
- "--config-file=pyproject.toml"
exclude: "tests"

- repo: https://github.com/PyCQA/bandit
rev: 1.7.5
rev: 1.8.6
hooks:
- id: bandit
exclude: "^tests/"
args:
- "-r"

- repo: https://github.com/kynan/nbstripout
rev: 0.6.1
rev: 0.8.1
hooks:
- id: nbstripout

Expand Down
2 changes: 1 addition & 1 deletion src/autoembedder/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def __init__(

@staticmethod
def _data_from_source(
source: Union[str, dd.DataFrame, pd.DataFrame]
source: Union[str, dd.DataFrame, pd.DataFrame],
) -> dd.DataFrame:
if isinstance(source, str):
try:
Expand Down
8 changes: 5 additions & 3 deletions src/autoembedder/evaluator.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,11 @@ def _predict(
device = torch.device(
"cuda"
if torch.cuda.is_available()
else "mps"
if torch.backends.mps.is_available() and parameters.get("use_mps", False)
else "cpu"
else (
"mps"
if torch.backends.mps.is_available() and parameters.get("use_mps", False)
else "cpu"
)
)

with torch.no_grad():
Expand Down
19 changes: 12 additions & 7 deletions src/autoembedder/learner.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,9 +362,12 @@ def fit(
torch.device(
"cuda"
if torch.cuda.is_available()
else "mps"
if torch.backends.mps.is_available() and parameters.get("use_mps", False)
else "cpu"
else (
"mps"
if torch.backends.mps.is_available()
and parameters.get("use_mps", False)
else "cpu"
)
)
)
if (
Expand Down Expand Up @@ -437,10 +440,12 @@ def fit(
map_location=torch.device(
"cuda"
if torch.cuda.is_available()
else "mps"
if torch.backends.mps.is_available()
and parameters.get("use_mps", False)
else "cpu"
else (
"mps"
if torch.backends.mps.is_available()
and parameters.get("use_mps", False)
else "cpu"
)
),
)
Checkpoint.load_objects(
Expand Down
8 changes: 5 additions & 3 deletions src/autoembedder/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,11 @@ def model_input(
device = torch.device(
"cuda"
if torch.cuda.is_available()
else "mps"
if torch.backends.mps.is_available() and parameters.get("use_mps", False)
else "cpu"
else (
"mps"
if torch.backends.mps.is_available() and parameters.get("use_mps", False)
else "cpu"
)
)
cat = []
cont = []
Expand Down
Loading