Move cupy and CudaStream to compat

This commit is contained in:
ines 2017-05-18 14:12:45 +02:00
parent 33decd85b6
commit abf0188b0a
2 changed files with 12 additions and 9 deletions

View File

@ -16,6 +16,17 @@ try:
except ImportError: except ImportError:
import copyreg as copy_reg import copyreg as copy_reg
try:
from cupy.cuda.stream import Stream as CudaStream
except ImportError:
CudaStream = None
try:
import cupy
except ImportError:
cupy = None
pickle = pickle pickle = pickle
copy_reg = copy_reg copy_reg = copy_reg
CudaStream = CudaStream CudaStream = CudaStream

View File

@ -10,20 +10,12 @@ import sys
import textwrap import textwrap
from .symbols import ORTH from .symbols import ORTH
from .compat import path2str, basestring_, input_, unicode_ from .compat import cupy, CudaStream, path2str, basestring_, input_, unicode_
LANGUAGES = {} LANGUAGES = {}
_data_path = Path(__file__).parent / 'data' _data_path = Path(__file__).parent / 'data'
try:
from cupy.cuda.stream import Stream as CudaStream
except ImportError:
CudaStream = None
try:
import cupy
except ImportError:
cupy = None
def get_lang_class(lang): def get_lang_class(lang):
"""Import and load a Language class. """Import and load a Language class.