Skip to content

Commit

Permalink
Spark config
Browse files Browse the repository at this point in the history
  • Loading branch information
Jose J. Martinez committed Sep 11, 2023
1 parent f486608 commit 6be482b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions grants_tagger_light/retagging/retagging.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def _create_pipelines(save_to_path, batch_size, train_df, test_df, tag):
.setOutputCol("sentence_embeddings")

retrain = True
clf_dir = f"{save_to_path}.{tag}_clf"
clf_dir = f"{save_to_path}.{tag.replace(' ', '')}_clf"
if os.path.isdir(clf_dir):
answer = "Classifier already trained. Do you want to reuse it? [y|n]: "
while answer not in ['y', 'n']:
Expand Down Expand Up @@ -122,7 +122,7 @@ def _create_pipelines(save_to_path, batch_size, train_df, test_df, tag):

def _annotate(save_to_path, dset, tag, limit, is_positive):
human_supervision = {}
curation_file = f"{save_to_path}.{tag}.curation.json"
curation_file = f"{save_to_path}.{tag.replace(' ', '')}.curation.json"
if os.path.isfile(curation_file):
with open(curation_file, 'r') as f:
human_supervision = json.load(f)
Expand Down Expand Up @@ -219,7 +219,7 @@ def retag(
logging.info(f"- Curating data...")
_curate(save_to_path, positive_dset, negative_dset, tag, train_examples)

curation_file = f"{save_to_path}.{tag}.curation.json"
curation_file = f"{save_to_path}.{tag.replace(' ', '')}.curation.json"
if os.path.isfile(curation_file):
with open(curation_file, "r") as fr:
# I load the curated data file
Expand Down Expand Up @@ -269,7 +269,7 @@ def retag(
sdf = sdf.repartition(num_proc)

logging.info(f"- Retagging {tag}...")
pipeline.transform(sdf).write.mode('overwrite').save(f"{save_to_path}.{tag}.prediction")
pipeline.transform(sdf).write.mode('overwrite').save(f"{save_to_path}.{tag.replace(' ', '')}.prediction")

# 1) We load
# 2) We filter to get those results where the predicted tag was not initially in meshMajor
Expand Down

0 comments on commit 6be482b

Please sign in to comment.