Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip create trainset if deezy model exists #233

Merged
merged 2 commits into from
Jul 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions geoparser/ranking.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,13 +275,11 @@ def train(self) -> None:
if self.deezy_parameters["do_test"] == True:
self.deezy_parameters["dm_model"] += "_test"
self.deezy_parameters["dm_cands"] += "_test"
deezy_processing.create_training_set(
self.deezy_parameters, self.strvar_parameters, self.wikidata_to_mentions
)
deezy_processing.train_deezy_model(self.deezy_parameters)
deezy_processing.train_deezy_model(self.deezy_parameters, self.strvar_parameters, self.wikidata_to_mentions)
deezy_processing.generate_candidates(
self.deezy_parameters, self.mentions_to_wikidata
)

# This dictionary is not used anymore:
self.wikidata_to_mentions = dict()

Expand Down
5 changes: 4 additions & 1 deletion utils/deezy_processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ def create_training_set(
fw.write(pm)


def train_deezy_model(deezy_parameters: dict) -> None:
def train_deezy_model(deezy_parameters: dict, strvar_parameters: dict, wikidata_to_mentions: dict) -> None:
"""
Train a DeezyMatch model using the provided ``myranker`` parameters and
input files.
Expand Down Expand Up @@ -300,6 +300,9 @@ def train_deezy_model(deezy_parameters: dict) -> None:
)
).exists()
):
# Create the training set (if it already exists, it will be skipped):
create_training_set(deezy_parameters, strvar_parameters, wikidata_to_mentions)

# Training a DeezyMatch model
dm_train(
input_file_path=input_file_path,
Expand Down
Loading