Skip to content

Commit

Permalink
fix: improve error handling for XNNPACK delegate initialization
Browse files Browse the repository at this point in the history
- Updated error message to provide clearer guidance when XNNPACK delegate creation fails.
- Added instructions for downloading the updated TensorFlow Lite C API library to enable XNNPACK support.

These changes enhance user experience by offering actionable steps in case of initialization issues.
  • Loading branch information
tphakala committed Jan 19, 2025
1 parent 50c8ab7 commit 569ad42
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion internal/birdnet/birdnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,10 @@ func (bn *BirdNET) initializeModel() error {
if bn.Settings.BirdNET.UseXNNPACK {
delegate := xnnpack.New(xnnpack.DelegateOptions{NumThreads: int32(max(1, threads-1))})
if delegate == nil {
fmt.Println("⚠️ Failed to create XNNPACK delegate, falling back to default CPU execution")
fmt.Println("⚠️ Failed to create XNNPACK delegate, falling back to default CPU")
fmt.Println("Please download updated tensorflow lite C API library from:")
fmt.Println("https://github.com/tphakala/tflite_c/releases/tag/v2.17.1")
fmt.Println("and install it to enable use of XNNPACK delegate")
options.SetNumThread(threads)
} else {
options.AddDelegate(delegate)
Expand Down

0 comments on commit 569ad42

Please sign in to comment.