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:
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
copy_reg = copy_reg
CudaStream = CudaStream

View File

@ -10,20 +10,12 @@ import sys
import textwrap
from .symbols import ORTH
from .compat import path2str, basestring_, input_, unicode_
from .compat import cupy, CudaStream, path2str, basestring_, input_, unicode_
LANGUAGES = {}
_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):
"""Import and load a Language class.