Skip to content

Commit

Permalink
sparsezoo support for sparsify.one-shot (#241)
Browse files Browse the repository at this point in the history
  • Loading branch information
bfineran committed Jun 30, 2023
1 parent 572e98e commit e7cdcfd
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/sparsify/one_shot/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import argparse
from pathlib import Path

from sparsezoo import Model
from sparsify.login import import_sparsifyml_authenticated
from sparsify.utils import constants

Expand Down Expand Up @@ -99,7 +100,7 @@ def main():

one_shot.one_shot(
task=args.task,
model_file=Path(args.model),
model_file=Path(_maybe_unwrap_zoo_stub(args.model)),
dataset_dir=Path(args.dataset),
num_samples=args.num_samples,
deploy_dir=Path(args.deploy_dir),
Expand All @@ -109,5 +110,11 @@ def main():
)


def _maybe_unwrap_zoo_stub(model_path: str) -> str:
if model_path.startswith("zoo:"):
return Model(model_path).onnx_model.path
return model_path


if __name__ == "__main__":
main()

0 comments on commit e7cdcfd

Please sign in to comment.