llama2.go.wasm is a web application that combines Go and JavaScript using WebAssembly (WASM). It enables you to perform prompt inference locally in your browser, inspired by the llama2.c and llama2.c-web project.
- Perform prompt inference using Go and JavaScript with WebAssembly.
- Interactive web interface for input and output display.
To run the project locally, follow these steps:
- Clone the repository:
git clone https://github.com/MrHuxu/llama2.go.wasm.git
- Navigate to the project directory:
cd llama2.go.wasm
- Download checkpoint file
https://huggingface.co/karpathy/tinyllamas/resolve/main/stories15M.bin
intomodels
directory - Build the WebAssembly binary:
make build
- Start the development server:
make dev
- Open your web browser and visit:
http://localhost:1234
- Open the web application in your browser.
- Enter the prompt in the provided input field.
- Click the "Submit" button to perform prompt inference.
- The output will be displayed on the web page.
index.html
: Main entrance of the application.main.go
: Go source code for the WebAssembly application.main.js
: JavaScript code for interacting with the UI.worker.js
: JavaScript code for interacting with the WebAssembly module.style.css
: Stylesheet for defining the visual appearance of the application.static/
: Static assets such as WASM runtime and logo image.
- llama2.c: Inference Llama 2 in one file of pure C.
- llama2.c-web: Simple repo that compiles and runs llama2.c on the Web.
- llama2.go: LLaMA-2 in native Go.
This project is licensed under the MIT License.