aac_metrics.functional.spice module¶
- check_spice_install( ) None[source]¶
Check if SPICE is installed in cache directory.
Raises FileNotFoundError or NotADirectoryError exception if something is missing.
- spice(
- candidates: list[str],
- mult_references: list[list[str]],
- return_all_scores: bool =
True, - *,
- cache_path: str | Path | None =
None, - java_path: str | Path | None =
None, - tmp_path: str | Path | None =
None, - n_threads: int | None =
None, - java_max_memory: str =
'8G', - timeout: None | int | Iterable[int] =
None, - separate_cache_dir: bool =
True, - use_shell: bool | None =
None, - verbose: int =
0, Semantic Propositional Image Caption Evaluation function.
- Parameters:¶
- candidates: list[str]¶
The list of sentences to evaluate.
- mult_references: list[list[str]]¶
The list of list of sentences used as target.
- return_all_scores: bool =
True¶ If True, returns a tuple containing the globals and locals scores. Otherwise returns a scalar tensor containing the main global score. defaults to True.
- cache_path: str | Path | None =
None¶ The path to the external code directory. defaults to the value returned by
get_default_cache_path().- java_path: str | Path | None =
None¶ The path to the java executable. defaults to the value returned by
get_default_java_path().- tmp_path: str | Path | None =
None¶ Temporary directory path. defaults to the value returned by
get_default_tmp_path().- n_threads: int | None =
None¶ Number of threads used to compute SPICE. None value will use the default value of the java program. defaults to None.
- java_max_memory: str =
'8G'¶ The maximal java memory used. defaults to “8G”.
- timeout: None | int | Iterable[int] =
None¶ The number of seconds before killing the java subprogram. If a list is given, it will restart the program if the i-th timeout is reached. If None, no timeout will be used. defaults to None.
- separate_cache_dir: bool =
True¶ If True, the SPICE cache files will be stored into in a new temporary directory. This removes potential freezes when multiple instances of SPICE are running in the same cache dir. defaults to True.
- use_shell: bool | None =
None¶ Optional argument to force use os-specific shell for the java subprogram. If None, it will use shell only on Windows OS. defaults to None.
- verbose: int =
0¶ The verbose level. defaults to 0.
- Returns:¶
A tuple of globals and locals scores or a scalar tensor with the main global score.