Upload export_job.py with huggingface_hub
Browse files- export_job.py +2 -2
export_job.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
# /// script
|
| 2 |
# requires-python = ">=3.11"
|
| 3 |
-
# dependencies = ["torch", "torchvision", "pillow", "numpy", "onnx", "onnxscript", "onnx2tf", "tensorflow-cpu", "huggingface_hub>=0.30", "timm", "datasets>=4.0"]
|
| 4 |
# ///
|
| 5 |
"""HF-job credibility gate: convert the wave-3 winner checkpoint (best.pt) to a
|
| 6 |
quantized TFLite model for ESP32 TFLite-Micro and upload the artifact to the code repo.
|
|
@@ -47,7 +47,7 @@ print("arch:", arch, "params:", sum(p.numel() for p in model.parameters()), flus
|
|
| 47 |
|
| 48 |
SIZE = 224
|
| 49 |
onnx_path = "/tmp/model_full_224.onnx"
|
| 50 |
-
torch.onnx.export(model, torch.zeros(1, 3, SIZE, SIZE), onnx_path, opset_version=17,
|
| 51 |
input_names=["spectrogram"], output_names=["wake_logit", "sound_class_logits"],
|
| 52 |
dynamic_axes={"spectrogram": {0: "batch"}})
|
| 53 |
print("onnx exported", flush=True)
|
|
|
|
| 1 |
# /// script
|
| 2 |
# requires-python = ">=3.11"
|
| 3 |
+
# dependencies = ["torch", "torchvision", "pillow", "numpy", "onnx", "onnxscript", "onnx2tf", "tensorflow-cpu", "tf-keras", "huggingface_hub>=0.30", "timm", "datasets>=4.0"]
|
| 4 |
# ///
|
| 5 |
"""HF-job credibility gate: convert the wave-3 winner checkpoint (best.pt) to a
|
| 6 |
quantized TFLite model for ESP32 TFLite-Micro and upload the artifact to the code repo.
|
|
|
|
| 47 |
|
| 48 |
SIZE = 224
|
| 49 |
onnx_path = "/tmp/model_full_224.onnx"
|
| 50 |
+
torch.onnx.export(model, torch.zeros(1, 3, SIZE, SIZE), onnx_path, opset_version=17, dynamo=False,
|
| 51 |
input_names=["spectrogram"], output_names=["wake_logit", "sound_class_logits"],
|
| 52 |
dynamic_axes={"spectrogram": {0: "batch"}})
|
| 53 |
print("onnx exported", flush=True)
|