huggingface / huggingface/swift-transformers

Using useBackgroundSession: true causes app to crash

Open
#341 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Swift
Stars
1.4k
Forks
209
Avg merge
2d 7h
Merged PRs (30d)
4

Description

```
*** Terminating app due to uncaught exception 'NSGenericException', reason: 'Completion handler blocks are not supported in background sessions. Use a delegate instead.'
*** First throw call stack:
(0x1913af964 0x18e25d814 0x1a6b5e1c8 0x1a6b5d530 0x1a6b5b718 0x100f2a2e0 0x100f213cc 0x1a6b5b440 0x1a6b5d438 0x18f11b9bc 0x18f764ef0 0x18f76505c 0x18f11b67d 0x18eae4e71 0x18f78ee71 0x18f11b3a9 0x10df83ee9 0x10e1c90d1 0x10e1dfa49 0x18f78ee71 0x10e1cc511 0x10e1c6dcd 0x10e1ce821 0x10c009bb1 0x10c00f57d 0x10bf27495 0x10bf275f1 0x18f7cd7b1)
terminating due to uncaught exception of type NSException
*** Terminating app due to uncaught exception 'NSGenericException', reason: 'Completion handler blocks are not supported in background sessions. Use a delegate instead.'

#18 0x000000010df83f00 in HubClient.downloadFile(at:from:to:kind:revision:endpoint:cachePolicy:progress:transport:localFilesOnly:)
#19 0x000000010e1c90e4 in closure #1 in HubApi.HubFileDownloader.download(progressHandler:)
#23 0x000000010e1c6de0 in HubApi.HubFileDownloader.download(progressHandler:)
#24 0x000000010e1ce834 in HubApi.snapshot(from:revision:matching:progressHandler:)
```

### Reproduce

```
let hub = HubApi(downloadBase: FileManager.default.urls(for: .cachesDirectory, in: .userDomainMask).first, useBackgroundSession: true)
let repo = Hub.Repo(id: "mlx-community/Qwen2.5-Coder-0.5B-Instruct-4bit")
Task {
try await hub.snapshot(from: repo, matching: ["*.safetensors", "*.json"])
}
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.