Skip to content

Commit

Permalink
demo and ChatMl template
Browse files Browse the repository at this point in the history
  • Loading branch information
guinmoon committed Aug 6, 2024
1 parent 74368b6 commit 8bd1d71
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
6 changes: 3 additions & 3 deletions LLMFarm.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,7 @@
1554ABC42C27004500A0513F /* ChatSettings */ = {
isa = PBXGroup;
children = (
15C08A652BA3705D000A1BE0 /* ModelSelector.swift */,
1554ABC52C27043500A0513F /* ModelSettingsView.swift */,
15B716502C27090400CA600B /* PromptSettingsView.swift */,
15B716522C270BE300CA600B /* PredictionSettingsView.swift */,
Expand Down Expand Up @@ -372,7 +373,6 @@
158DAA532B8655AE00550274 /* ModelDownloadItem.swift */,
15A3EDC32A2121D90030AF5A /* ModelinfoItem.swift */,
15B7BE9C2A968399006624BD /* MacEditorTextView.swift */,
15C08A652BA3705D000A1BE0 /* ModelSelector.swift */,
15A3EDC22A2121D90030AF5A /* ModelsView.swift */,
15B1B9D92AF588FD0058F275 /* SettingsMenuItem.swift */,
15A3EDC02A2121D90030AF5A /* SettingsHeaderItem.swift */,
Expand Down Expand Up @@ -882,7 +882,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 14;
CURRENT_PROJECT_VERSION = 15;
DEVELOPMENT_ASSET_PATHS = "\"LLMFarm/Preview Content\"";
DEVELOPMENT_TEAM = C66ZA422A7;
ENABLE_HARDENED_RUNTIME = YES;
Expand Down Expand Up @@ -934,7 +934,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 14;
CURRENT_PROJECT_VERSION = 15;
DEBUG_INFORMATION_FORMAT = dwarf;
DEVELOPMENT_ASSET_PATHS = "\"LLMFarm/Preview Content\"";
DEVELOPMENT_TEAM = C66ZA422A7;
Expand Down
21 changes: 15 additions & 6 deletions LLMFarm/Settings/AddChatView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ struct AddChatView: View {
@State private var isLoraImporting: Bool = false
@State private var has_lora: Bool = false
@State private var has_clip: Bool = false

@State private var model_context: Int32 = 1024
@State private var model_n_batch: Int32 = 512
@State private var n_predict: Int32 = 0
Expand All @@ -67,7 +67,7 @@ struct AddChatView: View {
@State private var mlock: Bool = false
@State private var mmap: Bool = true
@State private var flash_attn: Bool = false

@State private var prompt_format: String = "{{prompt}}"
@State private var warm_prompt: String = "\n\n\n"
@State private var skip_tokens: String = ""
Expand All @@ -90,12 +90,12 @@ struct AddChatView: View {
@State private var model_sampling = "temperature"
@State private var model_samplings = ["temperature", "greedy", "mirostat", "mirostat_v2"]
@State private var grammars_previews = get_grammars_list() ?? []

@State private var save_load_state: Bool = true
@State private var save_as_template_name:String = "My Template"
@State private var chat_style:String = "DocC"
@State private var chat_styles = ["None", "DocC", "Basic", "GitHub"]

var hardware_arch = Get_Machine_Hardware_Name()
@Binding var after_chat_edit: () -> Void

Expand Down Expand Up @@ -156,7 +156,7 @@ struct AddChatView: View {
}
if chat_config!["model_settings_template"] != nil{
let cur_template = chat_config?["model_settings_template"] as? String ?? ""
// let isPresent = model_setting_templates.contains(where: { $0.template_name == cur_template })
// let isPresent = model_setting_templates.contains(where: { $0.template_name == cur_template })
model_setting_templates.forEach { template in
if template.template_name == cur_template{
self._model_settings_template = State(initialValue:template)
Expand Down Expand Up @@ -202,7 +202,7 @@ struct AddChatView: View {
if (chat_config!["n_batch"] != nil){
self._model_n_batch = State(initialValue: chat_config!["n_batch"]! as! Int32)
}
if (chat_config!["n_predict"] != nil){
if (chat_config!["n_predict"] != nil){
self._n_predict = State(initialValue: chat_config!["n_predict"]! as! Int32)
}
if (chat_config!["top_k"] != nil){
Expand Down Expand Up @@ -270,6 +270,14 @@ struct AddChatView: View {
model_settings_template = model_setting_templates[0]
}

func select_template(_ name:String){
model_setting_templates.forEach { template in
if template.template_name == name{
model_settings_template = template
return
}
}
}

func apply_setting_template(template:ChatSettingsTemplate){
if template.template_name == "Custom"{
Expand Down Expand Up @@ -512,6 +520,7 @@ struct AddChatView: View {
set_template_to_custom()
}
}

}

var anyOfModelOptions: [String] {[
Expand Down

0 comments on commit 8bd1d71

Please sign in to comment.