88
99 "github.com/tphakala/birdnet-go/internal/classifier"
1010 "github.com/tphakala/birdnet-go/internal/classifier/recommend"
11+ "github.com/tphakala/birdnet-go/internal/hwprofile"
1112)
1213
1314// mib is one mebibyte, matching the recommender's MinRAMMB-to-bytes conversion.
@@ -78,7 +79,7 @@ func TestRecommend_RegionalTiles(t *testing.T) {
7879 // region +100, backend.recommended +40, and low-ram+int8 ram.constrained_fit
7980 // +25 = 165, versus no-dft-fp32's region +100 + backend.supported +10 = 110.
8081 lowRAM := 300 * mib
81- gotPerch := recommendedVariantID (& perch , []string {"aarch64" , "onnxruntime-cpu" , "low-ram" }, lowRAM , slug )
82+ gotPerch := recommendedVariantID (& perch , []string {hwprofile . CapAArch64 , hwprofile . CapONNXRuntimeCPU , hwprofile . CapLowRAM }, lowRAM , slug )
8283 assert .Equalf (t , "int8-arm@" + slug , gotPerch , "low-RAM aarch64 host in %q must get the regional int8-arm slice" , slug )
8384 assert .Equalf (t , "regional/" + slug + "/perch_v2_" + slug + "_int8_arm.onnx" , modelRemotePath (t , & perch , gotPerch ),
8485 "recommended perch variant must own the manifest low-ram selection path" )
@@ -87,7 +88,7 @@ func TestRecommend_RegionalTiles(t *testing.T) {
8788 // slice (region.matched +100 + backend.recommended +40 = 140) over the
8889 // region's fp16 slice (+100 + backend.supported +10 = 110) and over the
8990 // global model (which loses the fallback bonus once a slice matches).
90- gotV30 := recommendedVariantID (& v30 , []string {"x86-64" , "onnxruntime-cpu" }, 8 * 1024 * mib , slug )
91+ gotV30 := recommendedVariantID (& v30 , []string {hwprofile . CapX86_64 , hwprofile . CapONNXRuntimeCPU }, 8 * 1024 * mib , slug )
9192 assert .Equalf (t , "fp32@" + slug , gotV30 , "CPU host in %q must get the regional fp32 slice" , slug )
9293 })
9394 }
@@ -96,7 +97,7 @@ func TestRecommend_RegionalTiles(t *testing.T) {
9697 // the global variant wins on its fallback bonus.
9798 t .Run ("global-host-picks-global" , func (t * testing.T ) {
9899 t .Parallel ()
99- caps := []string {"x86-64" , "onnxruntime-cpu" }
100+ caps := []string {hwprofile . CapX86_64 , hwprofile . CapONNXRuntimeCPU }
100101 high := 8 * 1024 * mib
101102
102103 gotV30 := recommendedVariantID (& v30 , caps , high , "" )
@@ -125,13 +126,13 @@ func TestRecommend_V30GlobalSelection(t *testing.T) {
125126 caps []string
126127 wantPath string // manifest selection value
127128 }{
128- {"x86-64/onnxruntime" , []string {"x86-64" , "onnxruntime-cpu" }, "full/birdnet-v3.0-preview3.1-fp32-b1.onnx" },
129- {"x86-64/openvino-cpu" , []string {"x86-64" , "onnxruntime-cpu" , "openvino-cpu" }, "full/birdnet-v3.0-preview3.1-fp32-b1.onnx" },
130- {"x86-64/openvino-gpu" , []string {"x86-64" , "onnxruntime-cpu" , "openvino-cpu" , "openvino-gpu" }, "full/birdnet-v3.0-preview3.1-fp16-b1.onnx" },
131- {"aarch64-a76/openvino" , []string {"aarch64" , "aarch64-a76" , "onnxruntime-cpu" , "openvino-cpu" }, "full/birdnet-v3.0-preview3.1-fp32-b1.onnx" },
132- {"aarch64/onnxruntime" , []string {"aarch64" , "onnxruntime-cpu" }, "full/birdnet-v3.0-preview3.1-fp32-b1.onnx" },
133- {"cuda" , []string {"x86-64" , "onnxruntime-cpu" , "cuda" }, "full/birdnet-v3.0-preview3.1-fp16-b1.onnx" },
134- {"tensorrt" , []string {"x86-64" , "onnxruntime-cpu" , "cuda" , "tensorrt" }, "full/birdnet-v3.0-preview3.1-fp16-b1.onnx" },
129+ {"x86-64/onnxruntime" , []string {hwprofile . CapX86_64 , hwprofile . CapONNXRuntimeCPU }, "full/birdnet-v3.0-preview3.1-fp32-b1.onnx" },
130+ {"x86-64/openvino-cpu" , []string {hwprofile . CapX86_64 , hwprofile . CapONNXRuntimeCPU , hwprofile . CapOpenVINOCPU }, "full/birdnet-v3.0-preview3.1-fp32-b1.onnx" },
131+ {"x86-64/openvino-gpu" , []string {hwprofile . CapX86_64 , hwprofile . CapONNXRuntimeCPU , hwprofile . CapOpenVINOCPU , hwprofile . CapOpenVINOGPU }, "full/birdnet-v3.0-preview3.1-fp16-b1.onnx" },
132+ {"aarch64-a76/openvino" , []string {hwprofile . CapAArch64 , hwprofile . CapAArch64A76 , hwprofile . CapONNXRuntimeCPU , hwprofile . CapOpenVINOCPU }, "full/birdnet-v3.0-preview3.1-fp32-b1.onnx" },
133+ {"aarch64/onnxruntime" , []string {hwprofile . CapAArch64 , hwprofile . CapONNXRuntimeCPU }, "full/birdnet-v3.0-preview3.1-fp32-b1.onnx" },
134+ {"cuda" , []string {hwprofile . CapX86_64 , hwprofile . CapONNXRuntimeCPU , "cuda" }, "full/birdnet-v3.0-preview3.1-fp16-b1.onnx" },
135+ {"tensorrt" , []string {hwprofile . CapX86_64 , hwprofile . CapONNXRuntimeCPU , "cuda" , "tensorrt" }, "full/birdnet-v3.0-preview3.1-fp16-b1.onnx" },
135136 }
136137 for _ , tc := range cases {
137138 t .Run (tc .name , func (t * testing.T ) {
0 commit comments