Skip to content

Add Llama 3 7B and Qwen2 0.5B models #198

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions Editor/LLMEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public class LLMEditor : PropertyEditor
static int elementPadding = 10;
static GUIContent trashIcon;
static List<string> modelOptions;
static List<string> modelLicenses;
static List<string> modelURLs;
string elementFocus = "";
bool showCustomURL = false;
Expand Down Expand Up @@ -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)
Expand All @@ -93,11 +90,13 @@ static void ResetModelOptions()
foreach (ModelEntry entry in LLMManager.modelEntries) existingOptions.Add(entry.url);
modelOptions = new List<string>(){"Download model", "Custom URL"};
modelURLs = new List<string>(){null, null};
foreach ((string name, string url) in LLMUnitySetup.modelOptions)
modelLicenses = new List<string>(){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);
}
}

Expand Down Expand Up @@ -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);
Expand Down
11 changes: 6 additions & 5 deletions Runtime/LLMUnitySetup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,13 @@ public class LLMUnitySetup
public static string BuildFile = GetAssetPath(BuildFilename);

/// <summary> Default models for download </summary>
[HideInInspector] public static readonly (string, string)[] modelOptions = new(string, string)[]
[HideInInspector] public static readonly (string, string, string)[] modelOptions = new(string, 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", "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),
};

/// <summary> Add callback function to call for error logs </summary>
Expand Down
25 changes: 25 additions & 0 deletions Third Party Notices.md
Original file line number Diff line number Diff line change
Expand Up @@ -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<br>
Origin: [link](https://huggingface.co/meta-llama/Meta-Llama-3-8B-Instruct)<br>
License Type: "llama3"<br>
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<br>
Origin: [link](https://huggingface.co/TheBloke/Mistral-7B-Instruct-v0.2-GGUF)<br>
License Type: "llama3"<br>
License: [link](https://huggingface.co/meta-llama/Meta-Llama-3-8B/blob/main/LICENSE)

<br>

### mistralai/Mistral-7B-Instruct-v0.2

Developer: Mistral AI<br>
Expand Down Expand Up @@ -65,6 +81,15 @@ Origin: [link](https://huggingface.co/TheBloke/OpenHermes-2.5-Mistral-7B-GGUF)<b
License Type: "Apache 2.0"<br>
License: [link](https://huggingface.co/TheBloke/OpenHermes-2.5-Mistral-7B-GGUF)

<br>

### Qwen/Qwen2-0.5B-Instruct-GGUF

Developer: Qwen<br>
Origin: [link](https://huggingface.co/Qwen/Qwen2-0.5B-Instruct-GGUF)<br>
License Type: "Apache 2.0"<br>
License: [link](https://huggingface.co/Qwen/Qwen2-0.5B-Instruct-GGUF/blob/main/LICENSE)

---

## Testing
Expand Down
Loading