MojoLlama
Archived Mojo/MAX quantizer and serving research repository (read-only history)
Brought by drakestapleton
MojoLlama / www / docs / index.html
| 1 | <!DOCTYPE html> |
| 2 | <html lang="en"> |
| 3 | <head> |
| 4 | <meta charset="UTF-8"> |
| 5 | <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| 6 | <title>MojoLlama Documentation</title> |
| 7 | <meta name="description" content="MojoLlama documentation: CLI reference, Docker guide, model support, troubleshooting, and API reference."> |
| 8 | <meta name="color-scheme" content="light dark"> |
| 9 | <link rel="icon" type="image/png" sizes="32x32" href="../favicon.png"> |
| 10 | <link rel="icon" type="image/png" sizes="48x48" href="../favicon-48.png"> |
| 11 | <link rel="preconnect" href="https://fonts.googleapis.com"> |
| 12 | <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> |
| 13 | <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet"> |
| 14 | <style> |
| 15 | /* ══════════════════════════════════════════════ |
| 16 | MojoLlama Docs — Carbon-Inspired Design System |
| 17 | Token-driven theming, progressive layering, |
| 18 | accessible focus, half-step interactions |
| 19 | ══════════════════════════════════════════════ */ |
| 20 | :root { |
| 21 | --mojo: #6C3CE1; --mojo-dark: #5228B5; --mojo-light: #8B5CF6; |
| 22 | --mojo-subtle: rgba(108,60,225,0.08); |
| 23 | --bg: #FFFFFF; --bg-alt: #F4F4F4; |
| 24 | --sidebar-bg: #F4F4F4; --sidebar-hover: #E8E8E8; |
| 25 | --sidebar-active: #FFFFFF; |
| 26 | --border: #E0E0E0; --border-light: #EDEDED; --border-strong: #C6C6C6; |
| 27 | --text: #161616; --text-secondary: #525252; |
| 28 | --text-tertiary: #8D8D8D; --text-inverse: #FFFFFF; |
| 29 | --success: #198038; --warning: #DA1E28; --info: #0043CE; |
| 30 | --layer-hover: rgba(0,0,0,0.04); |
| 31 | --focus: #6C3CE1; --focus-inverse: #FFFFFF; |
| 32 | --font-body: 'Inter', 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; |
| 33 | --font-mono: 'JetBrains Mono', 'IBM Plex Mono', 'Fira Code', monospace; |
| 34 | --radius-sm: 4px; --radius: 8px; --radius-lg: 12px; |
| 35 | --transition: 0.15s cubic-bezier(0.2, 0, 0, 1); |
| 36 | --transition-slow: 0.4s cubic-bezier(0.2, 0, 0, 1); |
| 37 | --toc-width: 280px; |
| 38 | } |
| 39 | |
| 40 | /* ── Dark theme — IBM Carbon g90/g100 progressive layering ── */ |
| 41 | [data-theme="dark"] { |
| 42 | --bg: #161616; --bg-alt: #1C1C1C; |
| 43 | --sidebar-bg: #1C1C1C; --sidebar-hover: #262626; |
| 44 | --sidebar-active: #262626; |
| 45 | --border: #393939; --border-light: #333333; --border-strong: #525252; |
| 46 | --text: #F4F4F4; --text-secondary: #C6C6C6; |
| 47 | --text-tertiary: #8D8D8D; --text-inverse: #161616; |
| 48 | --layer-hover: rgba(255,255,255,0.05); |
| 49 | --mojo-subtle: rgba(139,92,246,0.15); |
| 50 | --success: #42BE65; --warning: #FA4D56; --info: #5AA8FF; |
| 51 | --focus: #8B5CF6; --focus-inverse: #161616; |
| 52 | } |
| 53 | @media (prefers-color-scheme: dark) { |
| 54 | :root:not([data-theme="light"]) { |
| 55 | --bg: #161616; --bg-alt: #1C1C1C; |
| 56 | --sidebar-bg: #1C1C1C; --sidebar-hover: #262626; |
| 57 | --sidebar-active: #262626; |
| 58 | --border: #393939; --border-light: #333333; --border-strong: #525252; |
| 59 | --text: #F4F4F4; --text-secondary: #C6C6C6; |
| 60 | --text-tertiary: #8D8D8D; --text-inverse: #161616; |
| 61 | --layer-hover: rgba(255,255,255,0.05); |
| 62 | --mojo-subtle: rgba(139,92,246,0.15); |
| 63 | --success: #42BE65; --warning: #FA4D56; --info: #5AA8FF; |
| 64 | --focus: #8B5CF6; --focus-inverse: #161616; |
| 65 | } |
| 66 | } |
| 67 | |
| 68 | *, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; } |
| 69 | html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; } |
| 70 | body { font-family: var(--font-body); background: var(--bg); color: var(--text); line-height: 1.6; font-size: 16px; transition: background var(--transition-slow), color var(--transition-slow); } |
| 71 | ::selection { background: var(--mojo-subtle); } |
| 72 | a { color: var(--mojo); text-decoration: none; transition: color var(--transition); } |
| 73 | a:hover { color: var(--mojo-dark); } |
| 74 | img { max-width: 100%; } |
| 75 | |
| 76 | /* ── Skip to content ── */ |
| 77 | .skip-link { |
| 78 | position: absolute; top: -100%; left: 16px; |
| 79 | background: var(--mojo); color: #fff; |
| 80 | padding: 8px 16px; border-radius: var(--radius-sm); |
| 81 | font-size: 0.875rem; font-weight: 600; z-index: 9999; |
| 82 | transition: top 0.2s; |
| 83 | } |
| 84 | .skip-link:focus { top: 8px; color: #fff; } |
| 85 | |
| 86 | /* ── Focus visible ── */ |
| 87 | :focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; } |
| 88 | [data-theme="dark"] :focus-visible { outline-color: var(--focus); } |
| 89 | |
| 90 | /* ── Scroll reveal ── */ |
| 91 | .reveal { |
| 92 | opacity: 0; transform: translateY(16px); |
| 93 | transition: opacity 0.5s cubic-bezier(0.2,0,0,1), transform 0.5s cubic-bezier(0.2,0,0,1); |
| 94 | } |
| 95 | .reveal.visible { opacity: 1; transform: translateY(0); } |
| 96 | |
| 97 | /* ─── Top Nav ─── */ |
| 98 | nav.top { |
| 99 | position: fixed; top: 0; width: 100%; z-index: 100; |
| 100 | background: rgba(255,255,255,0.92); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); |
| 101 | border-bottom: 1px solid var(--border-light); height: 48px; |
| 102 | display: flex; align-items: center; padding: 0 24px; |
| 103 | transition: background var(--transition-slow), border-color var(--transition-slow); |
| 104 | } |
| 105 | [data-theme="dark"] nav.top, |
| 106 | :root:not([data-theme="light"]) nav.top { |
| 107 | background: rgba(22,22,22,0.92); |
| 108 | } |
| 109 | nav.top .inner { max-width: 1440px; margin: 0 auto; width: 100%; display: flex; align-items: center; gap: 16px; } |
| 110 | nav.top .logo { font-weight: 700; font-size: 1rem; color: var(--text); } |
| 111 | nav.top .logo span { color: var(--mojo); } |
| 112 | nav.top .logo:hover { color: var(--text); } |
| 113 | nav.top .breadcrumb { color: var(--text-tertiary); font-size: 0.82rem; display: flex; align-items: center; gap: 6px; } |
| 114 | nav.top .breadcrumb a { color: var(--text-tertiary); } |
| 115 | nav.top .breadcrumb a:hover { color: var(--mojo); } |
| 116 | nav.top .breadcrumb .sep { color: var(--border); } |
| 117 | nav.top .nav-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; } |
| 118 | |
| 119 | /* Theme toggle (same as index.html) */ |
| 120 | .theme-toggle { |
| 121 | background: none; border: 1px solid var(--border); border-radius: var(--radius-sm); |
| 122 | width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; |
| 123 | cursor: pointer; color: var(--text-secondary); transition: all var(--transition); padding: 0; |
| 124 | } |
| 125 | .theme-toggle:hover { border-color: var(--mojo); color: var(--mojo); background: var(--mojo-subtle); } |
| 126 | .theme-toggle svg { width: 16px; height: 16px; } |
| 127 | .theme-toggle .icon-moon { display: block; } |
| 128 | .theme-toggle .icon-sun { display: none; } |
| 129 | [data-theme="dark"] .theme-toggle .icon-moon { display: none; } |
| 130 | [data-theme="dark"] .theme-toggle .icon-sun { display: block; } |
| 131 | :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; } |
| 132 | :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: block; } |
| 133 | |
| 134 | /* Mobile sidebar toggle */ |
| 135 | .sidebar-toggle { |
| 136 | display: none; background: none; border: 1px solid var(--border); |
| 137 | border-radius: var(--radius-sm); width: 32px; height: 32px; |
| 138 | align-items: center; justify-content: center; cursor: pointer; |
| 139 | color: var(--text-secondary); transition: all var(--transition); padding: 0; |
| 140 | } |
| 141 | .sidebar-toggle:hover { border-color: var(--mojo); color: var(--mojo); } |
| 142 | .sidebar-toggle svg { width: 18px; height: 18px; } |
| 143 | |
| 144 | /* ─── Layout ─── */ |
| 145 | .wrap { display: flex; max-width: 1440px; margin: 48px auto 0; min-height: calc(100vh - 48px); } |
| 146 | |
| 147 | /* ─── Sidebar TOC ─── */ |
| 148 | .toc { |
| 149 | width: var(--toc-width); flex-shrink: 0; |
| 150 | background: var(--sidebar-bg); border-right: 1px solid var(--border); |
| 151 | padding: 0; overflow-y: auto; |
| 152 | position: sticky; top: 48px; height: calc(100vh - 48px); |
| 153 | transition: background var(--transition-slow), border-color var(--transition-slow); |
| 154 | } |
| 155 | .toc-header { padding: 20px 20px 12px; border-bottom: 1px solid var(--border); } |
| 156 | .toc-header h3 { font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-tertiary); margin-bottom: 8px; } |
| 157 | .toc-search { width: 100%; } |
| 158 | .toc-search input { |
| 159 | width: 100%; padding: 6px 10px; font-size: 0.8rem; |
| 160 | border: 1px solid var(--border); border-radius: var(--radius-sm); |
| 161 | background: var(--bg); font-family: inherit; color: var(--text); |
| 162 | outline: none; transition: border-color var(--transition), background var(--transition-slow); |
| 163 | } |
| 164 | .toc-search input:focus { border-color: var(--mojo); } |
| 165 | .toc-search input::placeholder { color: var(--text-tertiary); } |
| 166 | .toc-nav { padding: 8px 0; } |
| 167 | .toc-section { margin-bottom: 2px; } |
| 168 | .toc-section-title { |
| 169 | display: flex; align-items: center; justify-content: space-between; |
| 170 | padding: 8px 20px 8px 16px; cursor: pointer; |
| 171 | font-size: 0.82rem; font-weight: 600; color: var(--text); |
| 172 | transition: background var(--transition); border-left: 3px solid transparent; |
| 173 | } |
| 174 | .toc-section-title:hover { background: var(--sidebar-hover); } |
| 175 | .toc-section-title.active { background: var(--sidebar-active); border-left-color: var(--mojo); color: var(--mojo); } |
| 176 | .toc-section-title .arrow { font-size: 0.6rem; color: var(--text-tertiary); transition: transform 0.2s; } |
| 177 | .toc-section-title.open .arrow { transform: rotate(90deg); } |
| 178 | .toc-items { display: none; } |
| 179 | .toc-items.open { display: block; } |
| 180 | .toc-item { |
| 181 | display: block; padding: 5px 20px 5px 28px; |
| 182 | font-size: 0.8rem; color: var(--text-secondary); |
| 183 | border-left: 2px solid transparent; transition: all var(--transition); |
| 184 | } |
| 185 | .toc-item:hover { color: var(--text); background: var(--sidebar-hover); } |
| 186 | .toc-item.active { color: var(--mojo); border-left-color: var(--mojo); background: var(--sidebar-active); font-weight: 500; } |
| 187 | |
| 188 | /* ─── Content ─── */ |
| 189 | .content { flex: 1; min-width: 0; padding: 32px 48px 80px; max-width: 960px; } |
| 190 | .content h1 { font-size: 2.2rem; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 0.5rem; } |
| 191 | .content h1 .tagline { display: block; font-size: 1rem; font-weight: 400; color: var(--text-secondary); margin-top: 4px; } |
| 192 | .content .last-updated { font-size: 0.78rem; color: var(--text-tertiary); margin-bottom: 32px; } |
| 193 | |
| 194 | .content h2 { font-size: 1.5rem; font-weight: 600; margin: 40px 0 16px; padding-bottom: 8px; border-bottom: 1px solid var(--border-light); } |
| 195 | .content h3 { font-size: 1.15rem; font-weight: 600; margin: 28px 0 10px; } |
| 196 | .content h4 { font-size: 1rem; font-weight: 600; margin: 20px 0 8px; } |
| 197 | .content p { color: var(--text-secondary); margin-bottom: 16px; max-width: 720px; } |
| 198 | .content ul, .content ol { color: var(--text-secondary); margin: 8px 0 16px 24px; } |
| 199 | .content li { margin-bottom: 4px; } |
| 200 | .content hr { border: none; border-top: 1px solid var(--border-light); margin: 32px 0; } |
| 201 | |
| 202 | /* Code */ |
| 203 | .content code { |
| 204 | font-family: var(--font-mono); font-size: 0.85em; |
| 205 | background: var(--mojo-subtle); padding: 2px 6px; border-radius: var(--radius-sm); color: var(--mojo-dark); |
| 206 | } |
| 207 | [data-theme="dark"] .content code, |
| 208 | :root:not([data-theme="light"]) .content code { color: var(--mojo-light); } |
| 209 | .content pre { |
| 210 | background: #1a1a2e; color: #e0e0e0; border-radius: var(--radius-lg); |
| 211 | padding: 16px 20px; font-family: var(--font-mono); font-size: 0.82rem; |
| 212 | line-height: 1.7; overflow-x: auto; margin: 16px 0; max-width: 720px; |
| 213 | position: relative; |
| 214 | } |
| 215 | [data-theme="dark"] .content pre, |
| 216 | :root:not([data-theme="light"]) .content pre { background: #0D0D14; } |
| 217 | .content pre .prompt { color: var(--mojo-light); } |
| 218 | .content pre .comment { color: #6f6f8f; font-style: italic; } |
| 219 | .content pre .cmd { color: #e0e0f0; } |
| 220 | .content pre .result { color: #6fcf97; } |
| 221 | .content pre .err { color: #f85149; } |
| 222 | |
| 223 | /* Copy button */ |
| 224 | .copy-btn { |
| 225 | position: absolute; top: 8px; right: 8px; |
| 226 | background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.15); |
| 227 | border-radius: var(--radius-sm); padding: 4px 10px; |
| 228 | font-size: 0.7rem; font-family: var(--font-body); |
| 229 | color: rgba(255,255,255,0.6); cursor: pointer; |
| 230 | transition: all var(--transition); opacity: 0; |
| 231 | } |
| 232 | .content pre:hover .copy-btn { opacity: 1; } |
| 233 | .copy-btn:hover { background: rgba(255,255,255,0.2); color: #fff; } |
| 234 | .copy-btn.copied { color: #6fcf97; border-color: #6fcf97; opacity: 1; } |
| 235 | |
| 236 | .content kbd { |
| 237 | background: var(--bg-alt); border: 1px solid var(--border); |
| 238 | border-radius: 3px; padding: 1px 5px; font-size: 0.78rem; |
| 239 | font-family: var(--font-mono); |
| 240 | } |
| 241 | |
| 242 | /* Callouts */ |
| 243 | .callout { border-radius: var(--radius); padding: 12px 16px; margin: 16px 0; font-size: 0.9rem; max-width: 720px; } |
| 244 | .callout.tip { background: rgba(25,128,56,0.06); border-left: 3px solid var(--success); } |
| 245 | .callout.tip strong { color: var(--success); } |
| 246 | .callout.note { background: var(--mojo-subtle); border-left: 3px solid var(--mojo); } |
| 247 | .callout.note strong { color: var(--mojo); } |
| 248 | .callout.warning { background: rgba(218,30,40,0.04); border-left: 3px solid var(--warning); } |
| 249 | .callout.warning strong { color: var(--warning); } |
| 250 | |
| 251 | /* Tables */ |
| 252 | .content .table-wrap { overflow-x: auto; border: 1px solid var(--border-light); border-radius: var(--radius-lg); margin: 16px 0; max-width: 720px; } |
| 253 | .content table { width: 100%; border-collapse: collapse; font-size: 0.88rem; } |
| 254 | .content th { padding: 10px 16px; text-align: left; font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-tertiary); background: var(--bg-alt); border-bottom: 1px solid var(--border-light); } |
| 255 | .content td { padding: 10px 16px; border-bottom: 1px solid var(--border-light); color: var(--text-secondary); } |
| 256 | .content tr:last-child td { border-bottom: none; } |
| 257 | .content tr:hover td { background: var(--mojo-subtle); } |
| 258 | .content td:first-child { font-family: var(--font-mono); font-size: 0.82rem; color: var(--text); white-space: nowrap; } |
| 259 | .content td strong { color: var(--text); } |
| 260 | |
| 261 | /* Topics grid */ |
| 262 | .topics-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin: 24px 0; } |
| 263 | .topic-card { |
| 264 | padding: 20px; border: 1px solid var(--border-light); border-radius: var(--radius); |
| 265 | transition: all var(--transition); cursor: pointer; background: var(--bg); |
| 266 | } |
| 267 | .topic-card:hover { border-color: var(--mojo); box-shadow: 0 2px 8px rgba(0,0,0,0.04); background: var(--layer-hover); } |
| 268 | .topic-card h3 { font-size: 1rem; font-weight: 600; margin: 0 0 6px; } |
| 269 | .topic-card h3 a { color: var(--text); } |
| 270 | .topic-card h3 a:hover { color: var(--mojo); } |
| 271 | .topic-card p { font-size: 0.85rem; color: var(--text-secondary); margin: 0; max-width: 100%; } |
| 272 | .topic-card .tag { |
| 273 | display: inline-block; font-size: 0.7rem; font-weight: 600; |
| 274 | padding: 2px 8px; border-radius: 100px; margin-bottom: 10px; |
| 275 | } |
| 276 | .tag-cli { background: var(--mojo-subtle); color: var(--mojo); } |
| 277 | .tag-docker { background: rgba(0,67,206,0.08); color: var(--info); } |
| 278 | .tag-models { background: rgba(25,128,56,0.08); color: var(--success); } |
| 279 | .tag-guide { background: rgba(212,90,0,0.08); color: var(--warning); } |
| 280 | |
| 281 | /* ─── Footer ─── */ |
| 282 | .doc-footer { margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--border-light); font-size: 0.82rem; color: var(--text-tertiary); display: flex; justify-content: space-between; } |
| 283 | |
| 284 | /* ─── Back-to-top ── */ |
| 285 | .back-to-top { |
| 286 | position: fixed; bottom: 24px; right: 24px; |
| 287 | width: 40px; height: 40px; |
| 288 | background: var(--bg); border: 1px solid var(--border); border-radius: 50%; |
| 289 | display: flex; align-items: center; justify-content: center; |
| 290 | cursor: pointer; opacity: 0; transform: translateY(10px); |
| 291 | transition: opacity var(--transition), transform var(--transition), background var(--transition); |
| 292 | z-index: 50; color: var(--text-secondary); box-shadow: 0 2px 8px rgba(0,0,0,0.1); |
| 293 | } |
| 294 | .back-to-top.visible { opacity: 1; transform: translateY(0); } |
| 295 | .back-to-top:hover { background: var(--mojo); color: #fff; border-color: var(--mojo); } |
| 296 | |
| 297 | /* ─── Mobile sidebar overlay ─── */ |
| 298 | .sidebar-overlay { |
| 299 | display: none; position: fixed; inset: 0; |
| 300 | background: rgba(0,0,0,0.4); z-index: 199; |
| 301 | opacity: 0; transition: opacity 0.3s; |
| 302 | } |
| 303 | .sidebar-overlay.open { opacity: 1; } |
| 304 | |
| 305 | /* ─── Responsive ─── */ |
| 306 | @media (max-width: 1100px) { |
| 307 | .toc { width: 220px; } |
| 308 | .content { padding: 24px 32px 60px; } |
| 309 | } |
| 310 | @media (max-width: 768px) { |
| 311 | .sidebar-toggle { display: flex; } |
| 312 | .toc { |
| 313 | position: fixed; top: 48px; left: 0; bottom: 0; |
| 314 | width: 280px; z-index: 200; |
| 315 | transform: translateX(-100%); |
| 316 | transition: transform 0.3s cubic-bezier(0.2,0,0,1); |
| 317 | } |
| 318 | .toc.open { transform: translateX(0); } |
| 319 | .content { padding: 20px 20px 48px; max-width: 100%; } |
| 320 | .topics-grid { grid-template-columns: 1fr; } |
| 321 | .content h1 { font-size: 1.6rem; } |
| 322 | .content h2 { font-size: 1.25rem; } |
| 323 | .content pre { max-width: 100%; } |
| 324 | } |
| 325 | @media (max-width: 480px) { |
| 326 | .content { padding: 16px; } |
| 327 | } |
| 328 | </style> |
| 329 | </head> |
| 330 | <body> |
| 331 | |
| 332 | <a href="#main-content" class="skip-link">Skip to content</a> |
| 333 | |
| 334 | <nav class="top"> |
| 335 | <div class="inner"> |
| 336 | <a href="../index.html" class="logo">Mojo<span>Llama</span></a> |
| 337 | <div class="breadcrumb"> |
| 338 | <a href="../index.html">Home</a> |
| 339 | <span class="sep">/</span> |
| 340 | <span>Documentation</span> |
| 341 | </div> |
| 342 | <div class="nav-actions"> |
| 343 | <button class="sidebar-toggle" id="sidebarToggle" aria-label="Toggle sidebar"> |
| 344 | <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="3" y1="12" x2="21" y2="12"/><line x1="3" y1="6" x2="21" y2="6"/><line x1="3" y1="18" x2="21" y2="18"/></svg> |
| 345 | </button> |
| 346 | <button class="theme-toggle" id="themeToggle" aria-label="Toggle dark mode"> |
| 347 | <svg class="icon-moon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"/></svg> |
| 348 | <svg class="icon-sun" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="5"/><line x1="12" y1="1" x2="12" y2="3"/><line x1="12" y1="21" x2="12" y2="23"/><line x1="4.22" y1="4.22" x2="5.64" y2="5.64"/><line x1="18.36" y1="18.36" x2="19.78" y2="19.78"/><line x1="1" y1="12" x2="3" y2="12"/><line x1="21" y1="12" x2="23" y2="12"/><line x1="4.22" y1="19.78" x2="5.64" y2="18.36"/><line x1="18.36" y1="5.64" x2="19.78" y2="4.22"/></svg> |
| 349 | </button> |
| 350 | </div> |
| 351 | </div> |
| 352 | </nav> |
| 353 | |
| 354 | <div class="sidebar-overlay" id="sidebarOverlay"></div> |
| 355 | |
| 356 | <div class="wrap"> |
| 357 | <!-- ═══ SIDEBAR TOC ═══ --> |
| 358 | <aside class="toc" id="tocSidebar"> |
| 359 | <div class="toc-header"> |
| 360 | <h3>Documentation</h3> |
| 361 | <div class="toc-search"> |
| 362 | <input type="text" id="tocFilter" placeholder="Filter topics..." oninput="filterToc(this.value)"> |
| 363 | </div> |
| 364 | </div> |
| 365 | <nav class="toc-nav" id="tocNav"> |
| 366 | |
| 367 | <div class="toc-section"> |
| 368 | <div class="toc-section-title open" onclick="toggleSection(this)"> |
| 369 | <span>Getting Started</span> |
| 370 | <span class="arrow">▶</span> |
| 371 | </div> |
| 372 | <div class="toc-items open"> |
| 373 | <a href="#install" class="toc-item">Installation</a> |
| 374 | <a href="#quickstart" class="toc-item">Quick start</a> |
| 375 | <a href="#cli-overview" class="toc-item">CLI overview</a> |
| 376 | </div> |
| 377 | </div> |
| 378 | |
| 379 | <div class="toc-section"> |
| 380 | <div class="toc-section-title open" onclick="toggleSection(this)"> |
| 381 | <span>CLI Reference</span> |
| 382 | <span class="arrow">▶</span> |
| 383 | </div> |
| 384 | <div class="toc-items open"> |
| 385 | <a href="#cli-chat" class="toc-item">chat</a> |
| 386 | <a href="#cli-serve" class="toc-item">serve</a> |
| 387 | <a href="#cli-bench" class="toc-item">bench</a> |
| 388 | <a href="#cli-convert" class="toc-item">convert</a> |
| 389 | <a href="#cli-quantize" class="toc-item">quantize</a> |
| 390 | <a href="#cli-autotune" class="toc-item">autotune</a> |
| 391 | <a href="#cli-info" class="toc-item">info</a> |
| 392 | </div> |
| 393 | </div> |
| 394 | |
| 395 | <div class="toc-section"> |
| 396 | <div class="toc-section-title open" onclick="toggleSection(this)"> |
| 397 | <span>Docker Guide</span> |
| 398 | <span class="arrow">▶</span> |
| 399 | </div> |
| 400 | <div class="toc-items open"> |
| 401 | <a href="#docker-quickstart" class="toc-item">Quick start</a> |
| 402 | <a href="#docker-profiles" class="toc-item">Profiles</a> |
| 403 | <a href="#docker-env" class="toc-item">Environment variables</a> |
| 404 | <a href="#docker-models" class="toc-item">Model download</a> |
| 405 | <a href="#docker-autotune" class="toc-item">Auto-tune</a> |
| 406 | </div> |
| 407 | </div> |
| 408 | |
| 409 | <div class="toc-section"> |
| 410 | <div class="toc-section-title open" onclick="toggleSection(this)"> |
| 411 | <span>Model Support</span> |
| 412 | <span class="arrow">▶</span> |
| 413 | </div> |
| 414 | <div class="toc-items open"> |
| 415 | <a href="#arch-support" class="toc-item">Architecture table</a> |
| 416 | <a href="#quant-types" class="toc-item">Quantization types</a> |
| 417 | <a href="#model-tips" class="toc-item">Model tips</a> |
| 418 | </div> |
| 419 | </div> |
| 420 | |
| 421 | <div class="toc-section"> |
| 422 | <div class="toc-section-title open" onclick="toggleSection(this)"> |
| 423 | <span>Troubleshooting</span> |
| 424 | <span class="arrow">▶</span> |
| 425 | </div> |
| 426 | <div class="toc-items open"> |
| 427 | <a href="#ts-cli" class="toc-item">CLI issues</a> |
| 428 | <a href="#ts-docker" class="toc-item">Docker issues</a> |
| 429 | <a href="#ts-performance" class="toc-item">Performance</a> |
| 430 | <a href="#ts-models" class="toc-item">Model loading</a> |
| 431 | <a href="#ts-nan" class="toc-item">NaN values</a> |
| 432 | </div> |
| 433 | </div> |
| 434 | |
| 435 | <div class="toc-section"> |
| 436 | <div class="toc-section-title" onclick="toggleSection(this)"> |
| 437 | <span>API Reference</span> |
| 438 | <span class="arrow">▶</span> |
| 439 | </div> |
| 440 | <div class="toc-items"> |
| 441 | <a href="#api-openai" class="toc-item">OpenAI-compatible API</a> |
| 442 | <a href="#api-chat" class="toc-item">Chat completions</a> |
| 443 | <a href="#api-models" class="toc-item">Model listing</a> |
| 444 | </div> |
| 445 | </div> |
| 446 | |
| 447 | </nav> |
| 448 | </aside> |
| 449 | |
| 450 | <!-- ═══ CONTENT ═══ --> |
| 451 | <main class="content" id="main-content"> |
| 452 | |
| 453 | <h1>MojoLlama Documentation <span class="tagline">CLI reference, Docker guide, model support, and troubleshooting</span></h1> |
| 454 | <p class="last-updated">v0.5.0 — Last updated May 2026</p> |
| 455 | |
| 456 | <!-- ═══════ RECOMMENDED TOPICS ═══════ --> |
| 457 | <h2>Recommended topics</h2> |
| 458 | <div class="topics-grid"> |
| 459 | <div class="topic-card reveal"> |
| 460 | <span class="tag tag-guide">Quick start</span> |
| 461 | <h3><a href="#quickstart">Get started in 5 minutes</a></h3> |
| 462 | <p>Install MojoLlama, download a model, and run your first inference.</p> |
| 463 | </div> |
| 464 | <div class="topic-card reveal"> |
| 465 | <span class="tag tag-cli">CLI</span> |
| 466 | <h3><a href="#cli-serve">Serving models via API</a></h3> |
| 467 | <p>Start an OpenAI-compatible API server with concurrent users.</p> |
| 468 | </div> |
| 469 | <div class="topic-card reveal"> |
| 470 | <span class="tag tag-docker">Docker</span> |
| 471 | <h3><a href="#docker-quickstart">Docker deployment guide</a></h3> |
| 472 | <p>Run MojoLlama in containers with auto-tune and model download.</p> |
| 473 | </div> |
| 474 | <div class="topic-card reveal"> |
| 475 | <span class="tag tag-models">Models</span> |
| 476 | <h3><a href="#arch-support">Architecture support</a></h3> |
| 477 | <p>Supported model architectures and quantization types.</p> |
| 478 | </div> |
| 479 | <div class="topic-card reveal"> |
| 480 | <span class="tag tag-cli">CLI</span> |
| 481 | <h3><a href="#cli-bench">Benchmark models</a></h3> |
| 482 | <p>Measure tok/s throughput and compare against llama.cpp.</p> |
| 483 | </div> |
| 484 | <div class="topic-card reveal"> |
| 485 | <span class="tag tag-guide">Guide</span> |
| 486 | <h3><a href="#ts-cli">Troubleshooting</a></h3> |
| 487 | <p>Common issues and solutions for CLI and Docker.</p> |
| 488 | </div> |
| 489 | </div> |
| 490 | |
| 491 | <!-- ═══════ GETTING STARTED ═══════ --> |
| 492 | <h2 id="install">Getting Started</h2> |
| 493 | |
| 494 | <h3>Installation</h3> |
| 495 | <p>Clone the repository and install with pip in development mode:</p> |
| 496 | <pre><button class="copy-btn" onclick="copyCode(this)">Copy</button><span class="prompt">$</span> <span class="cmd">git clone https://github.com/a730/MojoLlama.git</span> |
| 497 | <span class="prompt">$</span> <span class="cmd">cd MojoLlama/src && pip install -e .</span></pre> |
| 498 | <p>Verify the installation:</p> |
| 499 | <pre><button class="copy-btn" onclick="copyCode(this)">Copy</button><span class="prompt">$</span> <span class="cmd">mojollama --version</span> |
| 500 | <span class="result">mojollama v0.5.0</span></pre> |
| 501 | |
| 502 | <h3 id="quickstart">Quick start</h3> |
| 503 | <p>Download a GGUF model and run chat inference:</p> |
| 504 | <pre><button class="copy-btn" onclick="copyCode(this)">Copy</button><span class="prompt">$</span> <span class="cmd">mojollama convert --hf meta-llama/Llama-3.2-1B --outtype q4_0</span> |
| 505 | <span class="prompt">$</span> <span class="cmd">mojollama chat -m model.gguf</span></pre> |
| 506 | <p>Or use an existing GGUF file:</p> |
| 507 | <pre><button class="copy-btn" onclick="copyCode(this)">Copy</button><span class="prompt">$</span> <span class="cmd">mojollama chat -m /path/to/model.gguf</span></pre> |
| 508 | |
| 509 | <h3 id="cli-overview">CLI overview</h3> |
| 510 | <p>The <code>mojollama</code> command provides a unified interface for all operations:</p> |
| 511 | <pre><button class="copy-btn" onclick="copyCode(this)">Copy</button><span class="prompt">$</span> <span class="cmd">mojollama</span> |
| 512 | <span class="comment"> chat Interactive chat with a model</span> |
| 513 | <span class="comment"> serve OpenAI-compatible API server</span> |
| 514 | <span class="comment"> bench Run benchmarks (tok/s, latency)</span> |
| 515 | <span class="comment"> convert HuggingFace → GGUF conversion</span> |
| 516 | <span class="comment"> quantize Quantize models (Q4_0, Q8_0, etc.)</span> |
| 517 | <span class="comment"> autotune Hardware auto-tuning sweep</span> |
| 518 | <span class="comment"> info Display model metadata</span> |
| 519 | <span class="comment"> eval Run evaluation benchmarks</span> |
| 520 | <span class="comment"> train LoRA fine-tuning</span> |
| 521 | <span class="comment"> export Export to safetensors, ONNX</span> |
| 522 | <span class="comment"> hub HuggingFace Hub operations</span></pre> |
| 523 | |
| 524 | <!-- ═══════ CLI REFERENCE ═══════ --> |
| 525 | <h2 id="cli-chat">CLI Reference</h2> |
| 526 | |
| 527 | <h3><code>mojollama chat</code></h3> |
| 528 | <p>Interactive chat session with a loaded model.</p> |
| 529 | <pre><button class="copy-btn" onclick="copyCode(this)">Copy</button><span class="prompt">$</span> <span class="cmd">mojollama chat -m model.gguf</span> |
| 530 | <span class="prompt">$</span> <span class="cmd">mojollama chat -m model.gguf --temp 0.8 --max-tokens 2048</span></pre> |
| 531 | <div class="table-wrap"> |
| 532 | <table> |
| 533 | <tr><th>Flag</th><th>Default</th><th>Description</th></tr> |
| 534 | <tr><td>-m, --model</td><td>—</td><td>Path to GGUF model file (required)</td></tr> |
| 535 | <tr><td>--temp</td><td>0.7</td><td>Sampling temperature (0–2)</td></tr> |
| 536 | <tr><td>--max-tokens</td><td>512</td><td>Maximum generation tokens</td></tr> |
| 537 | <tr><td>--top-p</td><td>0.9</td><td>Top-p nucleus sampling</td></tr> |
| 538 | <tr><td>--repeat-penalty</td><td>1.1</td><td>Repeat penalty</td></tr> |
| 539 | </table> |
| 540 | </div> |
| 541 | |
| 542 | <h3 id="cli-serve"><code>mojollama serve</code></h3> |
| 543 | <p>Start an OpenAI-compatible API server for concurrent requests.</p> |
| 544 | <pre><button class="copy-btn" onclick="copyCode(this)">Copy</button><span class="prompt">$</span> <span class="cmd">mojollama serve -m model.gguf -p 8080</span> |
| 545 | <span class="prompt">$</span> <span class="cmd">mojollama serve -m model.gguf -p 8080 --workers 4</span> |
| 546 | <span class="result">✓ Server started on http://0.0.0.0:8080</span></pre> |
| 547 | <div class="table-wrap"> |
| 548 | <table> |
| 549 | <tr><th>Flag</th><th>Default</th><th>Description</th></tr> |
| 550 | <tr><td>-p, --port</td><td>8080</td><td>Server port</td></tr> |
| 551 | <tr><td>--workers</td><td>1</td><td>Number of worker processes</td></tr> |
| 552 | <tr><td>--batch-size</td><td>1</td><td>Batch size for inference</td></tr> |
| 553 | <tr><td>--cors-allow-origin</td><td>—</td><td>CORS origin (use * for all)</td></tr> |
| 554 | </table> |
| 555 | </div> |
| 556 | |
| 557 | <h3 id="cli-bench"><code>mojollama bench</code></h3> |
| 558 | <p>Measure throughput and compare against llama.cpp.</p> |
| 559 | <pre><button class="copy-btn" onclick="copyCode(this)">Copy</button><span class="prompt">$</span> <span class="cmd">mojollama bench -m model.gguf</span> |
| 560 | <span class="prompt">$</span> <span class="cmd">mojollama bench -m model.gguf --prompt-tokens 512 --gen-tokens 128</span> |
| 561 | <span class="prompt">$</span> <span class="cmd">mojollama bench -m model.gguf --compare</span> <span class="comment"># vs llama.cpp</span></pre> |
| 562 | |
| 563 | <h3 id="cli-convert"><code>mojollama convert</code></h3> |
| 564 | <p>Convert a HuggingFace model to GGUF format.</p> |
| 565 | <pre><button class="copy-btn" onclick="copyCode(this)">Copy</button><span class="prompt">$</span> <span class="cmd">mojollama convert --hf meta-llama/Llama-3.2-1B --outtype q4_0</span> |
| 566 | <span class="prompt">$</span> <span class="cmd">mojollama convert --hf mistralai/Mistral-7B --outtype q4_k_m</span></pre> |
| 567 | |
| 568 | <h3 id="cli-quantize"><code>mojollama quantize</code></h3> |
| 569 | <p>Quantize an existing GGUF model to a different precision.</p> |
| 570 | <pre><button class="copy-btn" onclick="copyCode(this)">Copy</button><span class="prompt">$</span> <span class="cmd">mojollama quantize -m model.gguf -t q4_k_m</span> |
| 571 | <span class="prompt">$</span> <span class="cmd">mojollama quantize -m model.gguf -t q8_0 -o model-q8.gguf</span></pre> |
| 572 | |
| 573 | <h3 id="cli-autotune"><code>mojollama autotune</code></h3> |
| 574 | <p>Sweep hardware parameters to find optimal settings for your model:</p> |
| 575 | <pre><button class="copy-btn" onclick="copyCode(this)">Copy</button><span class="prompt">$</span> <span class="cmd">mojollama autotune -m model.gguf</span> |
| 576 | <span class="prompt">$</span> <span class="cmd">mojollama autotune -m model.gguf --quick</span> |
| 577 | <span class="result">✓ Optimal: threads=32, batch=512, concurrency=10</span></pre> |
| 578 | |
| 579 | <h3 id="cli-info"><code>mojollama info</code></h3> |
| 580 | <p>Display model metadata, architecture, and tensor layout without running inference.</p> |
| 581 | <pre><button class="copy-btn" onclick="copyCode(this)">Copy</button><span class="prompt">$</span> <span class="cmd">mojollama info -m model.gguf</span> |
| 582 | <span class="comment"> Architecture: llama</span> |
| 583 | <span class="comment"> Parameters: 7.24B</span> |
| 584 | <span class="comment"> Quantization: Q4_K_M</span> |
| 585 | <span class="comment"> Context length: 8192</span> |
| 586 | <span class="comment"> Tensors: 291</span></pre> |
| 587 | |
| 588 | <!-- ═══════ DOCKER ═══════ --> |
| 589 | <h2 id="docker-quickstart">Docker Guide</h2> |
| 590 | |
| 591 | <h3>Quick start</h3> |
| 592 | <p>Pull the latest image and run with a model:</p> |
| 593 | <pre><button class="copy-btn" onclick="copyCode(this)">Copy</button><span class="prompt">$</span> <span class="cmd">docker pull ghcr.io/a730/mojollama:latest</span> |
| 594 | <span class="prompt">$</span> <span class="cmd">docker run -e MODEL=/models/model.gguf -v /path/to/model.gguf:/models/model.gguf \</span> |
| 595 | <span class="cmd">ghcr.io/a730/mojollama:latest mojollama chat</span></pre> |
| 596 | |
| 597 | <h3 id="docker-profiles">Docker Compose profiles</h3> |
| 598 | <div class="table-wrap"> |
| 599 | <table> |
| 600 | <tr><th>Profile</th><th>Command</th><th>Description</th></tr> |
| 601 | <tr><td>mojollama</td><td><code>docker compose --profile mojollama up</code></td><td>API server</td></tr> |
| 602 | <tr><td>chat</td><td><code>docker compose --profile chat up</code></td><td>Interactive chat</td></tr> |
| 603 | <tr><td>bench</td><td><code>docker compose --profile bench up</code></td><td>Run benchmarks</td></tr> |
| 604 | <tr><td>quantize</td><td><code>docker compose --profile quantize up</code></td><td>Quantize models</td></tr> |
| 605 | <tr><td>autotune</td><td><code>docker compose --profile autotune up</code></td><td>Hardware auto-tune</td></tr> |
| 606 | <tr><td>llama-cpp</td><td><code>docker compose --profile llama-cpp up</code></td><td>llama.cpp fallback</td></tr> |
| 607 | </table> |
| 608 | </div> |
| 609 | |
| 610 | <h3 id="docker-env">Environment variables</h3> |
| 611 | <div class="table-wrap"> |
| 612 | <table> |
| 613 | <tr><th>Variable</th><th>Default</th><th>Description</th></tr> |
| 614 | <tr><td><code>MODEL</code></td><td><code>/models/model.gguf</code></td><td>Path to the GGUF model file</td></tr> |
| 615 | <tr><td><code>PORT</code></td><td><code>8080</code></td><td>Server port</td></tr> |
| 616 | <tr><td><code>OMP_NUM_THREADS</code></td><td><code>32</code></td><td>OpenMP threads for inference</td></tr> |
| 617 | <tr><td><code>AUTO_TUNE</code></td><td><code>true</code></td><td>Enable hardware auto-tune</td></tr> |
| 618 | <tr><td><code>HF_REPO</code></td><td>—</td><td>HuggingFace repo for model download</td></tr> |
| 619 | <tr><td><code>HF_FILE</code></td><td>—</td><td>GGUF filename in the HF repo</td></tr> |
| 620 | <tr><td><code>HF_TOKEN</code></td><td>—</td><td>HuggingFace token for gated models</td></tr> |
| 621 | </table> |
| 622 | </div> |
| 623 | |
| 624 | <h3 id="docker-models">Model auto-download</h3> |
| 625 | <p>The entrypoint script downloads models from HuggingFace on first run. Set <code>HF_REPO</code> and <code>HF_FILE</code> to auto-download:</p> |
| 626 | <pre><button class="copy-btn" onclick="copyCode(this)">Copy</button><span class="prompt">$</span> <span class="cmd">docker run -e HF_REPO=QuantFactory/Meta-Llama-3-8B-GGUF \</span> |
| 627 | <span class="cmd">-e HF_FILE=Meta-Llama-3-8B.Q4_K_M.gguf \</span> |
| 628 | <span class="cmd">-e MODEL=/models/Meta-Llama-3-8B.Q4_K_M.gguf \</span> |
| 629 | <span class="cmd">ghcr.io/a730/mojollama:latest mojollama chat</span></pre> |
| 630 | |
| 631 | <h3 id="docker-autotune">Hardware auto-tune</h3> |
| 632 | <p>Set <code>AUTO_TUNE=true</code> (default) to run a hardware sweep on first model load. Results are cached per-model hash in <code>/root/.cache/mojollama/</code> so subsequent runs use the optimal config immediately.</p> |
| 633 | |
| 634 | <!-- ═══════ MODEL SUPPORT ═══════ --> |
| 635 | <h2 id="arch-support">Model Support</h2> |
| 636 | |
| 637 | <h3>Supported architectures</h3> |
| 638 | <p>MojoLlama supports 50+ model architectures through architecture-specific forward passes.</p> |
| 639 | |
| 640 | <div class="table-wrap"> |
| 641 | <table> |
| 642 | <tr><th>Architecture</th><th>Status</th><th>Notable features</th></tr> |
| 643 | <tr><td>Llama 2/3/4, Mistral</td><td><span style="color:var(--success);font-weight:600;">Full</span></td><td>Dense, GQA, SwiGLU, RoPE</td></tr> |
| 644 | <tr><td>Qwen2, Qwen3</td><td><span style="color:var(--success);font-weight:600;">Full</span></td><td>TNT embedding, partial rotary</td></tr> |
| 645 | <tr><td>GPT-OSS</td><td><span style="color:var(--success);font-weight:600;">Full</span></td><td>MoE 32 experts, bias attention — on par with llama.cpp</td></tr> |
| 646 | <tr><td>Qwen3 MoE</td><td><span style="color:var(--success);font-weight:600;">Full</span></td><td>128 experts top-8, shared expert, SwiGLU</td></tr> |
| 647 | <tr><td>Qwen3.6-35B</td><td><span style="color:var(--success);font-weight:600;">Full</span></td><td>Hybrid SSM+Attention, MXFP4, 256 experts</td></tr> |
| 648 | <tr><td>Gemma 4</td><td><span style="color:var(--success);font-weight:600;">Full</span></td><td>Per-layer proj, GeGLU, sliding window, softcapping</td></tr> |
| 649 | <tr><td>ZAYA1-8B</td><td><span style="color:var(--success);font-weight:600;">Full</span></td><td>80 layers, ATTN/CCA/SSM + MoE+MoD</td></tr> |
| 650 | <tr><td>DeepSeek V2/V3</td><td>Supported</td><td>Multi-head Latent Attention, DeepSeekMoE</td></tr> |
| 651 | <tr><td>Mixtral, DBRX</td><td>Supported</td><td>Standard MoE with gated FFN</td></tr> |
| 652 | <tr><td>Falcon</td><td>In development</td><td>Parallel attention+FFN, fused QKV</td></tr> |
| 653 | <tr><td>Phi-3/4</td><td>In development</td><td>Fused QKV, long RoPE</td></tr> |
| 654 | </table> |
| 655 | </div> |
| 656 | |
| 657 | <h3 id="quant-types">Quantization types</h3> |
| 658 | <div class="table-wrap"> |
| 659 | <table> |
| 660 | <tr><th>Type</th><th>Bits</th><th>Description</th></tr> |
| 661 | <tr><td>Q4_0</td><td>4</td><td>4-bit, no K-quant (fast, compact)</td></tr> |
| 662 | <tr><td>Q4_K_M</td><td>4</td><td>4-bit K-quant medium (recommended)</td></tr> |
| 663 | <tr><td>Q5_K</td><td>5</td><td>5-bit K-quant</td></tr> |
| 664 | <tr><td>Q6_K</td><td>6</td><td>6-bit K-quant (near lossless)</td></tr> |
| 665 | <tr><td>Q8_0</td><td>8</td><td>8-bit (accurate)</td></tr> |
| 666 | <tr><td>MXFP4</td><td>4</td><td>4-bit MXFP4 (expert weights)</td></tr> |
| 667 | </table> |
| 668 | </div> |
| 669 | |
| 670 | <h3 id="model-tips">Model tips</h3> |
| 671 | <ul> |
| 672 | <li><strong>Small models (<10B):</strong> Use 1 thread — OpenMP overhead kills performance on small matrix multiplications (e.g., ZAYA1-8B optimal at 1 thread)</li> |
| 673 | <li><strong>Large models (>10B):</strong> Use all physical cores (e.g., 32 threads on Threadripper 3970X)</li> |
| 674 | <li><strong>MoE models:</strong> MojoLlama excels here — GPT-OSS reaches 0.94x llama.cpp throughput</li> |
| 675 | <li><strong>Check architecture:</strong> Use <code>mojollama info -m model.gguf</code> to verify a model is recognized</li> |
| 676 | </ul> |
| 677 | |
| 678 | <!-- ═══════ TROUBLESHOOTING ═══════ --> |
| 679 | <h2 id="ts-cli">Troubleshooting</h2> |
| 680 | |
| 681 | <h3>CLI issues</h3> |
| 682 | |
| 683 | <h4><code>mojollama</code> command not found</h4> |
| 684 | <p>Install the package in your active Python environment:</p> |
| 685 | <pre><button class="copy-btn" onclick="copyCode(this)">Copy</button><span class="prompt">$</span> <span class="cmd">cd MojoLlama/src && pip install -e .</span> |
| 686 | <span class="prompt">$</span> <span class="cmd">mojollama --version</span> |
| 687 | <span class="result">mojollama v0.5.0</span></pre> |
| 688 | |
| 689 | <div class="callout tip"><strong>Tip:</strong> If using a virtual environment, activate it first: <code>source .venv/bin/activate</code></div> |
| 690 | |
| 691 | <h4><code>ImportError: No module named 'mojollama'</code></h4> |
| 692 | <p>Run from the <code>src/</code> directory or reinstall with <code>pip install -e .</code></p> |
| 693 | |
| 694 | <h4>Benchmark crashes or shows 0 tok/s</h4> |
| 695 | <ul> |
| 696 | <li>Verify the model file path is correct and accessible</li> |
| 697 | <li>Check it's a valid GGUF: <code>head -c 4 model.gguf | xxd</code> should show <code>46474755</code> ("GGUF")</li> |
| 698 | <li>MXFP4 models require the MXFP4 engine path</li> |
| 699 | </ul> |
| 700 | |
| 701 | <h4>Server fails to start (address in use)</h4> |
| 702 | <pre><button class="copy-btn" onclick="copyCode(this)">Copy</button><span class="prompt">$</span> <span class="cmd">lsof -i :8080</span> |
| 703 | <span class="prompt">$</span> <span class="cmd">kill -9 <PID></span> |
| 704 | <span class="prompt">$</span> <span class="cmd">mojollama serve -m model.gguf -p 8081</span> <span class="comment"># use different port</span></pre> |
| 705 | |
| 706 | <h4>Chat UI can't connect</h4> |
| 707 | <ol> |
| 708 | <li>Ensure server is running: <code>mojollama serve -m model.gguf -p 8080</code></li> |
| 709 | <li>Open <code>studio.html</code> and enter the server URL in the connection bar</li> |
| 710 | <li>Click <strong>Connect</strong> — status should turn green</li> |
| 711 | </ol> |
| 712 | <div class="callout warning"><strong>Note:</strong> If using a browser from a different machine, use the server's IP/hostname. For cross-origin access, start the server with <code>--cors-allow-origin "*"</code>.</div> |
| 713 | |
| 714 | <h3 id="ts-docker">Docker issues</h3> |
| 715 | |
| 716 | <h4>Container exits immediately</h4> |
| 717 | <p>Check the logs:</p> |
| 718 | <pre><button class="copy-btn" onclick="copyCode(this)">Copy</button><span class="prompt">$</span> <span class="cmd">docker logs <container-name></span> |
| 719 | <span class="prompt">$</span> <span class="cmd">docker compose logs mojollama</span></pre> |
| 720 | <p>Common causes:</p> |
| 721 | <ul> |
| 722 | <li><strong>No model specified</strong> — set <code>MODEL</code> env var or mount a GGUF at <code>/models/</code></li> |
| 723 | <li><strong>Model file not found</strong> — verify the path in <code>MODEL</code></li> |
| 724 | <li><strong>Out of memory</strong> — model requires more RAM than available</li> |
| 725 | </ul> |
| 726 | |
| 727 | <h4>Model auto-download fails</h4> |
| 728 | <ul> |
| 729 | <li>Check internet: <code>docker run --rm ghcr.io/a730/mojollama:latest curl -I https://huggingface.co</code></li> |
| 730 | <li>Gated models need <code>HF_TOKEN</code> env var set</li> |
| 731 | <li>File names are case-sensitive on HuggingFace</li> |
| 732 | </ul> |
| 733 | |
| 734 | <h3 id="ts-performance">Performance issues</h3> |
| 735 | <div class="table-wrap"> |
| 736 | <table> |
| 737 | <tr><th>Problem</th><th>Fix</th></tr> |
| 738 | <tr><td>OMP_NUM_THREADS too low</td><td>Set to number of physical cores (e.g., 32 for Threadripper 3970X)</td></tr> |
| 739 | <tr><td>OMP_NUM_THREADS too high</td><td>For models <10B, 1 thread is optimal (OpenMP overhead)</td></tr> |
| 740 | <tr><td>Slow first token</td><td>First inference includes model load time. Subsequent tokens faster.</td></tr> |
| 741 | <tr><td>CPU throttling</td><td>Monitor: <code>watch -n1 "grep MHz /proc/cpuinfo"</code></td></tr> |
| 742 | <tr><td>Low throughput</td><td>Run <code>mojollama autotune --quick</code> for optimized config</td></tr> |
| 743 | </table> |
| 744 | </div> |
| 745 | |
| 746 | <h3 id="ts-models">Model loading</h3> |
| 747 | <h4>"Unknown architecture" error</h4> |
| 748 | <p>Check what architecture the model reports:</p> |
| 749 | <pre><button class="copy-btn" onclick="copyCode(this)">Copy</button><span class="prompt">$</span> <span class="cmd">mojollama info -m model.gguf | grep architecture</span></pre> |
| 750 | <p>If unsupported, MojoLlama falls back to a generic forward pass — results may be incorrect. See the <a href="#arch-support">architecture table</a> for supported list.</p> |
| 751 | |
| 752 | <h3 id="ts-nan">NaN values in output</h3> |
| 753 | <p>NaN indicates a computation error. Common causes:</p> |
| 754 | <ul> |
| 755 | <li><strong>Attention softmax</strong> — overflow/underflow. Try smaller context or non-zero attention mask</li> |
| 756 | <li><strong>RMSNorm</strong> — near-zero variance. MojoLlama clamps RMS sum to [-1000, 1000]</li> |
| 757 | <li><strong>MXFP4</strong> — scale overflow in 4-bit arithmetic</li> |
| 758 | <li><strong>Unsupported architecture</strong> — needs a specialized forward pass</li> |
| 759 | </ul> |
| 760 | |
| 761 | <!-- ═══════ API REFERENCE ═══════ --> |
| 762 | <h2 id="api-openai">API Reference</h2> |
| 763 | |
| 764 | <h3>OpenAI-compatible API</h3> |
| 765 | <p>MojoLlama serves an OpenAI-compatible API at <code>/v1/chat/completions</code>, compatible with the OpenAI Python client, LangChain, and any OpenAI SDK.</p> |
| 766 | |
| 767 | <h4 id="api-chat">Chat Completions</h4> |
| 768 | <pre><button class="copy-btn" onclick="copyCode(this)">Copy</button><span class="prompt">$</span> <span class="cmd">curl http://localhost:8080/v1/chat/completions \</span> |
| 769 | <span class="cmd">-H "Content-Type: application/json" \</span> |
| 770 | <span class="cmd">-d '{"model":"default","messages":[{"role":"user","content":"Hello!"}]}'</span> |
| 771 | <span class="result">{"id":"chat-...","choices":[{"index":0,"message":{"role":"assistant","content":"Hi there!"},"finish_reason":"stop"}],"usage":...}</span></pre> |
| 772 | |
| 773 | <h4 id="api-models">Model listing</h4> |
| 774 | <pre><button class="copy-btn" onclick="copyCode(this)">Copy</button><span class="prompt">$</span> <span class="cmd">curl http://localhost:8080/v1/models</span> |
| 775 | <span class="result">{"object":"list","data":[{"id":"default","object":"model","created":...,"owned_by":"mojollama"}]}</span></pre> |
| 776 | |
| 777 | <div class="callout note"><strong>Note:</strong> The API supports streaming (<code>stream: true</code>), temperature, top_p, max_tokens, frequency_penalty, and presence_penalty parameters.</div> |
| 778 | |
| 779 | <hr> |
| 780 | <div class="doc-footer"> |
| 781 | <span>MojoLlama v0.5.0 — Apache 2.0 License</span> |
| 782 | <a href="https://github.com/a730/MojoLlama/issues">Report an issue</a> |
| 783 | </div> |
| 784 | |
| 785 | </main> |
| 786 | </div> |
| 787 | |
| 788 | <!-- Back to top --> |
| 789 | <button class="back-to-top" id="backToTop" aria-label="Back to top"> |
| 790 | <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="18 15 12 9 6 15"/></svg> |
| 791 | </button> |
| 792 | |
| 793 | <script> |
| 794 | (function() { |
| 795 | 'use strict'; |
| 796 | |
| 797 | /* ── Theme toggle ── */ |
| 798 | function initTheme() { |
| 799 | var toggle = document.getElementById('themeToggle'); |
| 800 | var stored = localStorage.getItem('mojollama-theme'); |
| 801 | if (stored) document.documentElement.setAttribute('data-theme', stored); |
| 802 | if (toggle) { |
| 803 | toggle.addEventListener('click', function() { |
| 804 | var current = document.documentElement.getAttribute('data-theme'); |
| 805 | var next = current === 'dark' ? 'light' : 'dark'; |
| 806 | document.documentElement.setAttribute('data-theme', next); |
| 807 | localStorage.setItem('mojollama-theme', next); |
| 808 | }); |
| 809 | } |
| 810 | } |
| 811 | |
| 812 | /* ── Mobile sidebar toggle ── */ |
| 813 | function initSidebar() { |
| 814 | var btn = document.getElementById('sidebarToggle'); |
| 815 | var overlay = document.getElementById('sidebarOverlay'); |
| 816 | var sidebar = document.getElementById('tocSidebar'); |
| 817 | if (!btn || !overlay || !sidebar) return; |
| 818 | |
| 819 | btn.addEventListener('click', function() { |
| 820 | sidebar.classList.toggle('open'); |
| 821 | overlay.classList.toggle('open'); |
| 822 | overlay.style.display = sidebar.classList.contains('open') ? 'block' : 'none'; |
| 823 | }); |
| 824 | overlay.addEventListener('click', function() { |
| 825 | sidebar.classList.remove('open'); |
| 826 | overlay.classList.remove('open'); |
| 827 | setTimeout(function() { overlay.style.display = 'none'; }, 300); |
| 828 | }); |
| 829 | var links = sidebar.querySelectorAll('.toc-item'); |
| 830 | for (var i = 0; i < links.length; i++) { |
| 831 | links[i].addEventListener('click', function() { |
| 832 | if (window.innerWidth <= 768) { |
| 833 | sidebar.classList.remove('open'); |
| 834 | overlay.classList.remove('open'); |
| 835 | setTimeout(function() { overlay.style.display = 'none'; }, 300); |
| 836 | } |
| 837 | }); |
| 838 | } |
| 839 | } |
| 840 | |
| 841 | /* ── Scroll reveal ── */ |
| 842 | function initScrollReveal() { |
| 843 | var els = document.querySelectorAll('.reveal'); |
| 844 | if (!('IntersectionObserver' in window)) { |
| 845 | for (var i = 0; i < els.length; i++) els[i].classList.add('visible'); |
| 846 | return; |
| 847 | } |
| 848 | var observer = new IntersectionObserver(function(entries) { |
| 849 | for (var i = 0; i < entries.length; i++) { |
| 850 | if (entries[i].isIntersecting) { |
| 851 | entries[i].target.classList.add('visible'); |
| 852 | observer.unobserve(entries[i].target); |
| 853 | } |
| 854 | } |
| 855 | }, { threshold: 0.1, rootMargin: '0px 0px -40px 0px' }); |
| 856 | for (var i = 0; i < els.length; i++) observer.observe(els[i]); |
| 857 | } |
| 858 | |
| 859 | /* ── Back to top ── */ |
| 860 | function initBackToTop() { |
| 861 | var btn = document.getElementById('backToTop'); |
| 862 | if (!btn) return; |
| 863 | window.addEventListener('scroll', function() { |
| 864 | btn.classList.toggle('visible', window.scrollY > 400); |
| 865 | }, { passive: true }); |
| 866 | btn.addEventListener('click', function() { |
| 867 | window.scrollTo({ top: 0, behavior: 'smooth' }); |
| 868 | }); |
| 869 | } |
| 870 | |
| 871 | /* ── Copy code buttons ── */ |
| 872 | window.copyCode = function(btn) { |
| 873 | var pre = btn.parentElement; |
| 874 | var text = pre.textContent || pre.innerText; |
| 875 | text = text.replace(/^Copy$/m, '').trim(); |
| 876 | if (navigator.clipboard) { |
| 877 | navigator.clipboard.writeText(text).then(function() { |
| 878 | btn.textContent = 'Copied!'; |
| 879 | btn.classList.add('copied'); |
| 880 | setTimeout(function() { btn.textContent = 'Copy'; btn.classList.remove('copied'); }, 2000); |
| 881 | }); |
| 882 | } else { |
| 883 | var ta = document.createElement('textarea'); |
| 884 | ta.value = text; |
| 885 | document.body.appendChild(ta); |
| 886 | ta.select(); |
| 887 | document.execCommand('copy'); |
| 888 | document.body.removeChild(ta); |
| 889 | btn.textContent = 'Copied!'; |
| 890 | btn.classList.add('copied'); |
| 891 | setTimeout(function() { btn.textContent = 'Copy'; btn.classList.remove('copied'); }, 2000); |
| 892 | } |
| 893 | }; |
| 894 | |
| 895 | /* ── Sidebar TOC toggle (existing) ── */ |
| 896 | window.toggleSection = function(el) { |
| 897 | el.classList.toggle('open'); |
| 898 | var items = el.nextElementSibling; |
| 899 | if (items) items.classList.toggle('open'); |
| 900 | }; |
| 901 | |
| 902 | window.filterToc = function(val) { |
| 903 | val = val.toLowerCase(); |
| 904 | document.querySelectorAll('.toc-item').forEach(function(item) { |
| 905 | item.style.display = item.textContent.toLowerCase().includes(val) ? 'block' : 'none'; |
| 906 | }); |
| 907 | document.querySelectorAll('.toc-section-title').forEach(function(title) { |
| 908 | var hasVisible = false; |
| 909 | var items = title.nextElementSibling; |
| 910 | if (items) { |
| 911 | items.querySelectorAll('.toc-item').forEach(function(item) { |
| 912 | if (item.style.display !== 'none') hasVisible = true; |
| 913 | }); |
| 914 | } |
| 915 | if (val && !hasVisible) title.style.display = 'none'; |
| 916 | else title.style.display = 'flex'; |
| 917 | }); |
| 918 | }; |
| 919 | |
| 920 | /* ── Highlight active TOC item on scroll ── */ |
| 921 | var tocItems = document.querySelectorAll('.toc-item'); |
| 922 | var sections = []; |
| 923 | tocItems.forEach(function(a) { |
| 924 | var id = a.getAttribute('href').substring(1); |
| 925 | var el = document.getElementById(id); |
| 926 | if (el) sections.push({el: el, link: a}); |
| 927 | }); |
| 928 | window.addEventListener('scroll', function() { |
| 929 | var scrollY = window.scrollY + 120; |
| 930 | var active = null; |
| 931 | sections.forEach(function(s) { |
| 932 | if (s.el.offsetTop <= scrollY) active = s; |
| 933 | }); |
| 934 | tocItems.forEach(function(a) { a.classList.remove('active'); }); |
| 935 | if (active) active.link.classList.add('active'); |
| 936 | }, { passive: true }); |
| 937 | |
| 938 | /* ── Init ── */ |
| 939 | document.addEventListener('DOMContentLoaded', function() { |
| 940 | initTheme(); |
| 941 | initSidebar(); |
| 942 | initScrollReveal(); |
| 943 | initBackToTop(); |
| 944 | }); |
| 945 | })(); |
| 946 | </script> |
| 947 | </body> |
| 948 | </html> |