Fix silent evaluation (#8581)

* fix silentness

* sneak in docs typo fix

* pass silent boolean instead
This commit is contained in:
Sofie Van Landeghem 2021-07-06 14:16:19 +02:00 committed by GitHub
parent 3daf57d70c
commit b9f59118bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 7 deletions

View File

@ -2,7 +2,7 @@ from typing import Dict, Any, Union, List, Optional, Tuple, Iterable, TYPE_CHECK
import sys
import shutil
from pathlib import Path
from wasabi import msg
from wasabi import msg, Printer
import srsly
import hashlib
import typer
@ -504,8 +504,10 @@ def string_to_list(value: str, intify: bool = False) -> Union[List[str], List[in
return result
def setup_gpu(use_gpu: int) -> None:
def setup_gpu(use_gpu: int, silent=None) -> None:
"""Configure the GPU and log info."""
if silent is not None:
msg = Printer(no_print=silent, pretty=not silent)
if use_gpu >= 0:
msg.info(f"Using GPU: {use_gpu}")
require_gpu(use_gpu)

View File

@ -64,7 +64,7 @@ def evaluate(
) -> Dict[str, Any]:
msg = Printer(no_print=silent, pretty=not silent)
fix_random_seed()
setup_gpu(use_gpu)
setup_gpu(use_gpu, silent=silent)
data_path = util.ensure_path(data_path)
output_path = util.ensure_path(output)
displacy_path = util.ensure_path(displacy_path)

View File

@ -1105,10 +1105,10 @@ While you could use a registered function or a file loader like
[`srsly.read_json.v1`](/api/top-level#file_readers) as an argument of the
component factory, this approach is problematic: the component factory runs
**every time the component is created**. This means it will run when creating
the `nlp` object before training, but also every a user loads your pipeline. So
your runtime pipeline would either depend on a local path on your file system,
or it's loaded twice: once when the component is created, and then again when
the data is by `from_disk`.
the `nlp` object before training, but also every time a user loads your
pipeline. So your runtime pipeline would either depend on a local path on your
file system, or it's loaded twice: once when the component is created, and then
again when the data is by `from_disk`.
> ```ini
> ### config.cfg