From f77235ecc499a56aa84cbba73d2c59168b2ea592 Mon Sep 17 00:00:00 2001 From: Antonis Makropoulos Date: Fri, 26 Jul 2024 20:57:09 +0300 Subject: [PATCH 1/2] add llama3 7B and Qwen2 0.5B models --- Runtime/LLMUnitySetup.cs | 9 +++++---- Third Party Notices.md | 25 +++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/Runtime/LLMUnitySetup.cs b/Runtime/LLMUnitySetup.cs index 29d82961..6581f629 100644 --- a/Runtime/LLMUnitySetup.cs +++ b/Runtime/LLMUnitySetup.cs @@ -105,10 +105,11 @@ public class LLMUnitySetup /// Default models for download [HideInInspector] public static readonly (string, string)[] modelOptions = new(string, string)[] { - ("Mistral 7B Instruct v0.2 (medium, best overall)", "https://huggingface.co/TheBloke/Mistral-7B-Instruct-v0.2-GGUF/resolve/main/mistral-7b-instruct-v0.2.Q4_K_M.gguf?download=true"), - ("OpenHermes 2.5 7B (medium, best for conversation)", "https://huggingface.co/TheBloke/OpenHermes-2.5-Mistral-7B-GGUF/resolve/main/openhermes-2.5-mistral-7b.Q4_K_M.gguf?download=true"), - ("Phi 3 (small, great)", "https://huggingface.co/microsoft/Phi-3-mini-4k-instruct-gguf/resolve/main/Phi-3-mini-4k-instruct-q4.gguf?download=true"), - ("Test", "https://huggingface.co/afrideva/smol_llama-220M-openhermes-GGUF/resolve/main/smol_llama-220m-openhermes.q4_k_m.gguf?download=true"), + ("Llama 3 7B (medium, best overall)", "https://huggingface.co/lmstudio-community/Meta-Llama-3-8B-Instruct-GGUF/resolve/main/Meta-Llama-3-8B-Instruct-Q4_K_M.gguf?download=true"), + ("Mistral 7B Instruct v0.2 (medium, great overall)", "https://huggingface.co/TheBloke/Mistral-7B-Instruct-v0.2-GGUF/resolve/main/mistral-7b-instruct-v0.2.Q4_K_M.gguf?download=true"), + ("OpenHermes 2.5 7B (medium, good for conversation)", "https://huggingface.co/TheBloke/OpenHermes-2.5-Mistral-7B-GGUF/resolve/main/openhermes-2.5-mistral-7b.Q4_K_M.gguf?download=true"), + ("Phi 3 (small, great small model)", "https://huggingface.co/microsoft/Phi-3-mini-4k-instruct-gguf/resolve/main/Phi-3-mini-4k-instruct-q4.gguf?download=true"), + ("Qwen 2 0.5B (tiny, useful for mobile)", "https://huggingface.co/Qwen/Qwen2-0.5B-Instruct-GGUF/resolve/main/qwen2-0_5b-instruct-q4_k_m.gguf?download=true"), }; /// Add callback function to call for error logs diff --git a/Third Party Notices.md b/Third Party Notices.md index 0c482440..ca86d120 100644 --- a/Third Party Notices.md +++ b/Third Party Notices.md @@ -26,6 +26,22 @@ License: [link](https://github.com/Mozilla-Ocho/llamafile/blob/main/LICENSE) The following models can be downloaded with LLMUnity: +### meta-llama/Meta-Llama-3-8B-Instruct + +Developer: Meta
+Origin: [link](https://huggingface.co/meta-llama/Meta-Llama-3-8B-Instruct)
+License Type: "llama3"
+License: [link](https://huggingface.co/meta-llama/Meta-Llama-3-8B/blob/main/LICENSE) + +##### modified by: lmstudio-community/Meta-Llama-3-8B-Instruct-GGUF + +Developer: LM Studio
+Origin: [link](https://huggingface.co/TheBloke/Mistral-7B-Instruct-v0.2-GGUF)
+License Type: "llama3"
+License: [link](https://huggingface.co/meta-llama/Meta-Llama-3-8B/blob/main/LICENSE) + +
+ ### mistralai/Mistral-7B-Instruct-v0.2 Developer: Mistral AI
@@ -65,6 +81,15 @@ Origin: [link](https://huggingface.co/TheBloke/OpenHermes-2.5-Mistral-7B-GGUF) License: [link](https://huggingface.co/TheBloke/OpenHermes-2.5-Mistral-7B-GGUF) +
+ +### Qwen/Qwen2-0.5B-Instruct-GGUF + +Developer: Qwen
+Origin: [link](https://huggingface.co/Qwen/Qwen2-0.5B-Instruct-GGUF)
+License Type: "Apache 2.0"
+License: [link](https://huggingface.co/Qwen/Qwen2-0.5B-Instruct-GGUF/blob/main/LICENSE) + --- ## Testing From 414fb7c236b5c5af8fd1f9726aadfde52ba4c9a1 Mon Sep 17 00:00:00 2001 From: Antonis Makropoulos Date: Fri, 26 Jul 2024 21:04:16 +0300 Subject: [PATCH 2/2] show license if not MIT/Apache 2 --- Editor/LLMEditor.cs | 12 ++++++------ Runtime/LLMUnitySetup.cs | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Editor/LLMEditor.cs b/Editor/LLMEditor.cs index 8b72373e..72920d0e 100644 --- a/Editor/LLMEditor.cs +++ b/Editor/LLMEditor.cs @@ -20,6 +20,7 @@ public class LLMEditor : PropertyEditor static int elementPadding = 10; static GUIContent trashIcon; static List modelOptions; + static List modelLicenses; static List modelURLs; string elementFocus = ""; bool showCustomURL = false; @@ -64,11 +65,7 @@ public void AddModelLoaders(SerializedObject llmScriptSO, LLM llmScript) } _ = AddLoadButtons(); bool downloadOnStart = EditorGUILayout.Toggle("Download on Start", LLMManager.downloadOnStart); - if (downloadOnStart != LLMManager.downloadOnStart) - { - LLMManager.downloadOnStart = downloadOnStart; - LLMManager.Save(); - } + if (downloadOnStart != LLMManager.downloadOnStart) LLMManager.SetDownloadOnStart(downloadOnStart); } public void AddModelSettings(SerializedObject llmScriptSO) @@ -93,11 +90,13 @@ static void ResetModelOptions() foreach (ModelEntry entry in LLMManager.modelEntries) existingOptions.Add(entry.url); modelOptions = new List(){"Download model", "Custom URL"}; modelURLs = new List(){null, null}; - foreach ((string name, string url) in LLMUnitySetup.modelOptions) + modelLicenses = new List(){null, null}; + foreach ((string name, string url, string license) in LLMUnitySetup.modelOptions) { if (url != null && existingOptions.Contains(url)) continue; modelOptions.Add(name); modelURLs.Add(url); + modelLicenses.Add(license); } } @@ -206,6 +205,7 @@ async Task createButtons() } else if (modelIndex > 1) { + if (modelLicenses[modelIndex] != null) Debug.LogWarning($"The {modelOptions[modelIndex]} model is released under the following license: {modelLicenses[modelIndex]}. By using this model, you agree to the terms of the license."); string filename = await LLMManager.DownloadModel(modelURLs[modelIndex], modelOptions[modelIndex]); SetModelIfNone(filename, false); UpdateModels(true); diff --git a/Runtime/LLMUnitySetup.cs b/Runtime/LLMUnitySetup.cs index 6581f629..62d087ee 100644 --- a/Runtime/LLMUnitySetup.cs +++ b/Runtime/LLMUnitySetup.cs @@ -103,13 +103,13 @@ public class LLMUnitySetup public static string BuildFile = GetAssetPath(BuildFilename); /// Default models for download - [HideInInspector] public static readonly (string, string)[] modelOptions = new(string, string)[] + [HideInInspector] public static readonly (string, string, string)[] modelOptions = new(string, string, string)[] { - ("Llama 3 7B (medium, best overall)", "https://huggingface.co/lmstudio-community/Meta-Llama-3-8B-Instruct-GGUF/resolve/main/Meta-Llama-3-8B-Instruct-Q4_K_M.gguf?download=true"), - ("Mistral 7B Instruct v0.2 (medium, great overall)", "https://huggingface.co/TheBloke/Mistral-7B-Instruct-v0.2-GGUF/resolve/main/mistral-7b-instruct-v0.2.Q4_K_M.gguf?download=true"), - ("OpenHermes 2.5 7B (medium, good for conversation)", "https://huggingface.co/TheBloke/OpenHermes-2.5-Mistral-7B-GGUF/resolve/main/openhermes-2.5-mistral-7b.Q4_K_M.gguf?download=true"), - ("Phi 3 (small, great small model)", "https://huggingface.co/microsoft/Phi-3-mini-4k-instruct-gguf/resolve/main/Phi-3-mini-4k-instruct-q4.gguf?download=true"), - ("Qwen 2 0.5B (tiny, useful for mobile)", "https://huggingface.co/Qwen/Qwen2-0.5B-Instruct-GGUF/resolve/main/qwen2-0_5b-instruct-q4_k_m.gguf?download=true"), + ("Llama 3 7B (medium, best overall)", "https://huggingface.co/lmstudio-community/Meta-Llama-3-8B-Instruct-GGUF/resolve/main/Meta-Llama-3-8B-Instruct-Q4_K_M.gguf?download=true", "https://huggingface.co/meta-llama/Meta-Llama-3-8B/blob/main/LICENSE"), + ("Mistral 7B Instruct v0.2 (medium, great overall)", "https://huggingface.co/TheBloke/Mistral-7B-Instruct-v0.2-GGUF/resolve/main/mistral-7b-instruct-v0.2.Q4_K_M.gguf?download=true", null), + ("OpenHermes 2.5 7B (medium, good for conversation)", "https://huggingface.co/TheBloke/OpenHermes-2.5-Mistral-7B-GGUF/resolve/main/openhermes-2.5-mistral-7b.Q4_K_M.gguf?download=true", null), + ("Phi 3 (small, great small model)", "https://huggingface.co/microsoft/Phi-3-mini-4k-instruct-gguf/resolve/main/Phi-3-mini-4k-instruct-q4.gguf?download=true", null), + ("Qwen 2 0.5B (tiny, useful for mobile)", "https://huggingface.co/Qwen/Qwen2-0.5B-Instruct-GGUF/resolve/main/qwen2-0_5b-instruct-q4_k_m.gguf?download=true", null), }; /// Add callback function to call for error logs