Spaces:
Running
Running
Download index.html from WeReCooking/MiniGPT4-WebGPU: direct link, hf CLI and curl.
- Browser
- Download file 3.88 kB
-
https://huggingface.co/spaces/WeReCooking/MiniGPT4-WebGPU/resolve/main/index.html
- Command line
-
hf download hf://spaces/WeReCooking/MiniGPT4-WebGPU/index.html
-
curl -L -o index.html https://huggingface.co/spaces/WeReCooking/MiniGPT4-WebGPU/resolve/main/index.html
3.88 kB
| <html lang="en"> | |
| <head> | |
| <meta charset="utf-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1"> | |
| <title>MiniGPT-4 WebGPU</title> | |
| <meta name="description" content="The original 2023 MiniGPT-4 (EVA ViT-G, Q-Former, Vicuna-7B v0) running on your own GPU in the browser. Nothing is uploaded."> | |
| <link rel="icon" href="data:,"> | |
| <link rel="stylesheet" href="style.css"> | |
| </head> | |
| <body> | |
| <main> | |
| <p id="line"><b><a href="https://github.com/Vision-CAIR/MiniGPT-4" target="_blank" rel="noopener">MiniGPT-4</a></b>, the original April 2023 model, running on <b>your GPU</b>: | |
| a vision encoder and a 4-bit Vicuna-7B, nothing uploaded. First use downloads about 5 GB, kept in your browser.</p> | |
| <label id="drop" for="file"><input id="file" type="file" accept="image/*"><span>Drop an image here, or choose one</span></label> | |
| <p id="examples-row">Or try: <span id="examples"></span></p> | |
| <img id="preview" alt="" hidden> | |
| <p id="status" role="status" aria-live="polite">Pick an image to begin.</p> | |
| <div id="bar"><i></i></div> | |
| <form id="ask" autocomplete="off"> | |
| <label for="q" class="sr">Question about the image</label> | |
| <input id="q" type="text" maxlength="400" value="Describe this image in detail." disabled> | |
| <button id="go" type="submit" disabled>Ask</button> | |
| <button id="stop" type="button" hidden>Stop</button> | |
| </form> | |
| <p id="prompts"></p> | |
| <section id="log" aria-live="polite"></section> | |
| <details id="more"> | |
| <summary>How it works, limits and credits</summary> | |
| <p><b>Model.</b> The original MiniGPT-4 (Vision-CAIR, KAUST): a frozen EVA ViT-G, a frozen BLIP-2 Q-Former and one trained linear projection feed 32 image tokens to Vicuna-7B v0. The vision part runs as an 8-bit ONNX graph on | |
| <a href="https://onnxruntime.ai/" target="_blank" rel="noopener">ONNX Runtime Web</a> (1.2 GB); the language model is a 4-bit GGUF (3.8 GB) on <a href="https://github.com/ngxson/wllama" target="_blank" rel="noopener">wllama</a> (llama.cpp WebAssembly + WebGPU). | |
| Weights: <a id="repo" target="_blank" rel="noopener">the model repo</a>. Sources: <a href="https://huggingface.co/spaces/Luminia/MiniGPT-4" target="_blank" rel="noopener">Luminia/MiniGPT-4</a>, whose CPU/GPU version this mirrors, <a href="https://huggingface.co/Vision-CAIR/vicuna-7b" target="_blank" rel="noopener">Vision-CAIR/vicuna-7b</a>.</p> | |
| <p><b>How the image gets in.</b> llama.cpp (and so wllama) cannot take raw embeddings, so the 32 image vectors are written into 32 reserved rows of the model's token-embedding table (the byte tokens <0x80>…<0x9F>) before the model is loaded, and the prompt carries those 32 token ids. | |
| A new image therefore reloads the language model from your browser's cache (some seconds); more questions about the same image do not. Text containing those rare byte tokens is not supported.</p> | |
| <p><b>Limits.</b> About 6 GB of free memory and a GPU with 4 GB+ of video memory are needed; without WebGPU it runs on the CPU, at under one word a second. This is a 2023 model: captions are often wrong in details, and it is uncensored, so it describes whatever you give it. | |
| Vicuna v0 is derived from LLaMA-1 (non-commercial research licence).</p> | |
| <p><b>If answers look wrong or refuse.</b> Add <code>?vgpu=0</code> (vision on the CPU), <code>?llmgpu=0</code> (language model on the CPU) or <code>?check=1</code> (compare the GPU and CPU image embeddings) to the address to find out which part misbehaves on your GPU. The original Python version is on the <a href="https://huggingface.co/spaces/WeReCooking/MiniGPT4-WebGPU/tree/python" target="_blank" rel="noopener"><code>python</code> branch</a>.</p> | |
| <p id="store"></p> | |
| <button id="wipe" type="button">Delete downloaded models</button> | |
| </details> | |
| </main> | |
| <script type="module" src="main.js"></script> | |
| </body> | |
| </html> | |