Skip to content
Open
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
4 changes: 2 additions & 2 deletions detecto/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ def save(self, file):
torch.save(self._model.state_dict(), file)

@staticmethod
def load(file, classes):
def load(file, classes, model_name=DEFAULT):
"""Loads a model from a .pth file containing the model weights.

:param file: The path to the .pth file containing the saved model.
Expand All @@ -613,7 +613,7 @@ def load(file, classes):
>>> model = Model.load('model_weights.pth', ['ant', 'bee'])
"""

model = Model(classes)
model = Model(classes, model_name=model_name)
model._model.load_state_dict(torch.load(file, map_location=model._device))
return model

Expand Down