diff --git a/LLMFarm.xcodeproj/project.pbxproj b/LLMFarm.xcodeproj/project.pbxproj index f79d8af..0602c53 100644 --- a/LLMFarm.xcodeproj/project.pbxproj +++ b/LLMFarm.xcodeproj/project.pbxproj @@ -984,7 +984,7 @@ CODE_SIGN_IDENTITY = "Apple Development"; "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 12; + CURRENT_PROJECT_VERSION = 14; DEVELOPMENT_ASSET_PATHS = "\"LLMFarm/Preview Content\""; DEVELOPMENT_TEAM = C66ZA422A7; ENABLE_HARDENED_RUNTIME = YES; @@ -1036,7 +1036,7 @@ CODE_SIGN_IDENTITY = "Apple Development"; "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 12; + CURRENT_PROJECT_VERSION = 14; DEBUG_INFORMATION_FORMAT = dwarf; DEVELOPMENT_ASSET_PATHS = "\"LLMFarm/Preview Content\""; DEVELOPMENT_TEAM = C66ZA422A7; diff --git a/LLMFarm/Settings/ChatSettings/BasicSettingsView.swift b/LLMFarm/Settings/ChatSettings/BasicSettingsView.swift index 90041ea..b58d324 100644 --- a/LLMFarm/Settings/ChatSettings/BasicSettingsView.swift +++ b/LLMFarm/Settings/ChatSettings/BasicSettingsView.swift @@ -24,6 +24,7 @@ struct BasicSettingsView: View { var body: some View { + HStack{ Picker("", selection: $model_icon) { diff --git a/LLMFarm/Settings/ChatSettings/ChatSettingsView.swift b/LLMFarm/Settings/ChatSettings/ChatSettingsView.swift index e746d29..347a776 100644 --- a/LLMFarm/Settings/ChatSettings/ChatSettingsView.swift +++ b/LLMFarm/Settings/ChatSettings/ChatSettingsView.swift @@ -447,6 +447,7 @@ struct ChatSettingsView: View { HStack(spacing: 0){ ChatSettingTabs(index:$tabIndex,edit_chat_dialog:$edit_chat_dialog) + .edgesIgnoringSafeArea(.all) // now were going to create main view.... GeometryReader{ g in @@ -464,59 +465,61 @@ struct ChatSettingsView: View { // changing tabs based on tabs... switch tabIndex{ case 0: - GroupBox(label: - // Label("Basic Settings", systemImage: "building.columns") - Text("Basic Settings") - ) { - BasicSettingsView(chat_title: $chat_title, - model_icon: $chat_icon, - model_icons: $chat_icons, - model_inferences: $model_inferences, - ggjt_v3_inferences: $ggjt_v3_inferences, - model_inference: $model_inference, - ggjt_v3_inference: $ggjt_v3_inference, - model_inference_inner: $model_inference_inner, - model_settings_template: $chat_settings_template, - model_setting_templates: $chat_setting_templates, - applying_template: $applying_template, - apply_setting_template: apply_setting_template) - } - GroupBox(label: - Text("Model") - ) { - ModelSettingsView(model_file_url: $model_file_url, - model_file_path: $model_file_path, - model_title: $chat_title, - clip_model_file_url: $clip_model_file_url, - clip_model_file_path: $clip_model_file_path, - clip_model_title: $clip_model_title, - lora_file_url: $lora_file_url, - lora_file_path: $lora_file_path, - lora_title: $lora_title, - lora_file_scale: $lora_file_scale, - add_chat_dialog: $add_chat_dialog, - edit_chat_dialog: $edit_chat_dialog, - toggleSettings: $toggleSettings, - models_previews: $models_previews, - loras_previews: $loras_previews, - has_lora: $has_lora, - has_clip: $has_clip) - } - GroupBox(label: - Text("Prediction settings") - ) { - PredictionSettingsView(model_context: $model_context, - model_n_batch: $model_n_batch, - n_predict: $n_predict, - numberOfThreads: $numberOfThreads, - use_metal: $use_metal, - use_clip_metal: $use_clip_metal, - mlock: $mlock, - mmap: $mmap, - flash_attn: $flash_attn, - model_inference: $model_inference, - model_inference_inner: $model_inference_inner, - has_clip: $has_clip) + ScrollView{ + GroupBox(label: + // Label("Basic Settings", systemImage: "building.columns") + Text("Basic Settings") + ) { + BasicSettingsView(chat_title: $chat_title, + model_icon: $chat_icon, + model_icons: $chat_icons, + model_inferences: $model_inferences, + ggjt_v3_inferences: $ggjt_v3_inferences, + model_inference: $model_inference, + ggjt_v3_inference: $ggjt_v3_inference, + model_inference_inner: $model_inference_inner, + model_settings_template: $chat_settings_template, + model_setting_templates: $chat_setting_templates, + applying_template: $applying_template, + apply_setting_template: apply_setting_template) + } + GroupBox(label: + Text("Model") + ) { + ModelSettingsView(model_file_url: $model_file_url, + model_file_path: $model_file_path, + model_title: $chat_title, + clip_model_file_url: $clip_model_file_url, + clip_model_file_path: $clip_model_file_path, + clip_model_title: $clip_model_title, + lora_file_url: $lora_file_url, + lora_file_path: $lora_file_path, + lora_title: $lora_title, + lora_file_scale: $lora_file_scale, + add_chat_dialog: $add_chat_dialog, + edit_chat_dialog: $edit_chat_dialog, + toggleSettings: $toggleSettings, + models_previews: $models_previews, + loras_previews: $loras_previews, + has_lora: $has_lora, + has_clip: $has_clip) + } + GroupBox(label: + Text("Prediction settings") + ) { + PredictionSettingsView(model_context: $model_context, + model_n_batch: $model_n_batch, + n_predict: $n_predict, + numberOfThreads: $numberOfThreads, + use_metal: $use_metal, + use_clip_metal: $use_clip_metal, + mlock: $mlock, + mmap: $mmap, + flash_attn: $flash_attn, + model_inference: $model_inference, + model_inference_inner: $model_inference_inner, + has_clip: $has_clip) + } } case 1: PromptSettingsView(prompt_format: $prompt_format, @@ -589,7 +592,7 @@ struct ChatSettingsView: View { #endif } } - .edgesIgnoringSafeArea(.all) +// .edgesIgnoringSafeArea(.all) } } diff --git a/LLMFarm/Settings/ChatSettings/PromptSettingsView.swift b/LLMFarm/Settings/ChatSettings/PromptSettingsView.swift index 22c6a51..9c6d219 100644 --- a/LLMFarm/Settings/ChatSettings/PromptSettingsView.swift +++ b/LLMFarm/Settings/ChatSettings/PromptSettingsView.swift @@ -19,85 +19,87 @@ struct PromptSettingsView: View { @Binding var model_inference:String var body: some View { - GroupBox(label: - Text("Prompt Format") - ) { - VStack { -// Text("Format:") -// .frame(maxWidth: .infinity, alignment: .leading) - TextEditor(text: $prompt_format) - .frame(minHeight: 30) - // TextField("prompt..", text: $prompt_format, axis: .vertical) - // .lineLimit(2) - // .textFieldStyle(.roundedBorder) - // .frame( alignment: .leading) - // .multilineTextAlignment(.trailing) - // .textFieldStyle(.plain) - } - .padding(.top, 8) - .padding(.horizontal, 1) - }.frame(minHeight: 200) - - GroupBox(label: - Text("Options") - ) { - VStack { - Text("Reverse prompts:") - .frame(maxWidth: .infinity, alignment: .leading) + ScrollView{ + GroupBox(label: + Text("Prompt Format") + ) { + VStack { + // Text("Format:") + // .frame(maxWidth: .infinity, alignment: .leading) + TextEditor(text: $prompt_format) + .frame(minHeight: 30) + // TextField("prompt..", text: $prompt_format, axis: .vertical) + // .lineLimit(2) + // .textFieldStyle(.roundedBorder) + // .frame( alignment: .leading) + // .multilineTextAlignment(.trailing) + // .textFieldStyle(.plain) + } + .padding(.top, 8) + .padding(.horizontal, 1) + }.frame(minHeight: 200) + + GroupBox(label: + Text("Options") + ) { + VStack { + Text("Reverse prompts:") + .frame(maxWidth: .infinity, alignment: .leading) #if os(macOS) - DidEndEditingTextField(text: $reverse_prompt, didEndEditing: { newName in}) - .frame( alignment: .leading) + DidEndEditingTextField(text: $reverse_prompt, didEndEditing: { newName in}) + .frame( alignment: .leading) #else - TextField("prompt..", text: $reverse_prompt, axis: .vertical) - .lineLimit(2) - .textFieldStyle(.roundedBorder) - .frame( alignment: .leading) + TextField("prompt..", text: $reverse_prompt, axis: .vertical) + .lineLimit(2) + .textFieldStyle(.roundedBorder) + .frame( alignment: .leading) #endif - // .multilineTextAlignment(.trailing) - // .textFieldStyle(.plain) - } - .padding(.top, 8) - .padding(.horizontal, 5) - - VStack { - Text("Skip tokens:") - .frame(maxWidth: .infinity, alignment: .leading) + // .multilineTextAlignment(.trailing) + // .textFieldStyle(.plain) + } + .padding(.top, 8) + .padding(.horizontal, 5) + + VStack { + Text("Skip tokens:") + .frame(maxWidth: .infinity, alignment: .leading) #if os(macOS) - DidEndEditingTextField(text: $skip_tokens, didEndEditing: { newName in}) - .frame( alignment: .leading) + DidEndEditingTextField(text: $skip_tokens, didEndEditing: { newName in}) + .frame( alignment: .leading) #else - TextField("prompt..", text: $skip_tokens, axis: .vertical) - .lineLimit(2) - .textFieldStyle(.roundedBorder) - .frame( alignment: .leading) + TextField("prompt..", text: $skip_tokens, axis: .vertical) + .lineLimit(2) + .textFieldStyle(.roundedBorder) + .frame( alignment: .leading) #endif - // .multilineTextAlignment(.trailing) - // .textFieldStyle(.plain) - } - .padding(.top, 8) - .padding(.horizontal, 5) - - HStack { - Toggle("Special", isOn: $parse_special_tokens) - .frame(maxWidth: 120, alignment: .trailing) - .disabled(model_inference != "llama" ) - Spacer() - } - .padding(.horizontal, 5) - .padding(.bottom, 4) - - HStack { - Toggle("BOS", isOn: $add_bos_token) - .frame(maxWidth: 120, alignment: .trailing) - Toggle("EOS", isOn: $add_eos_token) - .frame(maxWidth: 120, alignment: .trailing) - Spacer() - } - .padding(.horizontal, 5) - .padding(.bottom, 4) - - Divider() + // .multilineTextAlignment(.trailing) + // .textFieldStyle(.plain) + } .padding(.top, 8) + .padding(.horizontal, 5) + + HStack { + Toggle("Special", isOn: $parse_special_tokens) + .frame(maxWidth: 120, alignment: .trailing) + .disabled(model_inference != "llama" ) + Spacer() + } + .padding(.horizontal, 5) + .padding(.bottom, 4) + + HStack { + Toggle("BOS", isOn: $add_bos_token) + .frame(maxWidth: 120, alignment: .trailing) + Toggle("EOS", isOn: $add_eos_token) + .frame(maxWidth: 120, alignment: .trailing) + Spacer() + } + .padding(.horizontal, 5) + .padding(.bottom, 4) + + Divider() + .padding(.top, 8) + } } } } diff --git a/LLMFarm/Settings/ChatSettings/SamplingSettingsView.swift b/LLMFarm/Settings/ChatSettings/SamplingSettingsView.swift index a176444..e386dd1 100644 --- a/LLMFarm/Settings/ChatSettings/SamplingSettingsView.swift +++ b/LLMFarm/Settings/ChatSettings/SamplingSettingsView.swift @@ -27,194 +27,196 @@ struct SamplingSettingsView: View { var body: some View { - HStack{ - Text("Sampling:") - .frame(maxWidth: 110, alignment: .leading) - Picker("", selection: $model_sampling) { - ForEach(model_samplings, id: \.self) { - Text($0) - } - } - .frame(maxWidth: .infinity, alignment: .trailing) - .pickerStyle(.menu) - .onChange(of: model_sampling) { sampling in - if sampling == "temperature" { - mirostat = 0 - } - if sampling == "greedy" { - mirostat = 0 - model_temp = 0 - } - if sampling == "mirostat" { - mirostat = 1 +// ScrollView{ + HStack{ + Text("Sampling:") + .frame(maxWidth: 110, alignment: .leading) + Picker("", selection: $model_sampling) { + ForEach(model_samplings, id: \.self) { + Text($0) + } } - if sampling == "mirostat_v2" { - mirostat = 2 + .frame(maxWidth: .infinity, alignment: .trailing) + .pickerStyle(.menu) + .onChange(of: model_sampling) { sampling in + if sampling == "temperature" { + mirostat = 0 + } + if sampling == "greedy" { + mirostat = 0 + model_temp = 0 + } + if sampling == "mirostat" { + mirostat = 1 + } + if sampling == "mirostat_v2" { + mirostat = 2 + } } + // } - // - } - .padding(.horizontal, 5) - .padding(.top, 8) - - if model_sampling == "temperature" { - Group { - - HStack { - Text("Repeat last N:") - .frame(maxWidth: 100, alignment: .leading) - TextField("count..", value: $model_repeat_last_n, format:.number) - .frame( alignment: .leading) - .multilineTextAlignment(.trailing) - .textFieldStyle(.plain) + .padding(.horizontal, 5) + .padding(.top, 8) + + if model_sampling == "temperature" { + Group { + + HStack { + Text("Repeat last N:") + .frame(maxWidth: 100, alignment: .leading) + TextField("count..", value: $model_repeat_last_n, format:.number) + .frame( alignment: .leading) + .multilineTextAlignment(.trailing) + .textFieldStyle(.plain) #if os(iOS) - .keyboardType(.numberPad) + .keyboardType(.numberPad) #endif - } - .padding(.horizontal, 5) - - HStack { - Text("Repeat Penalty:") - .frame(maxWidth: 100, alignment: .leading) - TextField("size..", value: $model_repeat_penalty, format:.number) - .frame( alignment: .leading) - .multilineTextAlignment(.trailing) - .textFieldStyle(.plain) + } + .padding(.horizontal, 5) + + HStack { + Text("Repeat Penalty:") + .frame(maxWidth: 100, alignment: .leading) + TextField("size..", value: $model_repeat_penalty, format:.number) + .frame( alignment: .leading) + .multilineTextAlignment(.trailing) + .textFieldStyle(.plain) #if os(iOS) - .keyboardType(.numbersAndPunctuation) + .keyboardType(.numbersAndPunctuation) #endif - } - .padding(.horizontal, 5) - - HStack { - Text("Temp:") - .frame(maxWidth: 75, alignment: .leading) - TextField("size..", value: $model_temp, format:.number) - .frame( alignment: .leading) - .multilineTextAlignment(.trailing) - .textFieldStyle(.plain) + } + .padding(.horizontal, 5) + + HStack { + Text("Temp:") + .frame(maxWidth: 75, alignment: .leading) + TextField("size..", value: $model_temp, format:.number) + .frame( alignment: .leading) + .multilineTextAlignment(.trailing) + .textFieldStyle(.plain) #if os(iOS) - .keyboardType(.numbersAndPunctuation) + .keyboardType(.numbersAndPunctuation) #endif - } - .padding(.horizontal, 5) - - HStack { - Text("Top_k:") - .frame(maxWidth: 75, alignment: .leading) - TextField("val..", value: $model_top_k, format:.number) - .frame( alignment: .leading) - .multilineTextAlignment(.trailing) - .textFieldStyle(.plain) + } + .padding(.horizontal, 5) + + HStack { + Text("Top_k:") + .frame(maxWidth: 75, alignment: .leading) + TextField("val..", value: $model_top_k, format:.number) + .frame( alignment: .leading) + .multilineTextAlignment(.trailing) + .textFieldStyle(.plain) #if os(iOS) - .keyboardType(.numberPad) + .keyboardType(.numberPad) #endif - } - .padding(.horizontal, 5) - - HStack { - Text("Top_p:") - .frame(maxWidth: 95, alignment: .leading) - TextField("val..", value: $model_top_p, format:.number) - .frame( alignment: .leading) - .multilineTextAlignment(.trailing) - .textFieldStyle(.plain) + } + .padding(.horizontal, 5) + + HStack { + Text("Top_p:") + .frame(maxWidth: 95, alignment: .leading) + TextField("val..", value: $model_top_p, format:.number) + .frame( alignment: .leading) + .multilineTextAlignment(.trailing) + .textFieldStyle(.plain) #if os(iOS) - .keyboardType(.numbersAndPunctuation) + .keyboardType(.numbersAndPunctuation) #endif - } - .padding(.horizontal, 5) - - - HStack { - Text("Tail Free Z:") - .frame(maxWidth: 100, alignment: .leading) - TextField("val..", value: $tfs_z, format:.number) - .frame( alignment: .leading) - .multilineTextAlignment(.trailing) - .textFieldStyle(.plain) + } + .padding(.horizontal, 5) + + + HStack { + Text("Tail Free Z:") + .frame(maxWidth: 100, alignment: .leading) + TextField("val..", value: $tfs_z, format:.number) + .frame( alignment: .leading) + .multilineTextAlignment(.trailing) + .textFieldStyle(.plain) #if os(iOS) - .keyboardType(.numbersAndPunctuation) + .keyboardType(.numbersAndPunctuation) #endif - } - .padding(.horizontal, 5) - - HStack { - Text("Locally Typical N:") - .frame(maxWidth: 140, alignment: .leading) - TextField("val..", value: $typical_p, format:.number) - .frame( alignment: .leading) - .multilineTextAlignment(.trailing) - .textFieldStyle(.plain) + } + .padding(.horizontal, 5) + + HStack { + Text("Locally Typical N:") + .frame(maxWidth: 140, alignment: .leading) + TextField("val..", value: $typical_p, format:.number) + .frame( alignment: .leading) + .multilineTextAlignment(.trailing) + .textFieldStyle(.plain) #if os(iOS) - .keyboardType(.numbersAndPunctuation) + .keyboardType(.numbersAndPunctuation) #endif + } + .padding(.horizontal, 5) + } - .padding(.horizontal, 5) } - } - - if model_sampling == "mirostat" || model_sampling == "mirostat_v2" { - Group { - HStack { - Text("Mirostat_eta:") - .frame(maxWidth: 110, alignment: .leading) - TextField("val..", value: $mirostat_eta, format:.number) - .frame( alignment: .leading) - .multilineTextAlignment(.trailing) - .textFieldStyle(.plain) + if model_sampling == "mirostat" || model_sampling == "mirostat_v2" { + Group { + HStack { + Text("Mirostat_eta:") + .frame(maxWidth: 110, alignment: .leading) + TextField("val..", value: $mirostat_eta, format:.number) + .frame( alignment: .leading) + .multilineTextAlignment(.trailing) + .textFieldStyle(.plain) #if os(iOS) - .keyboardType(.numbersAndPunctuation) + .keyboardType(.numbersAndPunctuation) #endif - } - .padding(.horizontal, 5) - - HStack { - Text("Mirostat_tau:") - .frame(maxWidth: 110, alignment: .leading) - TextField("val..", value: $mirostat_tau, format:.number) - .frame( alignment: .leading) - .multilineTextAlignment(.trailing) - .textFieldStyle(.plain) + } + .padding(.horizontal, 5) + + HStack { + Text("Mirostat_tau:") + .frame(maxWidth: 110, alignment: .leading) + TextField("val..", value: $mirostat_tau, format:.number) + .frame( alignment: .leading) + .multilineTextAlignment(.trailing) + .textFieldStyle(.plain) #if os(iOS) - .keyboardType(.numbersAndPunctuation) + .keyboardType(.numbersAndPunctuation) #endif - } - .padding(.horizontal, 5) - - HStack { - Text("Temp:") - .frame(maxWidth: 75, alignment: .leading) - TextField("size..", value: $model_temp, format:.number) - .frame( alignment: .leading) - .multilineTextAlignment(.trailing) - .textFieldStyle(.plain) + } + .padding(.horizontal, 5) + + HStack { + Text("Temp:") + .frame(maxWidth: 75, alignment: .leading) + TextField("size..", value: $model_temp, format:.number) + .frame( alignment: .leading) + .multilineTextAlignment(.trailing) + .textFieldStyle(.plain) #if os(iOS) - .keyboardType(.numbersAndPunctuation) + .keyboardType(.numbersAndPunctuation) #endif + } + .padding(.horizontal, 5) } - .padding(.horizontal, 5) } - } - - if model_inference == "llama"{ - HStack{ - Text("Grammar sampling:") - .frame(maxWidth: .infinity, alignment: .leading) - Picker("", selection: $grammar) { - ForEach(grammars_previews, id: \.self) { - Text($0) + + if model_inference == "llama"{ + HStack{ + Text("Grammar sampling:") + .frame(maxWidth: .infinity, alignment: .leading) + Picker("", selection: $grammar) { + ForEach(grammars_previews, id: \.self) { + Text($0) + } } + .pickerStyle(.menu) + } - .pickerStyle(.menu) - + .padding(.horizontal, 5) + // .padding(.top, 8) } - .padding(.horizontal, 5) -// .padding(.top, 8) } - } +// } } //#Preview {