Beispiel #1
0
 def __init__(self, pipeline_path="fi_geoparser", use_gpu=True, 
              output_df=True):
     if use_gpu:
         spacy.require_gpu()
     else:
         spacy.require_cpu()
     
     self.output_df = output_df
     
     self.ner_pipeline = spacy.load(pipeline_path)
def test_require_cpu():
    require_cpu()
    assert isinstance(get_current_ops(), NumpyOps)
    try:
        import cupy  # noqa: F401

        require_gpu()
        assert isinstance(get_current_ops(), CupyOps)
    except ImportError:
        pass
    require_cpu()
    assert isinstance(get_current_ops(), NumpyOps)