Skip to content

Commit

Permalink
extract gpt ckpt fix
Browse files Browse the repository at this point in the history
  • Loading branch information
albertbou92 committed May 21, 2024
1 parent c00174a commit befc5cc
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions acegen/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,19 @@ def extract(path):
if tar_path.exists():
logging.info("Extracting model checkpoint...")
with tarfile.open(tar_path, "r:gz") as tar:
tar.extractall()
tar.extractall(path=path.parent)
return path
else:
raise FileNotFoundError(f"File {path} not found.")
else:
return path


# extracting big model files only if they are not already extracted
if not Path("gpt2_enamine_real.ckpt").exists():
extract(resources.files("acegen.priors") / "gpt2_enamine_real.ckpt.tar.gz")


models = {
"gru": (
create_gru_actor,
Expand All @@ -63,7 +68,7 @@ def extract(path):
create_gpt2_critic,
create_gpt2_actor_critic,
resources.files("acegen.priors") / "enamine_real_vocabulary.txt",
extract(resources.files("acegen.priors") / "gpt2_enamine_real.ckpt"),
resources.files("acegen.priors") / "gpt2_enamine_real.ckpt",
SMILESTokenizerEnamine(),
),
}
Expand Down

0 comments on commit befc5cc

Please sign in to comment.