spaCy/spacy/ml/models/__init__.py
Paul O'Leary McCann 9da16df96e Add guards around torch import
Torch is required for the coref/spanpred models but shouldn't be
required for spaCy in general.

The one tricky part of this is that one function in coref_util relied on
torch, but that file was imported in several places. Since the function
was only used in one place I moved it there.
2022-05-24 15:16:25 +09:00

17 lines
376 B
Python

from .entity_linker import * # noqa
from .multi_task import * # noqa
from .parser import * # noqa
from .spancat import * # noqa
from .tagger import * # noqa
from .textcat import * # noqa
from .tok2vec import * # noqa
# some models require Torch
try:
import torch
from .coref import * #noqa
from .span_predictor import * #noqa
except ImportError:
pass