Skip to content

Commit

Permalink
table memory
Browse files Browse the repository at this point in the history
  • Loading branch information
ameen-91 committed Nov 29, 2024
1 parent 2f96713 commit 8cd18c6
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions infero/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
print_neutral,
print_success_bold,
print_error,
get_memory_usage,
)
from infero.pull.models import remove_model

Expand All @@ -19,6 +20,7 @@

@app.command("run")
def run(model: str, quantize: bool = False):
print_neutral(f"{get_memory_usage()/ 1024 / 1024} MB")
if check_model(model):
model_path = os.path.join(get_models_dir(), sanitize_model_name(model))
package_dir = get_package_dir()
Expand Down Expand Up @@ -50,12 +52,19 @@ def list_models():
models = []
for model in os.listdir(models_dir):
quantized = (
"✅"
f"{os.path.getsize(os.path.join(models_dir, model, 'model_quantized.onnx')) / 1024 / 1024:.2f}"
if os.path.exists(os.path.join(models_dir, model, "model_quantized.onnx"))
else ""
)
models.append([model, quantized])
table = tabulate(models, headers=["Name", "Quantized"], tablefmt="grid")
size = (
os.path.getsize(os.path.join(models_dir, model, "pytorch_model.bin"))
/ 1024
/ 1024
)
models.append([model, size, quantized])
table = tabulate(
models, headers=["Name", "Size (MB)", "Quantized (MB)"], tablefmt="grid"
)
print_neutral(table)


Expand Down

0 comments on commit 8cd18c6

Please sign in to comment.