This repository has been archived by the owner on Jan 8, 2025. It is now read-only.
forked from ml4ai/skema
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[data] Refactors skema to fetch artifacts locally instead of from art…
…ifacts.askem.lum.ai (ml4ai#881) ## Summary of Changes Refactors skema codebase to fetch data artifacts locally instead of from artifacts.askem.lum.ai. ### Changes - skema.data submodule created to store local artifacts - model zip archives now stored locally under skema/data - img2mml model is stored in a huggingface repository and is downloaded at runtime. - huggingface_hub added as a dependency - `deploy.yml` workflow removed - Old `.drone.yml` CI file removed - Updated documentation to account for these changes
- Loading branch information
1 parent
482b768
commit 6cda598
Showing
34 changed files
with
95 additions
and
179 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import os | ||
from pathlib import Path | ||
|
||
from huggingface_hub import hf_hub_download | ||
|
||
def retrieve_model(model_path=None) -> str: | ||
""" | ||
Retrieve the img2mml model from the specified path or download it if not found. | ||
Args: | ||
model_path (str, optional): Path to the img2mml model file. Defaults to None. | ||
Returns: | ||
str: Path to the loaded model file. | ||
""" | ||
cwd = Path(__file__).parents[0] | ||
REPO_NAME = "lum-ai/img2mml" | ||
MODEL_NAME = "cnn_xfmer_arxiv_im2mml_with_fonts_boldface_best.pt" | ||
# If the model path is none or doesn't exist, the default model will be downloaded from server. | ||
if model_path is None or not os.path.exists(model_path): | ||
model_path = cwd / "trained_models" / MODEL_NAME | ||
|
||
# Check if the model file already exists | ||
if not os.path.exists(model_path): | ||
# If the file doesn't exist, download it from the specified URL | ||
print(f"Downloading the model checkpoint from HuggingFace...") | ||
hf_hub_download(repo_id=REPO_NAME, filename=MODEL_NAME, local_dir=model_path.parent, local_dir_use_symlinks=False) | ||
|
||
return str(model_path) | ||
|
||
retrieve_model() |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from pathlib import Path | ||
|
||
MODEL_ZIP_ROOT_PATH = Path(__file__).parent |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,56 @@ | ||
--- | ||
CHIME-penn-full: | ||
zip_archive: "https://artifacts.askem.lum.ai/askem/data/models/zip-archives/CHIME-penn-full-model.zip" | ||
zip_archive: "CHIME-penn-full-model.zip" | ||
|
||
CHIME-SIR: | ||
zip_archive: "https://artifacts.askem.lum.ai/askem/data/models/zip-archives/CHIME-SIR-model.zip" | ||
zip_archive: "CHIME-SIR-model.zip" | ||
|
||
CHIME-SVIIvR: | ||
zip_archive: "https://artifacts.askem.lum.ai/askem/data/models/zip-archives/CHIME-SVIIvR-model.zip" | ||
zip_archive: "CHIME-SVIIvR-model.zip" | ||
|
||
ABM-COmplexVID-19: | ||
zip_archive: "https://artifacts.askem.lum.ai/askem/data/models/zip-archives/ABM-COmplexVID-19.zip" | ||
zip_archive: "ABM-COmplexVID-19.zip" | ||
|
||
ABM-COVID-ABS: | ||
zip_archive: "https://artifacts.askem.lum.ai/askem/data/models/zip-archives/ABM-COVID-ABS.zip" | ||
zip_archive: "ABM-COVID-ABS.zip" | ||
|
||
CHIME-penn-full: | ||
zip_archive: "https://artifacts.askem.lum.ai/askem/data/models/zip-archives/CHIME-penn-full-model.zip" | ||
zip_archive: "CHIME-penn-full-model.zip" | ||
|
||
MechBayes: | ||
zip_archive: "https://artifacts.askem.lum.ai/askem/data/models/zip-archives/MechBayes.zip" | ||
zip_archive: "MechBayes.zip" | ||
|
||
SIDARTHE: | ||
zip_archive: "https://artifacts.askem.lum.ai/askem/data/models/zip-archives/SIDARTHE.zip" | ||
zip_archive: "SIDARTHE.zip" | ||
|
||
Simple-SIR: | ||
zip_archive: "https://artifacts.askem.lum.ai/askem/data/models/zip-archives/Simple-SIR.zip" | ||
zip_archive: "Simple-SIR.zip" | ||
|
||
Climlab-v1: | ||
zip_archive: "https://artifacts.askem.lum.ai/askem/data/models/zip-archives/Climlab.zip" | ||
zip_archive: "Climlab.zip" | ||
|
||
Climlab-v2: | ||
zip_archive: "https://artifacts.askem.lum.ai/askem/data/models/zip-archives/climlab-v2.zip" | ||
zip_archive: "climlab-v2.zip" | ||
|
||
Examples-Python: | ||
zip_archive: "https://artifacts.askem.lum.ai/askem/data/models/zip-archives/examples_python.zip" | ||
zip_archive: "examples_python.zip" | ||
|
||
Generated-Halfar: | ||
zip_archive: "https://artifacts.askem.lum.ai/askem/data/models/zip-archives/Generated-Halfar.zip" | ||
zip_archive: "Generated-Halfar.zip" | ||
|
||
SV2AIR3-Waterloo-MATLAB: | ||
zip_archive: "https://artifacts.askem.lum.ai/askem/data/models/zip-archives/SV2AIR3-Waterloo-MATLAB.zip" | ||
zip_archive: "SV2AIR3-Waterloo-MATLAB.zip" | ||
|
||
Bucky: | ||
zip_archive: "https://artifacts.askem.lum.ai/askem/data/models/zip-archives/Bucky.zip" | ||
zip_archive: "Bucky.zip" | ||
|
||
ABM-REINA: | ||
zip_archive: "https://artifacts.askem.lum.ai/askem/data/models/zip-archives/ABM-REINA.zip" | ||
zip_archive: "ABM-REINA.zip" | ||
|
||
Cornell-COVID19-sim-Frazier: | ||
zip_archive: "https://artifacts.askem.lum.ai/askem/data/models/zip-archives/Cornell-COVID19-sim-Frazier.zip" | ||
zip_archive: "Cornell-COVID19-sim-Frazier.zip" | ||
|
||
ABM-Covasim: | ||
zip_archive: "https://artifacts.askem.lum.ai/askem/data/models/zip-archives/ABM-Covasim.zip" | ||
zip_archive: "ABM-Covasim.zip" | ||
|
||
TIE-GCM: | ||
zip_archive: "https://artifacts.askem.lum.ai/askem/data/models/zip-archives/TIE-GCM.zip" | ||
zip_archive: "TIE-GCM.zip" |
Oops, something went wrong.