Instructions to use hmd377/genome-assembly-general-purpose-ft-bitnet-2b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use hmd377/genome-assembly-general-purpose-ft-bitnet-2b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="hmd377/genome-assembly-general-purpose-ft-bitnet-2b", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("hmd377/genome-assembly-general-purpose-ft-bitnet-2b", trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained("hmd377/genome-assembly-general-purpose-ft-bitnet-2b", trust_remote_code=True, 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=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use hmd377/genome-assembly-general-purpose-ft-bitnet-2b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "hmd377/genome-assembly-general-purpose-ft-bitnet-2b" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "hmd377/genome-assembly-general-purpose-ft-bitnet-2b", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/hmd377/genome-assembly-general-purpose-ft-bitnet-2b
- SGLang
How to use hmd377/genome-assembly-general-purpose-ft-bitnet-2b 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 "hmd377/genome-assembly-general-purpose-ft-bitnet-2b" \ --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": "hmd377/genome-assembly-general-purpose-ft-bitnet-2b", "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 "hmd377/genome-assembly-general-purpose-ft-bitnet-2b" \ --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": "hmd377/genome-assembly-general-purpose-ft-bitnet-2b", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use hmd377/genome-assembly-general-purpose-ft-bitnet-2b with Docker Model Runner:
docker model run hf.co/hmd377/genome-assembly-general-purpose-ft-bitnet-2b
Configuration Parsing Warning:In config.json: "quantization_config.modules_to_not_convert" must be an array
GAQA v1 β Fine-Tuned BitNet b1.58 2B for Genome Assembly Quality Assessment
This is a fine-tuned version of
microsoft/bitnet-b1.58-2B-4T-bf16
for genome assembly quality assessment (GAQA): automated diagnosis of assembly
problems (low coverage, contamination, misassembly), remediation advice, and
assembler/tool selection. It is the model from the paper:
GAQA v1: Fine-Tuning Ternary BitNet b1.58 for Genome Assembly Quality Assessment β A 2B Model Outperforming General-Purpose 7B LLMs on External Heldout Data (Hmade & Guelzim).
Fine-tuning uses LoRA (rank r=32, scaling Ξ±=64, dropout 0.05) over the frozen ternary
base weights. The adapter adds ~43M trainable parameters (about 372M trainable in total,
including the token embeddings β 15.15% of the model). For deployment the ternary base is
packed into ~1.58 bits/weight, so the full model β packed ternary base + LoRA adapter β
runs in ~1.22 GB of VRAM and outperforms general-purpose 7B instruct models on
organism-heldout assembly QC.
Results (from the paper)
| Model | Organism-heldout | Domain-knowledge |
|---|---|---|
| BitNet-2B zero-shot | 34.2% | 68.5% |
| BitNet-2B v1 (this model) | 69.3% | 84.0% |
| Mistral-7B-Instruct-v0.3 | 39.5% | 84.5% |
| Qwen2.5-7B-Instruct | 54.4% | 94.5% |
Per-family heldout: tool selection 100%, qc_diagnosis AUC 0.959, remediation 39.5%. Peak VRAM β 1.22 GB.
Training
- Base model:
microsoft/bitnet-b1.58-2B-4T-bf16(ternary weights in {β1, 0, +1}, ~1.58 bits/weight). - Method: LoRA over all attention (q/k/v/o) and MLP (gate/up/down) projections β 210 layers total.
- Loss: completion-only (answer tokens only), straight-through estimator (STE).
- Schedule: 3 epochs (~4,143 steps), sequence length 1,024, AdamW 8-bit, bfloat16.
- Hardware: a single A100 80 GB GPU, ~35 minutes.
- Dataset: GAQA v1 β 11,043 training examples (4,740 qc_diagnosis + 4,740 remediation + 159 tool_selection + 1,404 knowledge).
Usage
This repository contains the packed ternary base weights (packed_weights.pt) and the
LoRA adapter (lora_weights.pt), plus a self-contained loader. Load the full model with:
from load_model import load_gaqa_v1_model
model, tokenizer = load_gaqa_v1_model()
# model is the packed ternary BitNet + GAQA v1 LoRA adapter, ready for inference
For the paper's logit-based forced-choice MCQ scoring (used to reproduce the results above), see the reproduction code at Zenodo 10.5281/zenodo.22760609.
Files
packed_weights.ptβ packed ternary base weights (~1.58 bits/weight).lora_weights.ptβ final LoRA adapter (used in the paper's evaluations).lora_weights_best.ptβ best-validation LoRA checkpoint (alternative).load_model.pyβ self-contained loader (BitLinear packing + LoRA application).adapter_config.jsonβ LoRA hyperparameters (r=32, Ξ±=64, dropout=0.05) and base model reference.config.json,tokenizer.json,tokenizer_config.json,chat_template.jinjaβ base model configuration and tokenizer, for reference.
Limitations
Trained on short-read (Illumina) bacterial assemblies produced by SPAdes and MEGAHIT; see the paper for coverage of long-read/hybrid assemblers and other limitations.
License
MIT (inherited from the base model). Dataset: CC BY 4.0.
Citation
Please cite the paper (add the published DOI here) and the dataset:
@article{hmade_gaqa_v1,
title = {GAQA v1: Fine-Tuning Ternary BitNet b1.58 for Genome Assembly Quality Assessment},
author = {Hmade, Abdellah and Guelzim, Ibrahim},
note = {dataset: https://doi.org/10.5281/zenodo.21762025}
}
- Downloads last month
- 292
Model tree for hmd377/genome-assembly-general-purpose-ft-bitnet-2b
Base model
microsoft/bitnet-b1.58-2B-4T-bf16