mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-24 00:46:28 +03:00
Fix evaluate for non-GPU
This commit is contained in:
parent
32b9f3d1a6
commit
f24c2e3a8a
|
@ -39,7 +39,7 @@ def evaluate(cmd, model, data_path, gpu_id=-1, gold_preproc=False):
|
|||
Train a model. Expects data in spaCy's JSON format.
|
||||
"""
|
||||
util.use_gpu(gpu_id)
|
||||
util.set_env_log(True)
|
||||
util.set_env_log(False)
|
||||
data_path = util.ensure_path(data_path)
|
||||
if not data_path.exists():
|
||||
prints(data_path, title="Evaluation data not found", exits=1)
|
||||
|
|
|
@ -563,7 +563,10 @@ def minify_html(html):
|
|||
|
||||
|
||||
def use_gpu(gpu_id):
|
||||
import cupy.cuda.device
|
||||
try:
|
||||
import cupy.cuda.device
|
||||
except ImportError:
|
||||
return None
|
||||
from thinc.neural.ops import CupyOps
|
||||
device = cupy.cuda.device.Device(gpu_id)
|
||||
device.use()
|
||||
|
|
Loading…
Reference in New Issue
Block a user