From 8b7a74570f5f9cbc23e1d0eacdd618ff9cfe1e93 Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Tue, 27 Mar 2018 19:22:52 +0200 Subject: [PATCH] Revert "Revert "Merge branch 'develop' of https://github.com/explosion/spaCy into develop"" This reverts commit f41e626844c62c1cf1333a99df2e027ec205a7c6. --- spacy/util.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/spacy/util.py b/spacy/util.py index dc51e467d..f6b0b6a35 100644 --- a/spacy/util.py +++ b/spacy/util.py @@ -14,6 +14,7 @@ from collections import OrderedDict import inspect import warnings from thinc.neural._classes.model import Model +from thinc.neural.ops import NumpyOps import functools import cytoolz import itertools @@ -241,7 +242,12 @@ def is_in_jupyter(): def get_cuda_stream(require=False): - return CudaStream() if CudaStream is not None else None + if CudaStream is None: + return None + elif isinstance(Model.ops, NumpyOps): + return None + else: + return CudaStream() def get_async(stream, numpy_array):