Skip to content

Failed to download models from argmaxinc/ttskit-coreml. Check that the repo exists and you have access #435

@zaidbren

Description

@zaidbren

Hello everyone, I am using TTSKit, and I am using few commit old version, specifically "2397168", and its the one by which I published the app. Today, I accidently deleted the Hugging face models from my system and when I try to redownload it in my app, I am getting issues, where it would throw errors like :-

[QwenTTS] Download failed for Qwen 1.7B: generationFailed("Failed to download models from argmaxinc/ttskit-coreml. Check that the repo exists and you have access. and sometimes :-

[QwenTTS] Download failed for Qwen 1.7B: generationFailed("Failed to download models from argmaxinc/ttskit-coreml. Check that the repo exists and you have access. Error: “weight.bin.46f8ac7940915bf46cb15cd16ac06c1cf306044aebf6ade6253831539e61cb88.incomplete” couldn’t be moved to “weights” because either the former doesn’t exist, or the folder containing the latter doesn’t exist.")

Mostly its stuck the download at a certain point and it can't move furthur.

func downloadModel(_ variant: QwenTTSVariant) async {
    if case .downloading = modelStates[variant] { return }  // already in progress
    guard modelStates[variant]?.isDownloaded != true else { return }

    modelStates[variant] = .downloading(progress: 0)
    downloadProgress[variant] = 0
    statusMessage = "Downloading \(variant.displayName)"

    do {
        let config = TTSKitConfig(model: variant.ttsModelVariant, verbose: true)
        let folder = try await TTSKit.download(config: config) { [weak self] progress in
            Task { @MainActor [weak self] in
                self?.downloadProgress[variant] = progress.fractionCompleted
                self?.modelStates[variant] = .downloading(progress: progress.fractionCompleted)
            }
        }
        modelStates[variant] = .downloaded
        downloadProgress[variant] = 1.0
        statusMessage = "\(variant.displayName) downloaded"
        print("✅ [QwenTTS] Downloaded \(variant.displayName)\(folder.path)")
    } catch {
        modelStates[variant] = .error(error.localizedDescription)
        statusMessage = "Download failed: \(error.localizedDescription)"
        print("❌ [QwenTTS] Download failed for \(variant.displayName): \(error)")
    }
}

private func localRepoURL(for config: TTSKitConfig) -> URL {
    documentsDirectory
        .appendingPathComponent(Self.modelStorageBase)
        .appendingPathComponent(config.modelRepo)
}

private func hasModelFiles(at repoURL: URL, config: TTSKitConfig) -> Bool {
    config.componentDirectories(in: repoURL).contains {
        FileManager.default.fileExists(atPath: $0.path)
    }
}

AISettingsView.swift — UI that triggers download
swift// QwenTTSSection wires up the download button:

QwenModelRow(
    variant:      variant,
    state:        manager.modelStates[variant] ?? .notDownloaded,
    progress:     manager.downloadProgress[variant] ?? 0,
    isDefault:    manager.defaultVariant == variant,
    onDownload:  { Task { await manager.downloadModel(variant) } },
    onSetDefault: { manager.setDefaultVariant(variant) }
)

// QwenModelRow — the Download / Retry buttons:
case .notDownloaded:
    Button("Download") { onDownload() }

case .downloading(let p):
    ProgressView(value: p)
        .progressViewStyle(.linear)
        .frame(width: 80)
    Text(p > 0 ? "\(Int(p * 100))%" : "Starting…")

case .error:
    Image(systemName: "exclamationmark.triangle.fill").foregroundStyle(.red)
    Button("Retry") { onDownload() }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions