Skip to content

Commit

Permalink
link to download models
Browse files Browse the repository at this point in the history
  • Loading branch information
guinmoon committed Feb 25, 2024
1 parent e7649f8 commit 08862af
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 7 deletions.
8 changes: 6 additions & 2 deletions LLMFarm.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
158DAA522B83C0B700550274 /* downloadable_models.json in Resources */ = {isa = PBXBuildFile; fileRef = 158DAA512B83C0B700550274 /* downloadable_models.json */; };
158DAA542B8655AE00550274 /* ModelDownloadItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 158DAA532B8655AE00550274 /* ModelDownloadItem.swift */; };
158FC6DB2AA3457A00A181B4 /* log_helper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 158FC6DA2AA3457A00A181B4 /* log_helper.swift */; };
159578302B8BB3C3002EDBA0 /* tinyllama.json in Resources */ = {isa = PBXBuildFile; fileRef = 1595782F2B8BB3C3002EDBA0 /* tinyllama.json */; };
159650ED2A49F8280007BE5C /* Accelerate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E61E38F329B1F0BA00114C15 /* Accelerate.framework */; };
159650F12A49F8400007BE5C /* MetalKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 159650EE2A49F8400007BE5C /* MetalKit.framework */; };
159650F22A49F8400007BE5C /* MetalPerformanceShaders.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 159650EF2A49F8400007BE5C /* MetalPerformanceShaders.framework */; };
Expand Down Expand Up @@ -130,6 +131,7 @@
158DAA512B83C0B700550274 /* downloadable_models.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = downloadable_models.json; sourceTree = "<group>"; };
158DAA532B8655AE00550274 /* ModelDownloadItem.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ModelDownloadItem.swift; sourceTree = "<group>"; };
158FC6DA2AA3457A00A181B4 /* log_helper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = log_helper.swift; sourceTree = "<group>"; };
1595782F2B8BB3C3002EDBA0 /* tinyllama.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = tinyllama.json; sourceTree = "<group>"; };
159650EE2A49F8400007BE5C /* MetalKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MetalKit.framework; path = System/Library/Frameworks/MetalKit.framework; sourceTree = SDKROOT; };
159650EF2A49F8400007BE5C /* MetalPerformanceShaders.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MetalPerformanceShaders.framework; path = System/Library/Frameworks/MetalPerformanceShaders.framework; sourceTree = SDKROOT; };
159650F02A49F8400007BE5C /* Metal.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Metal.framework; path = System/Library/Frameworks/Metal.framework; sourceTree = SDKROOT; };
Expand Down Expand Up @@ -223,6 +225,7 @@
1532BF7D2AA113D5006DC514 /* MagicPrompt-Stable-Diffusion.json */,
1532BF7B2AA113AD006DC514 /* RWKV-4 Raven Eng.json */,
15141E3D2A6488A60060E767 /* cerebras 2.7b.json */,
1595782F2B8BB3C3002EDBA0 /* tinyllama.json */,
15141E372A6488A60060E767 /* dolly v2 3b.json */,
15141E392A6488A60060E767 /* openllama 3b.json */,
15141E382A6488A60060E767 /* orca mini 3b.json */,
Expand Down Expand Up @@ -503,6 +506,7 @@
files = (
15141E5C2A651F8C0060E767 /* model_setting_templates in Resources */,
159C699B2A9A52D200F74913 /* llama chat 2 7B iphone 12.json in Resources */,
159578302B8BB3C3002EDBA0 /* tinyllama.json in Resources */,
15F210892A191B1B0021F414 /* Preview Assets.xcassets in Resources */,
15F210852A191B1B0021F414 /* Assets.xcassets in Resources */,
1532BF7E2AA113D5006DC514 /* MagicPrompt-Stable-Diffusion.json in Resources */,
Expand Down Expand Up @@ -654,7 +658,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;
Expand Down Expand Up @@ -703,7 +707,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;
Expand Down
4 changes: 3 additions & 1 deletion LLMFarm/Chats/ChatListView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ struct ChatListView: View {
VStack{
Button {
Task {
toggleAddChat = true
add_chat_dialog = true
edit_chat_dialog = false
}
Expand Down Expand Up @@ -193,7 +194,8 @@ struct ChatListView: View {
AddChatView(add_chat_dialog: $toggleAddChat,
edit_chat_dialog: $edit_chat_dialog,
chat_name: aiChatModel.chat_name,
renew_chat_list: $renew_chat_list).environmentObject(aiChatModel)
renew_chat_list: $renew_chat_list,
toggleSettings: $toggleSettings).environmentObject(aiChatModel)
#if os(macOS)
.frame(minWidth: 400,minHeight: 600)
#endif
Expand Down
3 changes: 2 additions & 1 deletion LLMFarm/Chats/ChatView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,8 @@ struct ChatView: View {
AddChatView(add_chat_dialog: $toggleEditChat,
edit_chat_dialog: $edit_chat_dialog,
chat_name: aiChatModel.chat_name,
renew_chat_list: .constant({})).environmentObject(aiChatModel)
renew_chat_list: .constant({}),
toggleSettings: .constant(false)).environmentObject(aiChatModel)
#if os(macOS)
.frame(minWidth: 400,minHeight: 600)
#endif
Expand Down
18 changes: 16 additions & 2 deletions LLMFarm/Settings/AddChatView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ struct AddChatView: View {

@Binding var add_chat_dialog: Bool
@Binding var edit_chat_dialog: Bool
@Binding var toggleSettings: Bool
@EnvironmentObject var aiChatModel: AIChatModel

// @State private var chat_config: Dictionary<String, AnyObject> = [:]
Expand Down Expand Up @@ -94,17 +95,19 @@ struct AddChatView: View {
}

init(add_chat_dialog: Binding<Bool>,edit_chat_dialog:Binding<Bool>,
renew_chat_list: Binding<() -> Void>) {
renew_chat_list: Binding<() -> Void>,toggleSettings: Binding<Bool>) {
self._add_chat_dialog = add_chat_dialog
self._edit_chat_dialog = edit_chat_dialog
self._renew_chat_list = renew_chat_list
self._toggleSettings = toggleSettings
}

init(add_chat_dialog: Binding<Bool>,edit_chat_dialog:Binding<Bool>,
chat_name:String,renew_chat_list: Binding<() -> Void>) {
chat_name:String,renew_chat_list: Binding<() -> Void>,toggleSettings: Binding<Bool>) {
self._add_chat_dialog = add_chat_dialog
self._edit_chat_dialog = edit_chat_dialog
self._renew_chat_list = renew_chat_list
self._toggleSettings = toggleSettings
self.chat_name = chat_name
let chat_config = get_chat_info(chat_name)
if chat_config == nil{ //in Swift runtime failure: Unexpectedly found nil while unwrapping an Optional value ()
Expand Down Expand Up @@ -368,6 +371,17 @@ struct AddChatView: View {
Label("Import from file...", systemImage: "plus.app")
}

if !edit_chat_dialog{
Button {
Task {
toggleSettings = true
}
} label: {
Label("Download models...", systemImage: "icloud.and.arrow.down")
}

}

Divider()

Section("Avalible models") {
Expand Down
3 changes: 2 additions & 1 deletion LLMFarm/Settings/DownloadModels.swift
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ struct DownloadModelsView: View {
// modelName: model["name"],
// modelIcon: "square.stack.3d.up.fill",
// model_files: model["models"])
}.onDelete(perform: delete)
}
// .onDelete(perform: delete)
}
#if os(macOS)
.listStyle(.sidebar)
Expand Down
1 change: 1 addition & 0 deletions LLMFarm/Settings/ModelDownloadItem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ struct ModelDownloadItem: View {
}
.frame( alignment: .trailing)
.frame( maxWidth: 90)
.frame( maxHeight: 30)

// if download_url != ""{
DownloadButton(modelName: $modelName, modelUrl: $download_url, filename:$file_name, status:$status)
Expand Down
14 changes: 14 additions & 0 deletions LLMFarm/model_setting_templates/tinyllama.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"context" : 2048,
"prompt_format" : "[system](You are a story writing assistant.)\n<|user|>{prompt}<\/s>\n<|assistant|>",
"template_name" : "TinyLLaMa 1B",
"temp" : 0.89999997615814209,
"model_inference" : "llama",
"top_p" : 0.94999998807907104,
"n_batch" : 512,
"top_k" : 40,
"use_metal" : true,
"mlock": true,
"add_bos_token" : false,
"parse_special_tokens" : true
}

0 comments on commit 08862af

Please sign in to comment.