Skip to content

Commit 7ca2b98

Browse files
committed
fix mypy
1 parent 6b85ee0 commit 7ca2b98

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

autointent/_callbacks/tensorboard.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def __init__(self) -> None:
1616
Raises an ImportError if neither are installed.
1717
"""
1818
try:
19-
from torch.utils.tensorboard import SummaryWriter
19+
from torch.utils.tensorboard import SummaryWriter # type: ignore[attr-defined]
2020

2121
self.writer = SummaryWriter
2222
except ImportError:

autointent/_dump_tools.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,15 +260,15 @@ def load( # noqa: C901, PLR0912, PLR0915
260260
elif child.name == Dumper.ptuning_models:
261261
for model_dir in child.iterdir():
262262
try:
263-
model = AutoModelForSequenceClassification.from_pretrained(model_dir / "base_model")
263+
model = AutoModelForSequenceClassification.from_pretrained(model_dir / "base_model") # type: ignore[no-untyped-call]
264264
hf_models[model_dir.name] = PeftModel.from_pretrained(model, model_dir / "peft")
265265
except Exception as e: # noqa: PERF203
266266
msg = f"Error loading PeftModel {model_dir.name}: {e}"
267267
logger.exception(msg)
268268
elif child.name == Dumper.hf_models:
269269
for model_dir in child.iterdir():
270270
try:
271-
hf_models[model_dir.name] = AutoModelForSequenceClassification.from_pretrained(model_dir)
271+
hf_models[model_dir.name] = AutoModelForSequenceClassification.from_pretrained(model_dir) # type: ignore[no-untyped-call]
272272
except Exception as e: # noqa: PERF203
273273
msg = f"Error loading HF model {model_dir.name}: {e}"
274274
logger.exception(msg)

autointent/modules/scoring/_bert.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def _initialize_model(self) -> Any: # noqa: ANN401
7676
label2id = {i: i for i in range(self._n_classes)}
7777
id2label = {i: i for i in range(self._n_classes)}
7878

79-
return AutoModelForSequenceClassification.from_pretrained(
79+
return AutoModelForSequenceClassification.from_pretrained( # type: ignore[no-untyped-call]
8080
self.classification_model_config.model_name,
8181
trust_remote_code=self.classification_model_config.trust_remote_code,
8282
num_labels=self._n_classes,

autointent/modules/scoring/_cnn/textcnn.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def load(self, model_path: str) -> None:
6868
state_dict = torch.load(model_path)
6969
self.load_state_dict(state_dict)
7070

71-
def get_config(self) -> dict[str, int | list[int] | torch.Tensor | None]:
71+
def get_config(self) -> dict[str, int | list[int] | torch.Tensor | float | None]:
7272
return {
7373
"vocab_size": self.vocab_size,
7474
"n_classes": self.n_classes,

0 commit comments

Comments
 (0)