From c6f5bb03fad5989a057bb5a2cebbd365e4aeb835 Mon Sep 17 00:00:00 2001 From: Ahmed Harmouche Date: Thu, 5 Dec 2024 16:23:45 +0100 Subject: [PATCH] YoloV8 WebGPU fixes (#8057) * Bump up input size to 416, show if webgpu is not supported * Minor fix in export_model --- examples/webgpu/yolov8/compile.py | 2 +- examples/webgpu/yolov8/index.html | 15 +++++++++++---- extra/export_model.py | 2 +- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/examples/webgpu/yolov8/compile.py b/examples/webgpu/yolov8/compile.py index 32097dd9cd..a5f9d2bc5c 100644 --- a/examples/webgpu/yolov8/compile.py +++ b/examples/webgpu/yolov8/compile.py @@ -12,7 +12,7 @@ if __name__ == "__main__": yolo_infer = YOLOv8(w=0.25, r=2.0, d=0.33, num_classes=80) state_dict = safe_load(get_weights_location(yolo_variant)) load_state_dict(yolo_infer, state_dict) - prg, inp_sizes, out_sizes, state = export_model(yolo_infer, Device.DEFAULT.lower(), Tensor.randn(1,3,256,256)) + prg, inp_sizes, out_sizes, state = export_model(yolo_infer, Device.DEFAULT.lower(), Tensor.randn(1,3,416,416)) dirname = Path(__file__).parent safe_save(state, (dirname / "net.safetensors").as_posix()) with open(dirname / f"net.js", "w") as text_file: diff --git a/examples/webgpu/yolov8/index.html b/examples/webgpu/yolov8/index.html index e5daf83b11..39d8231d0f 100644 --- a/examples/webgpu/yolov8/index.html +++ b/examples/webgpu/yolov8/index.html @@ -95,6 +95,7 @@

YOLOv8 tinygrad WebGPU

+
@@ -107,7 +108,7 @@