VoiceStudio is the open-source, fully-local ElevenLabs alternative — voice cloning, voice design, video dubbing, dictation, transcription & audiobook creation in 646 languages.
Python aiaudiobookcudadubbingelevenlabs-alternativehuggingfacelocal-firstmlxomnivoice-studiospeech-to-texttext-to-speechtranscriptiontranslatettsvoice-aivoice-cloningvoice-generationvoicestudioworkflow
fix(ios): skip space reservation for installed model revalidation
debpalash2df14b538a25
diff --git a/mobile/ios/VoiceStudioKit/Sources/VoiceStudioKit/Local/ModelStore.swift b/mobile/ios/VoiceStudioKit/Sources/VoiceStudioKit/Local/ModelStore.swiftindex f0005fbef..42aa39ab9 100644--- a/mobile/ios/VoiceStudioKit/Sources/VoiceStudioKit/Local/ModelStore.swift+++ b/mobile/ios/VoiceStudioKit/Sources/VoiceStudioKit/Local/ModelStore.swift@@ -152,7 +152,7 @@ public actor ModelStore {reservations[model.id] = try model.files.filter {try !verify(directory(model).appendingPathComponent($0.path), file: $0, identity: identity)}- try checkDownloadSpace()+ if reservations[model.id]?.isEmpty == false { try checkDownloadSpace() }var completed: Int64 = 0for f in model.files {try Task.checkCancellation(); try checkPermission(model)diff --git a/mobile/ios/VoiceStudioKit/Tests/VoiceStudioKitTests/LocalInferenceTests.swift b/mobile/ios/VoiceStudioKit/Tests/VoiceStudioKitTests/LocalInferenceTests.swiftindex 18b76a025..1452367b4 100644--- a/mobile/ios/VoiceStudioKit/Tests/VoiceStudioKitTests/LocalInferenceTests.swift+++ b/mobile/ios/VoiceStudioKit/Tests/VoiceStudioKitTests/LocalInferenceTests.swift@@ -125,6 +125,26 @@ private actor RangeServer: HTTPTransport {try await store.download(model, wifi: { true }, transport: RangeServer(bytes: bytes))#expect(await store.installed(model))}+@Test func installedModelRevalidationNeedsNoSpaceDuringAnotherDownload() async throws {+ let root = try localDirectory(); defer { try? FileManager.default.removeItem(at: root) }+ let capacity = root.appendingPathComponent("available")+ try Data("16777223".utf8).write(to: capacity)+ let store = try ModelStore(root: root, available: { _ in+ Int64(try String(contentsOf: capacity, encoding: .utf8))!+ })+ let installed = try localFixture(id: "installed"), pending = try localFixture()+ try await store.download(installed, wifi: { true }, transport: RangeServer(bytes: Data("model".utf8)))+ let blocked = RangeServer(bytes: Data("model".utf8), slowAfter: 0)+ let work = Task { try await store.download(pending, wifi: { true }, transport: blocked) }+ defer { work.cancel() }+ for await count in blocked.events { if count == 1 { break } }+ try Data("0".utf8).write(to: capacity)+ let network = RangeServer(bytes: Data("model".utf8))+ try await store.download(installed, wifi: { false }, transport: network)+ #expect(await network.requests.isEmpty)+ work.cancel()+ await #expect(throws: CancellationError.self) { try await work.value }+}@Test func localDownloadCancellationRetainsRangeForResume() async throws {let root = try localDirectory(); defer { try? FileManager.default.removeItem(at: root) }let bytes = Data(repeating: 19, count: 4_194_304 + 8)