Text Generation
Transformers
English
gpt2
ibce
low-rank
efficient-inference
cuda
custom_code
Eval Results (legacy)
Instructions to use jackal79/gpt2-ibce-lowrank-192 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use jackal79/gpt2-ibce-lowrank-192 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="jackal79/gpt2-ibce-lowrank-192", trust_remote_code=True)# Load model directly from transformers import AutoTokenizer, IBCEGPT2LowRank tokenizer = AutoTokenizer.from_pretrained("jackal79/gpt2-ibce-lowrank-192", trust_remote_code=True) model = IBCEGPT2LowRank.from_pretrained("jackal79/gpt2-ibce-lowrank-192", trust_remote_code=True) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use jackal79/gpt2-ibce-lowrank-192 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "jackal79/gpt2-ibce-lowrank-192" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "jackal79/gpt2-ibce-lowrank-192", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/jackal79/gpt2-ibce-lowrank-192
- SGLang
How to use jackal79/gpt2-ibce-lowrank-192 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 "jackal79/gpt2-ibce-lowrank-192" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "jackal79/gpt2-ibce-lowrank-192", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "jackal79/gpt2-ibce-lowrank-192" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "jackal79/gpt2-ibce-lowrank-192", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use jackal79/gpt2-ibce-lowrank-192 with Docker Model Runner:
docker model run hf.co/jackal79/gpt2-ibce-lowrank-192
GPT-2 + IBCE Low-Rank (trust_remote_code)
What it is. A runtime wrapper that keeps GPT-2’s fused attention kernels and swaps only QKV/PROJ linears to low-rank factors.
No weights are stored here: on load it fetches openai-community/gpt2 and patches it at runtime. Because this uses trust_remote_code, HF Inference API/Serverless is not supported; run in your own environment or notebook.
Headline results (A100, FP16, greedy): ~1.8–2.0x tokens/sec at ~0.8% perplexity delta on WikiText-2 (raw).
Quick start (pin a safe revision)
from transformers import AutoTokenizer, AutoModelForCausalLM
import torch as th
repo = "jackal79/gpt2-ibce-lowrank-192"
rev = "a71015d1333757bedaaa2437333cd44415076218" # pinned revision
tok = AutoTokenizer.from_pretrained(repo, trust_remote_code=True, revision=rev)
mdl = AutoModelForCausalLM.from_pretrained(
repo, trust_remote_code=True, revision=rev, dtype=th.float16
).cuda().eval()
x = tok("Hello from IBCE low-rank!", return_tensors="pt").to("cuda")
y = mdl.generate(**x, max_new_tokens=64, do_sample=False)
print(tok.decode(y[0], skip_special_tokens=True))
## Licensing
This repository is released under an **Evaluation License** for non-production, non-hosted use.
Commercial production or hosted use requires a separate license.
Contact **jack@thestardrive.com**.
The full license text is in [`LICENSE.txt`](https://huggingface.co/jackal79/gpt2-ibce-lowrank-192/blob/main/LICENSE.txt).
- Downloads last month
- 2
Model tree for jackal79/gpt2-ibce-lowrank-192
Base model
openai-community/gpt2Evaluation results
- Perplexity (GPT-2 baseline) on WikiText-2 (raw)self-reported51.641
- Perplexity (IBCE) on WikiText-2 (raw)self-reported52.068
- Tokens per second (baseline, A100 FP16, 512 tok) on WikiText-2 (raw)self-reported102.000
- Tokens per second (IBCE, A100 FP16, 512 tok) on WikiText-2 (raw)self-reported190.000