Text Generation
Transformers
Safetensors
GGUF
English
qwen2
awk
code-generation
text-to-code
qwen
local
execution-verified
conversational
text-generation-inference
Instructions to use asterbraid/awkweave-1.5b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use asterbraid/awkweave-1.5b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="asterbraid/awkweave-1.5b") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("asterbraid/awkweave-1.5b") model = AutoModelForCausalLM.from_pretrained("asterbraid/awkweave-1.5b", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use asterbraid/awkweave-1.5b with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf asterbraid/awkweave-1.5b:Q4_K_M # Run inference directly in the terminal: llama cli -hf asterbraid/awkweave-1.5b:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf asterbraid/awkweave-1.5b:Q4_K_M # Run inference directly in the terminal: llama cli -hf asterbraid/awkweave-1.5b:Q4_K_M
Build from source code
git clone https://github.com/ggml-org/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-app # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama serve -hf asterbraid/awkweave-1.5b:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama cli -hf asterbraid/awkweave-1.5b:Q4_K_M
Use Docker
docker model run hf.co/asterbraid/awkweave-1.5b:Q4_K_M
- Llama new
- LM Studio
- Jan
- vLLM
How to use asterbraid/awkweave-1.5b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "asterbraid/awkweave-1.5b" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "asterbraid/awkweave-1.5b", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/asterbraid/awkweave-1.5b:Q4_K_M
- SGLang
How to use asterbraid/awkweave-1.5b with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "asterbraid/awkweave-1.5b" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "asterbraid/awkweave-1.5b", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "asterbraid/awkweave-1.5b" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "asterbraid/awkweave-1.5b", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use asterbraid/awkweave-1.5b with Ollama:
ollama run hf.co/asterbraid/awkweave-1.5b:Q4_K_M
- Unsloth Desktop
- Pi
How to use asterbraid/awkweave-1.5b with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf asterbraid/awkweave-1.5b:Q4_K_M
Configure the model in Pi
# Install Pi: npm install -g @earendil-works/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:9931/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "asterbraid/awkweave-1.5b:Q4_K_M" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Docker Model Runner
How to use asterbraid/awkweave-1.5b with Docker Model Runner:
docker model run hf.co/asterbraid/awkweave-1.5b:Q4_K_M
- Lemonade
How to use asterbraid/awkweave-1.5b with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull asterbraid/awkweave-1.5b:Q4_K_M
Run and chat with the model
lemonade run user.awkweave-1.5b-Q4_K_M
List all available models
lemonade list
- Hermes Agent
How to use asterbraid/awkweave-1.5b with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf asterbraid/awkweave-1.5b:Q4_K_M
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:9931/v1 hermes config set model.default asterbraid/awkweave-1.5b:Q4_K_M
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use asterbraid/awkweave-1.5b with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf asterbraid/awkweave-1.5b:Q4_K_M
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:9931/v1 \ --custom-model-id "asterbraid/awkweave-1.5b:Q4_K_M" \ --custom-provider-id llama-cpp \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
|
Download README.md from asterbraid/awkweave-1.5b: direct link, hf CLI and curl.
- Browser
- Download file 7.05 kB
-
https://huggingface.co/asterbraid/awkweave-1.5b/resolve/main/README.md
- Command line
-
hf download hf://asterbraid/awkweave-1.5b/README.md
-
curl -L -o README.md https://huggingface.co/asterbraid/awkweave-1.5b/resolve/main/README.md
7.05 kB
| license: apache-2.0 | |
| language: en | |
| library_name: transformers | |
| pipeline_tag: text-generation | |
| base_model: Qwen/Qwen2.5-Coder-1.5B-Instruct | |
| datasets: | |
| - asterbraid/awkweave-data | |
| - asterbraid/awkweave-realistic-data | |
| tags: | |
| - awk | |
| - code-generation | |
| - text-to-code | |
| - qwen | |
| - local | |
| - execution-verified | |
| # Awkweave 1.5B | |
| Awkweave translates an English text-processing request plus representative input into an `awk` program. It is a LoRA fine-tune of **Qwen2.5-Coder-1.5B-Instruct**, merged into ordinary Transformers weights for local, offline inference. No API key is needed for inference. | |
| - Companion data: [asterbraid/awkweave-data](https://huggingface.co/datasets/asterbraid/awkweave-data) and [realistic expansion](https://huggingface.co/datasets/asterbraid/awkweave-realistic-data) | |
| - Interactive demo: [asterbraid/awkweave-demo](https://huggingface.co/spaces/asterbraid/awkweave-demo) | |
| - Output contract: one `awk` program only, without the `awk` executable, filename, Markdown, or explanation. | |
| ## Results | |
| All scores are greedy, one generation per row. **Valid** means `awk` executes the prediction on the primary input. **Correct** requires exact output equality on both the primary and second input. Only trailing special tokens are stripped; Markdown is never repaired. | |
| | Model | Test valid | Test correct | Dev valid | Dev correct | Frozen valid | Frozen correct | | |
| | --- | ---: | ---: | ---: | ---: | ---: | ---: | | |
| | Qwen2.5-Coder base | 0.0% (0/3000) | 0.0% (0/3000) | 0.0% (0/33) | 0.0% (0/33) | 0.0% (0/37) | 0.0% (0/37) | | |
| | Awkweave stage 1 | 100.0% (3000/3000) | 100.0% (3000/3000) | 78.8% (26/33) | 15.2% (5/33) | 83.8% (31/37) | 18.9% (7/37) | | |
| | **Awkweave final** | **100.0% (3000/3000)** | **100.0% (3000/3000)** | **97.0% (32/33)** | **78.8% (26/33)** | **94.6% (35/37)** | **29.7% (11/37)** | | |
| The base model fenced every prediction in Markdown and usually emitted a shell command, so it was invalid under the strict bare-program contract. | |
| Test contains 3000 grammar-generated rows from the original 39 families and measures in-distribution behavior only; input texts are disjoint, but request/program pairs can recur. Dev contains 33 authored tasks used to guide the realistic expansion, so it is development data, not an untouched test. Frozen contains 37 separately authored network-flow, inventory, syslog, group, sensor, and formatting tasks. It was excluded from all training and tuning. Full predictions and summaries are included under `evaluation/`. | |
| ## Verified generation | |
| Request: `For each record, print column 1 and the running sum of column 2, separated by a space.` | |
| ```text | |
| gus 24 indigo | |
| jules 18 delta | |
| farah 18 grove | |
| alice 22 delta | |
| farah 29 grove | |
| dina 10 amber | |
| jules 4 fable | |
| farah 2 fable | |
| ``` | |
| Generated program: | |
| ```awk | |
| {s+=$2;print $1,s} | |
| ``` | |
| Executed output: | |
| ```text | |
| gus 24 | |
| jules 42 | |
| farah 60 | |
| alice 82 | |
| farah 111 | |
| dina 121 | |
| jules 125 | |
| farah 127 | |
| ``` | |
| ## Use with Transformers | |
| ```python | |
| from awkweave.model import generate_program | |
| program = generate_program( | |
| "Print each name and the running total of column 2.", | |
| "alice 10\nbruno 15\nchen 7\n", | |
| "asterbraid/awkweave-1.5b", | |
| ) | |
| print(program) | |
| ``` | |
| Or use the lower-level API: | |
| ```python | |
| from transformers import AutoModelForCausalLM, AutoTokenizer | |
| from awkweave.prompts import messages | |
| model_id = "asterbraid/awkweave-1.5b" | |
| tokenizer = AutoTokenizer.from_pretrained(model_id) | |
| model = AutoModelForCausalLM.from_pretrained(model_id) | |
| prompt = tokenizer.apply_chat_template( | |
| messages("Print the last field of every line.", "a 1\nb 2\n"), | |
| tokenize=False, | |
| add_generation_prompt=True, | |
| ) | |
| inputs = tokenizer(prompt, return_tensors="pt", add_special_tokens=False) | |
| output = model.generate(**inputs, do_sample=False, max_new_tokens=192) | |
| print(tokenizer.decode(output[0, inputs["input_ids"].shape[1]:], skip_special_tokens=True)) | |
| ``` | |
| ## CLI | |
| Clone this repository, install the package, and pipe representative input to the CLI. Python 3.10+ and an `awk` executable are required: | |
| ```bash | |
| git clone https://huggingface.co/asterbraid/awkweave-1.5b | |
| cd awkweave-1.5b | |
| pip install -e '.[model]' | |
| printf 'alice 10\nbruno 15\n' | awkweave 'Print the running sum of column 2' | |
| ``` | |
| Add `--run` to print the generated program to stderr and execute it with the included safety guard. The guard permits stdin/stdout processing only and rejects file, environment, subprocess, pipe, and redirection operations. | |
| ## GGUF | |
| Quantized builds are included for llama.cpp-compatible runtimes: | |
| - `awkweave-1.5b.Q4_K_M.gguf` | |
| - `awkweave-1.5b.Q8_0.gguf` | |
| ```bash | |
| llama-server -m awkweave-1.5b.Q8_0.gguf --host 127.0.0.1 --port 8080 | |
| ``` | |
| For Ollama, run `ollama create awkweave -f Modelfile` from this repository, then see `OLLAMA.md` for the exact prompt format and an executable example. | |
| The Q4_K_M build was also loaded in `llama-completion` and passed a real generation smoke check. | |
| ## Training | |
| - Base: `Qwen/Qwen2.5-Coder-1.5B-Instruct` (Apache-2.0). | |
| - Data: 60000 rows in the final training stage, including original and guarded-paraphrase requests. | |
| - Stage 1: 107994 original rows for one epoch at learning rate 5e-05. | |
| - Stage 2: 40,000 realistic rows plus 20,000 replay rows, continued from the stage-one merged model at learning rate 2e-05. | |
| - Method: LoRA rank 32, alpha 64, dropout 0.05, targeting attention and MLP projections; adapter merged after training. | |
| - Schedule: 1.0 epoch, cosine learning-rate decay, peak learning rate 2e-05, effective batch size 64, maximum sequence length 1024. | |
| - Precision: BF16 with gradient checkpointing; non-fused AdamW and maximum gradient norm 0.5. | |
| - `training_config.json` records the resolved settings and training metrics. | |
| Every reference program in the dataset was executed on two inputs. Paraphrases changed request wording only, never the program, inputs, or expected outputs. | |
| ## Execution and safety | |
| The model itself produces text and does not execute anything. The optional CLI and Space use `awkweave.execution.run_awk`, which supplies input on stdin and rejects file/environment access, `system()`, `getline`, pipes, and output redirection. CPU, memory, output-file, and wall-clock limits are also applied. Review generated programs before use. A syntactically valid program can still implement the wrong request. | |
| ## Limitations | |
| - English only; not a general chatbot or general shell assistant. | |
| - POSIX-style `awk` on supplied text. No multi-file joins, quoted CSV, or external pipelines. | |
| - Requests must be explicit about field positions or header names, filtering, output formatting, and ordering. | |
| - Complex compositions outside the training families can fail. The small challenge split does not establish broad reliability. | |
| - The execution guard is a safety layer, not a proof of sandboxing against every possible `awk` implementation exploit. Use a container for untrusted production workloads. | |
| ## License and attribution | |
| Code and merged weights are Apache-2.0, matching the base model. See `LICENSE` and `NOTICE`. Training data is CC-BY-4.0; attribute Asterbraid when redistributing it. | |