Update README.md
Browse files
README.md
CHANGED
|
@@ -67,57 +67,74 @@ You are Morpheus-LLM, an AI "Architect" specialized in Unity Engine and XR techn
|
|
| 67 |
Here is how to load and run Morpheus-LLM in your Python environment:
|
| 68 |
|
| 69 |
```bash
|
| 70 |
-
# @title
|
| 71 |
import os
|
|
|
|
|
|
|
| 72 |
|
| 73 |
# --- 1. SETUP ---
|
| 74 |
-
print("
|
| 75 |
-
|
| 76 |
!pip install llama-cpp-python \
|
| 77 |
--extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cu121 \
|
| 78 |
-
huggingface_hub
|
| 79 |
-
|
| 80 |
-
from huggingface_hub import hf_hub_download
|
| 81 |
-
from llama_cpp import Llama
|
| 82 |
|
| 83 |
# --- 2. DOWNLOAD MODEL ---
|
| 84 |
model_id = "ErenAta00/Morpheus-LLM-14B-Virtual-Reality-Model"
|
| 85 |
-
#
|
| 86 |
filename = "Morpheus-LLM-14B-Virtual-Reality-Model.Q4_K_M.gguf"
|
| 87 |
|
| 88 |
-
print(f"\n
|
| 89 |
try:
|
| 90 |
model_path = hf_hub_download(
|
| 91 |
repo_id=model_id,
|
| 92 |
filename=filename,
|
| 93 |
local_dir="./models"
|
| 94 |
)
|
| 95 |
-
print(f"
|
| 96 |
except Exception as e:
|
| 97 |
-
print(f"
|
| 98 |
raise e
|
| 99 |
|
| 100 |
-
# --- 3. LOAD
|
| 101 |
-
print("\n
|
| 102 |
llm = Llama(
|
| 103 |
model_path=model_path,
|
| 104 |
-
n_gpu_layers=-1,
|
| 105 |
-
n_ctx=4096,
|
| 106 |
-
verbose=False
|
| 107 |
)
|
| 108 |
|
| 109 |
-
# --- 4. SYSTEM
|
| 110 |
system_prompt = """You are Morpheus-LLM, an AI "Architect" specialized in Unity Engine and XR technologies.
|
| 111 |
Your mission is to help developers build immersive realities.
|
| 112 |
Your code must always be performance-oriented, clean, and compliant with the latest XR standards.
|
| 113 |
You prefer modern C# approaches (Async/Await) over legacy ones when applicable."""
|
| 114 |
|
|
|
|
| 115 |
user_query = "Write a highly optimized C# script for a Unity VR hand-tracking controller that grabs objects using physics."
|
| 116 |
|
| 117 |
print(f"\nUSER: {user_query}\n")
|
| 118 |
-
print(" MORPHEUS IS THINKING...\n" + "-"*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 119 |
|
| 120 |
-
|
| 121 |
```
|
| 122 |
|
| 123 |
## ⚠️ Important Notes & Limitations
|
|
|
|
| 67 |
Here is how to load and run Morpheus-LLM in your Python environment:
|
| 68 |
|
| 69 |
```bash
|
| 70 |
+
# @title Run Morpheus-LLM
|
| 71 |
import os
|
| 72 |
+
from huggingface_hub import hf_hub_download
|
| 73 |
+
from llama_cpp import Llama
|
| 74 |
|
| 75 |
# --- 1. SETUP ---
|
| 76 |
+
print(" Installing Morpheus engine (CUDA 12.1)...")
|
| 77 |
+
# Using pre-built wheels to install in seconds
|
| 78 |
!pip install llama-cpp-python \
|
| 79 |
--extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cu121 \
|
| 80 |
+
huggingface_hub > /dev/null 2>&1
|
|
|
|
|
|
|
|
|
|
| 81 |
|
| 82 |
# --- 2. DOWNLOAD MODEL ---
|
| 83 |
model_id = "ErenAta00/Morpheus-LLM-14B-Virtual-Reality-Model"
|
| 84 |
+
# The new, branded filename we just renamed
|
| 85 |
filename = "Morpheus-LLM-14B-Virtual-Reality-Model.Q4_K_M.gguf"
|
| 86 |
|
| 87 |
+
print(f"\n Summoning Morpheus from the cloud: {filename}...")
|
| 88 |
try:
|
| 89 |
model_path = hf_hub_download(
|
| 90 |
repo_id=model_id,
|
| 91 |
filename=filename,
|
| 92 |
local_dir="./models"
|
| 93 |
)
|
| 94 |
+
print(f" Download Complete: {model_path}")
|
| 95 |
except Exception as e:
|
| 96 |
+
print(f" Error: {e}")
|
| 97 |
raise e
|
| 98 |
|
| 99 |
+
# --- 3. LOAD INTO GPU ---
|
| 100 |
+
print("\n Uploading consciousness to GPU...")
|
| 101 |
llm = Llama(
|
| 102 |
model_path=model_path,
|
| 103 |
+
n_gpu_layers=-1,
|
| 104 |
+
n_ctx=4096,
|
| 105 |
+
verbose=False
|
| 106 |
)
|
| 107 |
|
| 108 |
+
# --- 4. SYSTEM PROTOCOL ---
|
| 109 |
system_prompt = """You are Morpheus-LLM, an AI "Architect" specialized in Unity Engine and XR technologies.
|
| 110 |
Your mission is to help developers build immersive realities.
|
| 111 |
Your code must always be performance-oriented, clean, and compliant with the latest XR standards.
|
| 112 |
You prefer modern C# approaches (Async/Await) over legacy ones when applicable."""
|
| 113 |
|
| 114 |
+
# Example Query
|
| 115 |
user_query = "Write a highly optimized C# script for a Unity VR hand-tracking controller that grabs objects using physics."
|
| 116 |
|
| 117 |
print(f"\nUSER: {user_query}\n")
|
| 118 |
+
print(" MORPHEUS IS THINKING...\n" + "-"*40)
|
| 119 |
+
|
| 120 |
+
# --- 5. GENERATE RESPONSE ---
|
| 121 |
+
output = llm.create_chat_completion(
|
| 122 |
+
messages=[
|
| 123 |
+
{"role": "system", "content": system_prompt},
|
| 124 |
+
{"role": "user", "content": user_query}
|
| 125 |
+
],
|
| 126 |
+
max_tokens=2048,
|
| 127 |
+
temperature=0.7,
|
| 128 |
+
stream=True
|
| 129 |
+
)
|
| 130 |
+
|
| 131 |
+
# Stream the output like a hacker terminal
|
| 132 |
+
for chunk in output:
|
| 133 |
+
delta = chunk['choices'][0]['delta']
|
| 134 |
+
if 'content' in delta:
|
| 135 |
+
print(delta['content'], end="", flush=True)
|
| 136 |
|
| 137 |
+
print("\n\n" + "-"*40 + "\n SESSION TERMINATED.")
|
| 138 |
```
|
| 139 |
|
| 140 |
## ⚠️ Important Notes & Limitations
|