-
Notifications
You must be signed in to change notification settings - Fork 18
Closed
Description
Describe the bug
Because vetiver's TorchHandler class tries to set base_class = torch.nn.Module when it is defined, it cannot be imported without torch. Since it is imported in vetiver.handlers, not having torch causes an error on import.
To Reproduce
From vetiver repo
python -m venv env
source env/bin/activate
pip install .
from python
import vetiver.handlersoutput:
>>> import vetiver.handlers
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/machow/repos/vetiver-python/vetiver/__init__.py", line 9, in <module>
from .vetiver_model import VetiverModel
File "/Users/machow/repos/vetiver-python/vetiver/vetiver_model.py", line 3, in <module>
from vetiver.handlers._interface import create_handler
File "/Users/machow/repos/vetiver-python/vetiver/handlers/_interface.py", line 1, in <module>
from vetiver.handlers import torch, sklearn, base
File "/Users/machow/repos/vetiver-python/vetiver/handlers/torch.py", line 13, in <module>
class TorchHandler(VetiverHandler):
File "/Users/machow/repos/vetiver-python/vetiver/handlers/torch.py", line 22, in TorchHandler
base_class = torch.nn.Module
NameError: name 'torch' is not definedReactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
Done