From fdec8b3ea6eb6a22731c13a582b1a22896ed8769 Mon Sep 17 00:00:00 2001 From: schneider Date: Sat, 26 Oct 2024 18:34:41 +0200 Subject: [PATCH] Fix Metaphor Annotation for use without GPU. --- setup.cfg | 2 +- src/freestylo/MetaphorAnnotation.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.cfg b/setup.cfg index ede46b7..0f7718b 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = freestylo -version = 0.2.0 +version = 0.3.0 description = A tool for stylistic device detection." author = Felix Schneider author_email = felix.schneider@uni-jena.de diff --git a/src/freestylo/MetaphorAnnotation.py b/src/freestylo/MetaphorAnnotation.py index 096bdc6..84bc9ec 100644 --- a/src/freestylo/MetaphorAnnotation.py +++ b/src/freestylo/MetaphorAnnotation.py @@ -36,7 +36,7 @@ def serialize(self) -> list: def load_model(self, model_path): model_path = get_model_path(model_path) self.model = SimilarityNN.SimilarityNN(300, 128, 1, 128, self.device) - self.model.load_state_dict(torch.load(model_path, weights_only=True)) + self.model.load_state_dict(torch.load(model_path, weights_only=True, map_location=self.device)) self.model = self.model.to(self.device) self.model.eval()