mirror of https://github.com/explosion/spaCy.git
avoid msg var impliciteness (#8619)
* avoid msg var impliciteness * rename local msg * Add CI tests for debug data and train * Adjust debug data CLI test Co-authored-by: Adriane Boyd <adrianeboyd@gmail.com>
This commit is contained in:
parent
e7d747e3ee
commit
608fc1d623
|
@ -78,6 +78,17 @@ steps:
|
||||||
displayName: 'Test debug config CLI'
|
displayName: 'Test debug config CLI'
|
||||||
condition: eq(variables['python_version'], '3.8')
|
condition: eq(variables['python_version'], '3.8')
|
||||||
|
|
||||||
|
- script: |
|
||||||
|
# will have errors due to sparse data, check for summary in output
|
||||||
|
python -m spacy debug data ner.cfg --paths.train ner-token-per-line-conll2003.spacy --paths.dev ner-token-per-line-conll2003.spacy | grep -q Summary
|
||||||
|
displayName: 'Test debug data CLI'
|
||||||
|
condition: eq(variables['python_version'], '3.8')
|
||||||
|
|
||||||
|
- script: |
|
||||||
|
python -m spacy train ner.cfg --paths.train ner-token-per-line-conll2003.spacy --paths.dev ner-token-per-line-conll2003.spacy --training.max_steps 10 --gpu-id -1
|
||||||
|
displayName: 'Test train CLI'
|
||||||
|
condition: eq(variables['python_version'], '3.8')
|
||||||
|
|
||||||
- script: |
|
- script: |
|
||||||
python -c "import spacy; config = spacy.util.load_config('ner.cfg'); config['components']['ner'] = {'source': 'ca_core_news_sm'}; config.to_disk('ner_source_sm.cfg')"
|
python -c "import spacy; config = spacy.util.load_config('ner.cfg'); config['components']['ner'] = {'source': 'ca_core_news_sm'}; config.to_disk('ner_source_sm.cfg')"
|
||||||
PYTHONWARNINGS="error,ignore::DeprecationWarning" python -m spacy assemble ner_source_sm.cfg output_dir
|
PYTHONWARNINGS="error,ignore::DeprecationWarning" python -m spacy assemble ner_source_sm.cfg output_dir
|
||||||
|
|
|
@ -506,12 +506,14 @@ def string_to_list(value: str, intify: bool = False) -> Union[List[str], List[in
|
||||||
|
|
||||||
def setup_gpu(use_gpu: int, silent=None) -> None:
|
def setup_gpu(use_gpu: int, silent=None) -> None:
|
||||||
"""Configure the GPU and log info."""
|
"""Configure the GPU and log info."""
|
||||||
if silent is not None:
|
if silent is None:
|
||||||
msg = Printer(no_print=silent, pretty=not silent)
|
local_msg = Printer()
|
||||||
|
else:
|
||||||
|
local_msg = Printer(no_print=silent, pretty=not silent)
|
||||||
if use_gpu >= 0:
|
if use_gpu >= 0:
|
||||||
msg.info(f"Using GPU: {use_gpu}")
|
local_msg.info(f"Using GPU: {use_gpu}")
|
||||||
require_gpu(use_gpu)
|
require_gpu(use_gpu)
|
||||||
else:
|
else:
|
||||||
msg.info("Using CPU")
|
local_msg.info("Using CPU")
|
||||||
if has_cupy and gpu_is_available():
|
if has_cupy and gpu_is_available():
|
||||||
msg.info("To switch to GPU 0, use the option: --gpu-id 0")
|
local_msg.info("To switch to GPU 0, use the option: --gpu-id 0")
|
||||||
|
|
Loading…
Reference in New Issue