Text Generation
Transformers
Safetensors
English
llama
argument-mining
topic-extraction
claim-extraction
computational-social-science
4-bit precision
bitsandbytes
wiba
conversational
Instructions to use armaniii/WIBA-Extract-V1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use armaniii/WIBA-Extract-V1 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="armaniii/WIBA-Extract-V1") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("armaniii/WIBA-Extract-V1") model = AutoModelForCausalLM.from_pretrained("armaniii/WIBA-Extract-V1") 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 armaniii/WIBA-Extract-V1 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "armaniii/WIBA-Extract-V1" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "armaniii/WIBA-Extract-V1", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/armaniii/WIBA-Extract-V1
- SGLang
How to use armaniii/WIBA-Extract-V1 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 "armaniii/WIBA-Extract-V1" \ --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": "armaniii/WIBA-Extract-V1", "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 "armaniii/WIBA-Extract-V1" \ --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": "armaniii/WIBA-Extract-V1", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use armaniii/WIBA-Extract-V1 with Docker Model Runner:
docker model run hf.co/armaniii/WIBA-Extract-V1
Model card v3: step-by-step gated-access walkthrough, separate GPU/CPU quickstarts with hardware requirements, batch processing with tqdm progress bar
Browse files
README.md
CHANGED
|
@@ -49,7 +49,20 @@ Practical consequences:
|
|
| 49 |
- Do **not** try to remove/override `quantization_config` to get fp16: the stored weights themselves are 4-bit packed, so there is no full-precision copy in this repo. To obtain higher-precision weights, load 4-bit first and call `model.dequantize()` (see below).
|
| 50 |
- VRAM needed is only **~6 GB** — the model fits on small GPUs.
|
| 51 |
|
| 52 |
-
##
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
|
| 54 |
```bash
|
| 55 |
pip install torch transformers accelerate bitsandbytes
|
|
@@ -66,11 +79,22 @@ tokenizer.pad_token_id = tokenizer.eos_token_id
|
|
| 66 |
tokenizer.padding_side = "left"
|
| 67 |
|
| 68 |
# quantization_config ships in config.json — transformers loads the 4-bit
|
| 69 |
-
# weights automatically (
|
| 70 |
model = AutoModelForCausalLM.from_pretrained(REPO, device_map="auto", low_cpu_mem_usage=True)
|
| 71 |
model.eval()
|
| 72 |
```
|
| 73 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 74 |
### Prompt format (must match training)
|
| 75 |
|
| 76 |
The model expects the Llama-3 chat header format with the WIBA topic-extraction system prompt, and the generation cut off after a few tokens (topics are short):
|
|
@@ -123,9 +147,20 @@ The original implementation uses the equivalent `pipeline("text-generation", ...
|
|
| 123 |
- An argumentative input → a short topic phrase (e.g. `Climate change`, `Gun control`)
|
| 124 |
- A non-argument input → the literal string `No Topic`
|
| 125 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 126 |
## Getting full-precision weights
|
| 127 |
|
| 128 |
-
The repo stores no fp16 copy, but you can dequantize after loading (needs enough memory for the fp16 model, ~16 GB):
|
| 129 |
|
| 130 |
```python
|
| 131 |
model = AutoModelForCausalLM.from_pretrained(REPO, device_map="auto")
|
|
|
|
| 49 |
- Do **not** try to remove/override `quantization_config` to get fp16: the stored weights themselves are 4-bit packed, so there is no full-precision copy in this repo. To obtain higher-precision weights, load 4-bit first and call `model.dequantize()` (see below).
|
| 50 |
- VRAM needed is only **~6 GB** — the model fits on small GPUs.
|
| 51 |
|
| 52 |
+
## Before you start
|
| 53 |
+
|
| 54 |
+
**No gated access needed** — unlike the detect and stance stages, this repo is fully self-contained (no Meta base model to download), so there is no license gate, no account, and no token required. The first run downloads ~6 GB with progress bars, cached afterward in `~/.cache/huggingface`.
|
| 55 |
+
|
| 56 |
+
## Hardware requirements — pick your setup
|
| 57 |
+
|
| 58 |
+
| Setup | What you need | Speed |
|
| 59 |
+
|---|---|---|
|
| 60 |
+
| **GPU (recommended)** | NVIDIA GPU with ≥8 GB free VRAM, `pip install bitsandbytes` | fast — this is the wiba.dev production configuration |
|
| 61 |
+
| **CPU only** | ~25 GB free RAM, no GPU; loads 4-bit then dequantizes (see below) | ~1–2 min per text on 16 cores |
|
| 62 |
+
|
| 63 |
+
⚠️ Do **not** run `generate()` directly on the 4-bit model on a CPU: bitsandbytes' CPU 4-bit kernels are single-threaded and a single sentence takes over an hour (measured). Use the dequantize recipe below instead.
|
| 64 |
+
|
| 65 |
+
## Quickstart — GPU
|
| 66 |
|
| 67 |
```bash
|
| 68 |
pip install torch transformers accelerate bitsandbytes
|
|
|
|
| 79 |
tokenizer.padding_side = "left"
|
| 80 |
|
| 81 |
# quantization_config ships in config.json — transformers loads the 4-bit
|
| 82 |
+
# weights automatically (~6 GB VRAM)
|
| 83 |
model = AutoModelForCausalLM.from_pretrained(REPO, device_map="auto", low_cpu_mem_usage=True)
|
| 84 |
model.eval()
|
| 85 |
```
|
| 86 |
|
| 87 |
+
## Quickstart — CPU (no GPU)
|
| 88 |
+
|
| 89 |
+
`bitsandbytes` is still required (the checkpoint is stored 4-bit), but after loading, dequantize to bfloat16 so generation runs on all CPU cores (verified: ~25 GB RAM peak, then ~1–2 min per text on 16 cores):
|
| 90 |
+
|
| 91 |
+
```python
|
| 92 |
+
model = AutoModelForCausalLM.from_pretrained(REPO, device_map="cpu", low_cpu_mem_usage=True)
|
| 93 |
+
model = model.dequantize().to(torch.bfloat16)
|
| 94 |
+
model.eval()
|
| 95 |
+
torch.set_num_threads(16) # match your core count
|
| 96 |
+
```
|
| 97 |
+
|
| 98 |
### Prompt format (must match training)
|
| 99 |
|
| 100 |
The model expects the Llama-3 chat header format with the WIBA topic-extraction system prompt, and the generation cut off after a few tokens (topics are short):
|
|
|
|
| 147 |
- An argumentative input → a short topic phrase (e.g. `Climate change`, `Gun control`)
|
| 148 |
- A non-argument input → the literal string `No Topic`
|
| 149 |
|
| 150 |
+
## Batch processing many texts (with a progress bar)
|
| 151 |
+
|
| 152 |
+
Model downloads show progress bars automatically; generation doesn't, so wrap your loop in `tqdm` (installed with transformers) exactly as the original WIBA serving code does:
|
| 153 |
+
|
| 154 |
+
```python
|
| 155 |
+
from tqdm import tqdm
|
| 156 |
+
|
| 157 |
+
texts = ["...", "..."] # your data
|
| 158 |
+
topics = [extract_topic(t) for t in tqdm(texts)]
|
| 159 |
+
```
|
| 160 |
+
|
| 161 |
## Getting full-precision weights
|
| 162 |
|
| 163 |
+
The repo stores no fp16 copy, but you can dequantize after loading (needs enough memory for the fp16 model, ~16 GB — this is the same call the CPU quickstart uses):
|
| 164 |
|
| 165 |
```python
|
| 166 |
model = AutoModelForCausalLM.from_pretrained(REPO, device_map="auto")
|