A Swift-based manager for downloading and running a local LLM (TinyLlama-1.1B-Chat-v1.0-GGUF) using the SpeziLLM framework on iOS.
Current Issue
During response generation, the model file is reported as missing or inaccessible, despite a successful download. Below is a key excerpt from the debug log:
SpeziLLMLocal: Local LLM file could not be opened, indicating that the model file doesn't exist ❌ Response Generation Error: LLM file not found.
Debug Log Excerpt
... 🚀 Model download started ... ✅ Download completed, temporary path: /private/var/mobile/Containers/Data/... ✅ File moved successfully: /var/mobile/Containers/Data/... 📊 Saved model file size: 637699456 bytes ... SpeziLLMLocal: Local LLM file could not be opened, indicating that the model file doesn't exist ❌ Response Generation Error: LLM file not found.
LLMManager initialized Loading module(s) LLMRunner ... Loading module(s) LLMManager ... 모델 저장 경로: /var/mobile/Containers/Data/Application/6A6D186A-F8DC-4187-8B43-2ED87708D6EB/Documents/LLMModels Attempt to present <UIAlertController: 0x1066b4c00> on <TtGC7SwiftUI19UIHostingControllerGVS_15ModifiedContentVS_7AnyViewVS_12RootModifier_: 0x105b9ca40> (from <TtGC7SwiftUI19UIHostingControllerGVS_15ModifiedContentVS_7AnyViewVS_12RootModifier_: 0x105b9ca40>) which is already presenting <UIAlertController: 0x1066b5200>.
=== 모델 다운로드 시작 === 📥 다운로드 URL: https://huggingface.co/TheBloke/TinyLlama-1.1B-Chat-v1.0-GGUF/resolve/main/tinyllama-1.1b-chat-v1.0.Q4_K_M.gguf?download=true 📂 다운로드 디렉토리: /var/mobile/Containers/Data/Application/6A6D186A-F8DC-4187-8B43-2ED87708D6EB/Documents/LLMDownloads ✅ 다운로드 디렉토리 생성됨 📄 모델 파일 저장 경로: /var/mobile/Containers/Data/Application/6A6D186A-F8DC-4187-8B43-2ED87708D6EB/Documents/LLMDownloads/tinyllama-1.1b-chat-v1.0.Q4_K_M.gguf 🚀 모델 다운로드 시작됨 - UI 업데이트 ✅ 다운로드 태스크 시작됨 ⏳ 다운로드 진행률: 10% ⏳ 다운로드 진행률: 10% ⏳ 다운로드 진행률: 10% ⏳ 다운로드 진행률: 10% ⏳ 다운로드 진행률: 10% ⏳ 다운로드 진행률: 10% ⏳ 다운로드 진행률: 10% ⏳ 다운로드 진행률: 10% ⏳ 다운로드 진행률: 10% ⏳ 다운로드 진행률: 10% ⏳ 다운로드 진행률: 10% ⏳ 다운로드 진행률: 10% ⏳ 다운로드 진행률: 10% ⏳ 다운로드 진행률: 10% ⏳ 다운로드 진행률: 10% ⏳ 다운로드 진행률: 10% ⏳ 다운로드 진행률: 10% ⏳ 다운로드 진행률: 10% ⏳ 다운로드 진행률: 10% ⏳ 다운로드 진행률: 10% ⏳ 다운로드 진행률: 10% ⏳ 다운로드 진행률: 10% ⏳ 다운로드 진행률: 10% ⏳ 다운로드 진행률: 10% ⏳ 다운로드 진행률: 10% ⏳ 다운로드 진행률: 10% ⏳ 다운로드 진행률: 20% ⏳ 다운로드 진행률: 20% ⏳ 다운로드 진행률: 20% ⏳ 다운로드 진행률: 20% ⏳ 다운로드 진행률: 20% ⏳ 다운로드 진행률: 20% ⏳ 다운로드 진행률: 20% ⏳ 다운로드 진행률: 20% ⏳ 다운로드 진행률: 20% ⏳ 다운로드 진행률: 20% ⏳ 다운로드 진행률: 20% ⏳ 다운로드 진행률: 20% ⏳ 다운로드 진행률: 20% ⏳ 다운로드 진행률: 20% ⏳ 다운로드 진행률: 20% ⏳ 다운로드 진행률: 20% ⏳ 다운로드 진행률: 20% ⏳ 다운로드 진행률: 20% ⏳ 다운로드 진행률: 20% ⏳ 다운로드 진행률: 20% ⏳ 다운로드 진행률: 20% ⏳ 다운로드 진행률: 20% ⏳ 다운로드 진행률: 20% ⏳ 다운로드 진행률: 20% ⏳ 다운로드 진행률: 20% ⏳ 다운로드 진행률: 20% ⏳ 다운로드 진행률: 20% ⏳ 다운로드 진행률: 20% ⏳ 다운로드 진행률: 20% ⏳ 다운로드 진행률: 20% ⏳ 다운로드 진행률: 20% ⏳ 다운로드 진행률: 20% ⏳ 다운로드 진행률: 20% ⏳ 다운로드 진행률: 20% ⏳ 다운로드 진행률: 20% ⏳ 다운로드 진행률: 30% ⏳ 다운로드 진행률: 30% ⏳ 다운로드 진행률: 30% ⏳ 다운로드 진행률: 30% ⏳ 다운로드 진행률: 30% ⏳ 다운로드 진행률: 30% ⏳ 다운로드 진행률: 30% ⏳ 다운로드 진행률: 30% ⏳ 다운로드 진행률: 30% ⏳ 다운로드 진행률: 30% ⏳ 다운로드 진행률: 30% ⏳ 다운로드 진행률: 30% ⏳ 다운로드 진행률: 30% ⏳ 다운로드 진행률: 30% ⏳ 다운로드 진행률: 30% ⏳ 다운로드 진행률: 30% ⏳ 다운로드 진행률: 30% ⏳ 다운로드 진행률: 30% ⏳ 다운로드 진행률: 30% ⏳ 다운로드 진행률: 30% ⏳ 다운로드 진행률: 30% ⏳ 다운로드 진행률: 30% ⏳ 다운로드 진행률: 30% ⏳ 다운로드 진행률: 30% ⏳ 다운로드 진행률: 30% ⏳ 다운로드 진행률: 30% ⏳ 다운로드 진행률: 30% ⏳ 다운로드 진행률: 30% ⏳ 다운로드 진행률: 40% ⏳ 다운로드 진행률: 40% ⏳ 다운로드 진행률: 40% ⏳ 다운로드 진행률: 40% ⏳ 다운로드 진행률: 40% ⏳ 다운로드 진행률: 40% ⏳ 다운로드 진행률: 40% ⏳ 다운로드 진행률: 40% ⏳ 다운로드 진행률: 40% ⏳ 다운로드 진행률: 40% ⏳ 다운로드 진행률: 40% ⏳ 다운로드 진행률: 40% ⏳ 다운로드 진행률: 40% ⏳ 다운로드 진행률: 40% ⏳ 다운로드 진행률: 40% ⏳ 다운로드 진행률: 40% ⏳ 다운로드 진행률: 40% ⏳ 다운로드 진행률: 40% ⏳ 다운로드 진행률: 40% ⏳ 다운로드 진행률: 40% ⏳ 다운로드 진행률: 40% ⏳ 다운로드 진행률: 40% ⏳ 다운로드 진행률: 40% ⏳ 다운로드 진행률: 40% ⏳ 다운로드 진행률: 40% ⏳ 다운로드 진행률: 40% ⏳ 다운로드 진행률: 40% ⏳ 다운로드 진행률: 40% ⏳ 다운로드 진행률: 40% ⏳ 다운로드 진행률: 40% ⏳ 다운로드 진행률: 40% ⏳ 다운로드 진행률: 40% ⏳ 다운로드 진행률: 50% ⏳ 다운로드 진행률: 50% ⏳ 다운로드 진행률: 50% ⏳ 다운로드 진행률: 50% ⏳ 다운로드 진행률: 50% ⏳ 다운로드 진행률: 50% ⏳ 다운로드 진행률: 50% ⏳ 다운로드 진행률: 50% ⏳ 다운로드 진행률: 50% ⏳ 다운로드 진행률: 50% ⏳ 다운로드 진행률: 50% ⏳ 다운로드 진행률: 50% ⏳ 다운로드 진행률: 50% ⏳ 다운로드 진행률: 50% ⏳ 다운로드 진행률: 50% ⏳ 다운로드 진행률: 50% ⏳ 다운로드 진행률: 50% ⏳ 다운로드 진행률: 50% ⏳ 다운로드 진행률: 50% ⏳ 다운로드 진행률: 50% ⏳ 다운로드 진행률: 50% ⏳ 다운로드 진행률: 50% ⏳ 다운로드 진행률: 50% ⏳ 다운로드 진행률: 50% ⏳ 다운로드 진행률: 50% ⏳ 다운로드 진행률: 50% ⏳ 다운로드 진행률: 50% ⏳ 다운로드 진행률: 60% ⏳ 다운로드 진행률: 60% ⏳ 다운로드 진행률: 60% ⏳ 다운로드 진행률: 60% ⏳ 다운로드 진행률: 60% ⏳ 다운로드 진행률: 60% ⏳ 다운로드 진행률: 60% ⏳ 다운로드 진행률: 60% ⏳ 다운로드 진행률: 60% ⏳ 다운로드 진행률: 60% ⏳ 다운로드 진행률: 60% ⏳ 다운로드 진행률: 60% ⏳ 다운로드 진행률: 60% ⏳ 다운로드 진행률: 60% ⏳ 다운로드 진행률: 60% ⏳ 다운로드 진행률: 60% ⏳ 다운로드 진행률: 60% ⏳ 다운로드 진행률: 60% ⏳ 다운로드 진행률: 60% ⏳ 다운로드 진행률: 60% ⏳ 다운로드 진행률: 60% ⏳ 다운로드 진행률: 60% ⏳ 다운로드 진행률: 60% ⏳ 다운로드 진행률: 60% ⏳ 다운로드 진행률: 60% ⏳ 다운로드 진행률: 60% ⏳ 다운로드 진행률: 60% ⏳ 다운로드 진행률: 70% ⏳ 다운로드 진행률: 70% ⏳ 다운로드 진행률: 70% ⏳ 다운로드 진행률: 70% ⏳ 다운로드 진행률: 70% ⏳ 다운로드 진행률: 70% ⏳ 다운로드 진행률: 70% ⏳ 다운로드 진행률: 70% ⏳ 다운로드 진행률: 70% ⏳ 다운로드 진행률: 70% ⏳ 다운로드 진행률: 70% ⏳ 다운로드 진행률: 70% ⏳ 다운로드 진행률: 70% ⏳ 다운로드 진행률: 70% ⏳ 다운로드 진행률: 70% ⏳ 다운로드 진행률: 70% ⏳ 다운로드 진행률: 70% ⏳ 다운로드 진행률: 70% ⏳ 다운로드 진행률: 70% ⏳ 다운로드 진행률: 70% ⏳ 다운로드 진행률: 70% ⏳ 다운로드 진행률: 70% ⏳ 다운로드 진행률: 70% ⏳ 다운로드 진행률: 70% ⏳ 다운로드 진행률: 70% ⏳ 다운로드 진행률: 70% ⏳ 다운로드 진행률: 70% ⏳ 다운로드 진행률: 80% ⏳ 다운로드 진행률: 80% ⏳ 다운로드 진행률: 80% ⏳ 다운로드 진행률: 80% ⏳ 다운로드 진행률: 80% ⏳ 다운로드 진행률: 80% ⏳ 다운로드 진행률: 80% ⏳ 다운로드 진행률: 80% ⏳ 다운로드 진행률: 80% ⏳ 다운로드 진행률: 80% ⏳ 다운로드 진행률: 80% ⏳ 다운로드 진행률: 80% ⏳ 다운로드 진행률: 80% ⏳ 다운로드 진행률: 80% ⏳ 다운로드 진행률: 80% ⏳ 다운로드 진행률: 80% ⏳ 다운로드 진행률: 80% ⏳ 다운로드 진행률: 80% ⏳ 다운로드 진행률: 80% ⏳ 다운로드 진행률: 80% ⏳ 다운로드 진행률: 80% ⏳ 다운로드 진행률: 80% ⏳ 다운로드 진행률: 80% ⏳ 다운로드 진행률: 80% ⏳ 다운로드 진행률: 80% ⏳ 다운로드 진행률: 80% ⏳ 다운로드 진행률: 80% ⏳ 다운로드 진행률: 80% ⏳ 다운로드 진행률: 80% ⏳ 다운로드 진행률: 80% ⏳ 다운로드 진행률: 80% ⏳ 다운로드 진행률: 90% ⏳ 다운로드 진행률: 90% ⏳ 다운로드 진행률: 90% ⏳ 다운로드 진행률: 90% ⏳ 다운로드 진행률: 90% ⏳ 다운로드 진행률: 90% ⏳ 다운로드 진행률: 90% ⏳ 다운로드 진행률: 90% ⏳ 다운로드 진행률: 90% ⏳ 다운로드 진행률: 90% ⏳ 다운로드 진행률: 90% ⏳ 다운로드 진행률: 90% ⏳ 다운로드 진행률: 90% ⏳ 다운로드 진행률: 90% ⏳ 다운로드 진행률: 90% ⏳ 다운로드 진행률: 90% ⏳ 다운로드 진행률: 90% ⏳ 다운로드 진행률: 90% ⏳ 다운로드 진행률: 90% ⏳ 다운로드 진행률: 90% ⏳ 다운로드 진행률: 90% ⏳ 다운로드 진행률: 90% ⏳ 다운로드 진행률: 90% ⏳ 다운로드 진행률: 90% ⏳ 다운로드 진행률: 90% ⏳ 다운로드 진행률: 90% ⏳ 다운로드 진행률: 90% ⏳ 다운로드 진행률: 90% ⏳ 다운로드 진행률: 90% ⏳ 다운로드 진행률: 100% ✅ 다운로드 응답 코드: 200 📊 콘텐츠 크기: 668788096 바이트 ✅ 다운로드 완료, 임시 경로: /private/var/mobile/Containers/Data/Application/6A6D186A-F8DC-4187-8B43-2ED87708D6EB/tmp/CFNetworkDownload_ew3Ebm.tmp ✅ 파일 이동 완료: /var/mobile/Containers/Data/Application/6A6D186A-F8DC-4187-8B43-2ED87708D6EB/Documents/LLMDownloads/tinyllama-1.1b-chat-v1.0.Q4_K_M.gguf 📊 저장된 모델 파일 크기: 668788096 바이트 📄 모델 최종 저장 경로: /var/mobile/Containers/Data/Application/6A6D186A-F8DC-4187-8B43-2ED87708D6EB/Documents/LLMModels/tinyllama-1.1b-chat-v1.0.Q4_K_M.gguf ✅ 모델 파일 복사 완료: /var/mobile/Containers/Data/Application/6A6D186A-F8DC-4187-8B43-2ED87708D6EB/Documents/LLMModels/tinyllama-1.1b-chat-v1.0.Q4_K_M.gguf 🔄 다운로드된 모델 로드 시도 모델 저장 경로: /var/mobile/Containers/Data/Application/6A6D186A-F8DC-4187-8B43-2ED87708D6EB/Documents/LLMModels 모델 저장 경로: /var/mobile/Containers/Data/Application/6A6D186A-F8DC-4187-8B43-2ED87708D6EB/Documents/LLMModels
=== 모델 로드 시작 === 📂 모델 파일 경로: /var/mobile/Containers/Data/Application/6A6D186A-F8DC-4187-8B43-2ED87708D6EB/Documents/LLMModels/tinyllama-1.1b-chat-v1.0.Q4_K_M.gguf 📊 모델 파일 크기: 668788096 바이트 ✅ 파일 읽기 성공: 총 668788096 바이트, 샘플 1024 바이트 ✅ 파일 보호 속성 제거 완료 📄 모델 절대 경로: /var/mobile/Containers/Data/Application/6A6D186A-F8DC-4187-8B43-2ED87708D6EB/Documents/LLMModels/tinyllama-1.1b-chat-v1.0.Q4_K_M.gguf ✅ 스키마 내용: LLMLocalSchema(parameters: SpeziLLMLocal.LLMLocalParameters(systemPrompt: Optional("You are a helpful, respectful and honest assistant. Always answer as helpfully as possible, while being safe and still concise. Your answers should not include any harmful, unethical, racist, sexist, toxic, dangerous, or illegal content. Please ensure that your responses are socially unbiased and positive in nature. If a question does not make any sense, or is not factually coherent, explain why instead of answering something not correct. If you don't know the answer to a question, please don't share false information."), maxOutputLength: 512, extraEOSTokens: Set([]), displayEveryNTokens: 4, seed: nil, chatTemplate: nil), samplingParameters: SpeziLLMLocal.LLMLocalSamplingParameters(topP: 1.0, temperature: 0.6, penaltyRepeat: nil, repetitionContextSize: 20), injectIntoContext: false, configuration: MLXLMCommon.ModelConfiguration(id: MLXLMCommon.ModelConfiguration.Identifier.id("/var/mobile/Containers/Data/Application/6A6D186A-F8DC-4187-8B43-2ED87708D6EB/Documents/LLMModels/tinyllama-1.1b-chat-v1.0.Q4_K_M.gguf"), tokenizerId: nil, overrideTokenizer: nil, defaultPrompt: "hello", extraEOSTokens: Set([]))) 📝 생성된 세션 정보: Optional(SpeziLLMLocal.LLMLocalSession) 🚀 모델 로드 완료! modelLoaded = true 모델 저장 경로: /var/mobile/Containers/Data/Application/6A6D186A-F8DC-4187-8B43-2ED87708D6EB/Documents/LLMModels 📂 로드할 모델 파일 경로: /var/mobile/Containers/Data/Application/6A6D186A-F8DC-4187-8B43-2ED87708D6EB/Documents/LLMModels/tinyllama-1.1b-chat-v1.0.Q4_K_M.gguf 📄 모델 파일 크기: 668788096 바이트 📄 모델 파일 전체 경로: /var/mobile/Containers/Data/Application/6A6D186A-F8DC-4187-8B43-2ED87708D6EB/Documents/LLMModels/tinyllama-1.1b-chat-v1.0.Q4_K_M.gguf ✅ 파일 읽기 성공: 샘플 1024 바이트 ✅ 스키마 내용: LLMLocalSchema(parameters: SpeziLLMLocal.LLMLocalParameters(systemPrompt: Optional("You are a helpful, respectful and honest assistant. Always answer as helpfully as possible, while being safe and still concise. Your answers should not include any harmful, unethical, racist, sexist, toxic, dangerous, or illegal content. Please ensure that your responses are socially unbiased and positive in nature. If a question does not make any sense, or is not factually coherent, explain why instead of answering something not correct. If you don't know the answer to a question, please don't share false information."), maxOutputLength: 512, extraEOSTokens: Set([]), displayEveryNTokens: 4, seed: nil, chatTemplate: nil), samplingParameters: SpeziLLMLocal.LLMLocalSamplingParameters(topP: 1.0, temperature: 0.6, penaltyRepeat: nil, repetitionContextSize: 20), injectIntoContext: false, configuration: MLXLMCommon.ModelConfiguration(id: MLXLMCommon.ModelConfiguration.Identifier.id("/var/mobile/Containers/Data/Application/6A6D186A-F8DC-4187-8B43-2ED87708D6EB/Documents/LLMModels/tinyllama-1.1b-chat-v1.0.Q4_K_M.gguf"), tokenizerId: nil, overrideTokenizer: nil, defaultPrompt: "hello", extraEOSTokens: Set([]))) 📝 생성된 세션 정보: Optional(SpeziLLMLocal.LLMLocalSession) 🚀 모델 로드 완료! modelLoaded = true tcp_input [C1.1.1.1:3] flags=[R.] seq=2192985722, ack=2592083987, win=133 state=LAST_ACK rcv_nxt=2192985722, snd_una=2592083987 Can't find or decode reasons Failed to get or decode unavailable reasons Can't find or decode disabled use cases <0x106599680> Gesture: System gesture gate timed out.
=== 응답 생성 시작 === 📂 현재 선택된 모델: tinyllama-1.1b-chat-v1.0.Q4_K_M.gguf ✅ 세션 존재 확인 📝 세션 정보: SpeziLLMLocal.LLMLocalSession 💬 생성할 프롬프트: USER: Hi
A: ✅ Context에 프롬프트 추가 완료 🔄 토큰 생성 시작… SpeziLLMLocal: Local LLM is being initialized SpeziLLMLocal: Local LLM file could not be opened, indicating that the model file doesn't exist ❌ 응답 생성 오류: LLM file not found.
And if this method is wrong and we should use the model written in your LLMlocalModel, please let me know how to use it. It seems to be powered by a hub id but I don't know the exact way. I would really appreciate it if you could show me an example of how to use it correctly thank you