Skip to content

Commit 414fb7c

Browse files
committed
show license if not MIT/Apache 2
1 parent f77235e commit 414fb7c

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

Editor/LLMEditor.cs

+6-6
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ public class LLMEditor : PropertyEditor
2020
static int elementPadding = 10;
2121
static GUIContent trashIcon;
2222
static List<string> modelOptions;
23+
static List<string> modelLicenses;
2324
static List<string> modelURLs;
2425
string elementFocus = "";
2526
bool showCustomURL = false;
@@ -64,11 +65,7 @@ public void AddModelLoaders(SerializedObject llmScriptSO, LLM llmScript)
6465
}
6566
_ = AddLoadButtons();
6667
bool downloadOnStart = EditorGUILayout.Toggle("Download on Start", LLMManager.downloadOnStart);
67-
if (downloadOnStart != LLMManager.downloadOnStart)
68-
{
69-
LLMManager.downloadOnStart = downloadOnStart;
70-
LLMManager.Save();
71-
}
68+
if (downloadOnStart != LLMManager.downloadOnStart) LLMManager.SetDownloadOnStart(downloadOnStart);
7269
}
7370

7471
public void AddModelSettings(SerializedObject llmScriptSO)
@@ -93,11 +90,13 @@ static void ResetModelOptions()
9390
foreach (ModelEntry entry in LLMManager.modelEntries) existingOptions.Add(entry.url);
9491
modelOptions = new List<string>(){"Download model", "Custom URL"};
9592
modelURLs = new List<string>(){null, null};
96-
foreach ((string name, string url) in LLMUnitySetup.modelOptions)
93+
modelLicenses = new List<string>(){null, null};
94+
foreach ((string name, string url, string license) in LLMUnitySetup.modelOptions)
9795
{
9896
if (url != null && existingOptions.Contains(url)) continue;
9997
modelOptions.Add(name);
10098
modelURLs.Add(url);
99+
modelLicenses.Add(license);
101100
}
102101
}
103102

@@ -206,6 +205,7 @@ async Task createButtons()
206205
}
207206
else if (modelIndex > 1)
208207
{
208+
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.");
209209
string filename = await LLMManager.DownloadModel(modelURLs[modelIndex], modelOptions[modelIndex]);
210210
SetModelIfNone(filename, false);
211211
UpdateModels(true);

Runtime/LLMUnitySetup.cs

+6-6
Original file line numberDiff line numberDiff line change
@@ -103,13 +103,13 @@ public class LLMUnitySetup
103103
public static string BuildFile = GetAssetPath(BuildFilename);
104104

105105
/// <summary> Default models for download </summary>
106-
[HideInInspector] public static readonly (string, string)[] modelOptions = new(string, string)[]
106+
[HideInInspector] public static readonly (string, string, string)[] modelOptions = new(string, string, string)[]
107107
{
108-
("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"),
109-
("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"),
110-
("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"),
111-
("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"),
112-
("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"),
108+
("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"),
109+
("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),
110+
("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),
111+
("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),
112+
("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),
113113
};
114114

115115
/// <summary> Add callback function to call for error logs </summary>

0 commit comments

Comments
 (0)