diff --git a/LLMFarm.xcodeproj/project.pbxproj b/LLMFarm.xcodeproj/project.pbxproj index 0d681e1..2e92ddf 100644 --- a/LLMFarm.xcodeproj/project.pbxproj +++ b/LLMFarm.xcodeproj/project.pbxproj @@ -65,6 +65,7 @@ 15C08A662BA3705D000A1BE0 /* ModelSelector.swift in Sources */ = {isa = PBXBuildFile; fileRef = 15C08A652BA3705D000A1BE0 /* ModelSelector.swift */; }; 15C08A682BA5976A000A1BE0 /* MessageImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 15C08A672BA5976A000A1BE0 /* MessageImage.swift */; }; 15C08A6A2BA5CB2C000A1BE0 /* MobileVLM.json in Resources */ = {isa = PBXBuildFile; fileRef = 15C08A692BA5CB2C000A1BE0 /* MobileVLM.json */; }; + 15D81B002BDAC0E900C3B5CE /* phi3.json in Resources */ = {isa = PBXBuildFile; fileRef = 15D81AFF2BDAC0E900C3B5CE /* phi3.json */; }; 15D8FE902AF80D7600B5C90D /* FineTuneView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 15D8FE8F2AF80D7600B5C90D /* FineTuneView.swift */; }; 15E086C42AEAC69B006459DE /* FineTuneModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 15E086C32AEAC69B006459DE /* FineTuneModel.swift */; }; 15E415D42A18A2980057A15E /* main.swift in Sources */ = {isa = PBXBuildFile; fileRef = 15E415D32A18A2980057A15E /* main.swift */; }; @@ -178,6 +179,7 @@ 15C08A652BA3705D000A1BE0 /* ModelSelector.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ModelSelector.swift; sourceTree = ""; }; 15C08A672BA5976A000A1BE0 /* MessageImage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessageImage.swift; sourceTree = ""; }; 15C08A692BA5CB2C000A1BE0 /* MobileVLM.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = MobileVLM.json; sourceTree = ""; }; + 15D81AFF2BDAC0E900C3B5CE /* phi3.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = phi3.json; sourceTree = ""; }; 15D8FE8F2AF80D7600B5C90D /* FineTuneView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FineTuneView.swift; sourceTree = ""; }; 15E086C32AEAC69B006459DE /* FineTuneModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FineTuneModel.swift; sourceTree = ""; }; 15E415D12A18A2970057A15E /* ModelTest */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = ModelTest; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -254,6 +256,7 @@ 158172B72BC5B1460078DCDA /* llama chat 2 7B (2).json */, 158172BD2BC5B1470078DCDA /* llama chat 2 7B.json */, 158172B52BC5B1460078DCDA /* phi2.json */, + 15D81AFF2BDAC0E900C3B5CE /* phi3.json */, 158172B92BC5B1470078DCDA /* RWKV-4 Raven Eng.json */, 158172B82BC5B1470078DCDA /* StableLM-3B-4E1T.json */, 158172B42BC5B1460078DCDA /* tinyllama.json */, @@ -577,6 +580,7 @@ 158172CA2BC5B1480078DCDA /* llama chat 2 7B.json in Resources */, 15F210892A191B1B0021F414 /* Preview Assets.xcassets in Resources */, 15F210852A191B1B0021F414 /* Assets.xcassets in Resources */, + 15D81B002BDAC0E900C3B5CE /* phi3.json in Resources */, 1532BF7E2AA113D5006DC514 /* MagicPrompt-Stable-Diffusion.json in Resources */, 158172C12BC5B1480078DCDA /* tinyllama.json in Resources */, 158172C52BC5B1480078DCDA /* StableLM-3B-4E1T.json in Resources */, diff --git a/LLMFarm/Chats/LLMTextInput.swift b/LLMFarm/Chats/LLMTextInput.swift index 9030617..ff75718 100644 --- a/LLMFarm/Chats/LLMTextInput.swift +++ b/LLMFarm/Chats/LLMTextInput.swift @@ -94,19 +94,26 @@ public struct LLMTextInput: View { HStack(alignment: .bottom) { if self.show_attachment_btn{ if img_cahce_path != nil && platformImage != nil{ + HStack{ #if os(macOS) - Image(nsImage:platformImage!) - .resizable() - .aspectRatio(contentMode: .fit) - .frame(maxWidth: 30,maxHeight: 40) + Image(nsImage:platformImage!) + .resizable() + .aspectRatio(contentMode: .fit) + .frame(maxWidth: 30,maxHeight: 40) #else - Image(uiImage:platformImage!) - .resizable() - .aspectRatio(contentMode: .fit) - .frame(maxWidth: 30,maxHeight: 40) + Image(uiImage:platformImage!) + .resizable() + .aspectRatio(contentMode: .fit) + .frame(maxWidth: 30,maxHeight: 40) + .clipShape(Circle()) #endif - // image! - + // image! + } + .cornerRadius(20) /// make the background rounded + .overlay( /// apply a rounded border + RoundedRectangle(cornerRadius: 5) + .stroke(.gray, lineWidth: 1) + ) } Group { attachButton diff --git a/LLMFarm/Lib/FileHelper.swift b/LLMFarm/Lib/FileHelper.swift index b449243..441a99b 100644 --- a/LLMFarm/Lib/FileHelper.swift +++ b/LLMFarm/Lib/FileHelper.swift @@ -480,7 +480,7 @@ func create_chat(_ in_options:Dictionary,edit_chat_dialog:Bool = fa continue } if key != "lora_adapters" && key != "model" && key != "clip_model" - && key != "title" && key != "icon"{ + && key != "title" && key != "icon" && key != "model_settings_template"{ options[key] = value } } diff --git a/LLMFarm/Settings/downloadable_models.json b/LLMFarm/Settings/downloadable_models.json index 3801f93..36c8945 100644 --- a/LLMFarm/Settings/downloadable_models.json +++ b/LLMFarm/Settings/downloadable_models.json @@ -17,6 +17,46 @@ ] }, + { + "name": "Phi 2 2.7B", + "models": [ + { + "file_name": "phi-2.Q4_K_M.gguf", + "url": "https://huggingface.co/TheBloke/phi-2-GGUF/resolve/main/phi-2.Q4_K_M.gguf?download=true", + "size": "1.48", + "Q": "Q4_K_M" + }, + { + "url": "https://huggingface.co/ggml-org/models/resolve/main/phi-2/ggml-model-q8_0.gguf?download=true", + "file_name": "phi-2-q8_0.gguf", + "size": "", + "Q": "Q8_0" + } + ] + }, + { + "name": "Phi 3 mini 128k instruct", + "models": [ + { + "file_name": "Phi-3-mini-128k-instruct.IQ4_NL.gguf", + "url": "https://huggingface.co/PrunaAI/Phi-3-mini-128k-instruct-GGUF-Imatrix-smashed/resolve/main/Phi-3-mini-128k-instruct.IQ4_NL.gguf?download=true", + "size": "1.48", + "Q": "IQ4_NL" + }, + { + "url": "https://huggingface.co/PrunaAI/Phi-3-mini-128k-instruct-GGUF-Imatrix-smashed/resolve/main/Phi-3-mini-128k-instruct.IQ3_S.gguf?download=true", + "file_name": "Phi-3-mini-128k-instruct.IQ3_S.gguf", + "size": "", + "Q": "IQ3_S" + }, + { + "url": "https://huggingface.co/PrunaAI/Phi-3-mini-128k-instruct-GGUF-Imatrix-smashed/resolve/main/Phi-3-mini-128k-instruct.Q5_K_M.gguf?download=true", + "file_name": "Phi-3-mini-128k-instruct.Q5_K_M.gguf", + "size": "", + "Q": "Q5_K_M" + } + ] + }, { "name": "MobileVLM 1.7B", "models": [ @@ -85,23 +125,6 @@ } ] }, - { - "name": "Phi 2 2.7B", - "models": [ - { - "file_name": "phi-2.Q4_K_M.gguf", - "url": "https://huggingface.co/TheBloke/phi-2-GGUF/resolve/main/phi-2.Q4_K_M.gguf?download=true", - "size": "1.48", - "Q": "Q4_K_M" - }, - { - "url": "https://huggingface.co/ggml-org/models/resolve/main/phi-2/ggml-model-q8_0.gguf?download=true", - "file_name": "phi-2-q8_0.gguf", - "size": "", - "Q": "Q8_0" - } - ] - }, { "name": "ORCA mini 3B", "models": [ diff --git a/LLMFarm/model_setting_templates/phi3.json b/LLMFarm/model_setting_templates/phi3.json new file mode 100644 index 0000000..782efb6 --- /dev/null +++ b/LLMFarm/model_setting_templates/phi3.json @@ -0,0 +1,27 @@ +{ + "add_eos_token" : false, + "mlock" : false, + "repeat_penalty" : 1.1000000238418579, + "mirostat_tau" : 5, + "temp" : 0.89999997615814209, + "warm_prompt" : "\n\n\n", + "mmap" : true, + "grammar" : "", + "parse_special_tokens" : true, + "use_metal" : true, + "model_inference" : "llama", + "repeat_last_n" : 64, + "prompt_format" : "<|user|>\n{{prompt}}<|end|>\n<|assistant|>\n", + "reverse_prompt" : "<|end|>", + "n_batch" : 512, + "typical_p" : 1, + "top_k" : 40, + "add_bos_token" : true, + "mirostat" : 0, + "top_p" : 0.94999998807907104, + "numberOfThreads" : 0, + "template_name" : "Phi 3", + "context" : 1024, + "mirostat_eta" : 0.10000000149011612, + "tfs_z" : 1 +} diff --git a/llmfarm_core.swift b/llmfarm_core.swift index 18eeef7..0d06970 160000 --- a/llmfarm_core.swift +++ b/llmfarm_core.swift @@ -1 +1 @@ -Subproject commit 18eeef79ea4af46a4b3bcbb05af5c8165b020149 +Subproject commit 0d06970fb9f61bc4b7c582ffaea356f3c9e42df9