Skip to content

Commit

Permalink
debugging trial: add use external command onmt from cli
Browse files Browse the repository at this point in the history
  • Loading branch information
irinaespejo committed May 3, 2024
1 parent e93e504 commit 56d4c17
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ install_requires =
click>=8.0
pandas>=1.1.0
rxn-chem-utils>=1.3.0
rxn-onmt-models>=1.0.0
rxn-onmt-utils>=1.0.0
rxn-onmt-models@git+https://github.com/rxn4chemistry/rxn-onmt-models.git@519a7c89af3bd68c96ec086795ff1729866db161
rxn-onmt-utils@git+https://github.com/rxn4chemistry/rxn-onmt-utils.git@f1a0b970411aac308a3cba36c942297933a4dd91
rxn-utils>=1.1.9

[options.packages.find]
Expand Down
2 changes: 2 additions & 0 deletions src/rxn/metrics/run_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ def run_model_for_metrics(
batch_size: int,
gpu: bool,
initialize_logger: bool = False,
as_external_command: bool = False,
) -> None:
ensure_directory_exists_and_is_empty(output_dir)
files = get_metrics_files(task, output_dir)
Expand All @@ -88,6 +89,7 @@ def run_model_for_metrics(
beam_size=beam_size,
batch_size=batch_size,
gpu=gpu,
as_external_command=as_external_command,
)

canonicalize_file(
Expand Down
5 changes: 5 additions & 0 deletions src/rxn/metrics/scripts/prepare_forward_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@
@click.option(
"--no_metrics", is_flag=True, help="If given, the metrics will not be computed."
)
@click.option(
"--as_external_command", type=bool, default=False, help="Run translation as external ONMT command"
)
def main(
precursors_file: Path,
products_file: Path,
Expand All @@ -47,6 +50,7 @@ def main(
n_best: int,
gpu: bool,
no_metrics: bool,
as_external_command: bool,
) -> None:
"""Starting from the ground truth files and forward model, generate the
translation files needed for the metrics, and calculate the default metrics."""
Expand All @@ -62,6 +66,7 @@ def main(
batch_size=batch_size,
gpu=gpu,
initialize_logger=True,
as_external_command=as_external_command,
)

if not no_metrics:
Expand Down

0 comments on commit 56d4c17

Please sign in to comment.