mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-24 17:06:29 +03:00
Fix silent evaluation (#8581)
* fix silentness * sneak in docs typo fix * pass silent boolean instead
This commit is contained in:
parent
3daf57d70c
commit
b9f59118bf
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user