Instructions to use oswaldoludwig/kappatune-lora-tinyllama-agnews with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use oswaldoludwig/kappatune-lora-tinyllama-agnews with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("TinyLlama/TinyLlama-1.1B-Chat-v1.0") model = PeftModel.from_pretrained(base_model, "oswaldoludwig/kappatune-lora-tinyllama-agnews") - Transformers
How to use oswaldoludwig/kappatune-lora-tinyllama-agnews with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="oswaldoludwig/kappatune-lora-tinyllama-agnews") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("oswaldoludwig/kappatune-lora-tinyllama-agnews", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use oswaldoludwig/kappatune-lora-tinyllama-agnews with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "oswaldoludwig/kappatune-lora-tinyllama-agnews" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "oswaldoludwig/kappatune-lora-tinyllama-agnews", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/oswaldoludwig/kappatune-lora-tinyllama-agnews
- SGLang
How to use oswaldoludwig/kappatune-lora-tinyllama-agnews 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 "oswaldoludwig/kappatune-lora-tinyllama-agnews" \ --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": "oswaldoludwig/kappatune-lora-tinyllama-agnews", "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 "oswaldoludwig/kappatune-lora-tinyllama-agnews" \ --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": "oswaldoludwig/kappatune-lora-tinyllama-agnews", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use oswaldoludwig/kappatune-lora-tinyllama-agnews with Docker Model Runner:
docker model run hf.co/oswaldoludwig/kappatune-lora-tinyllama-agnews
|
Download README.md from oswaldoludwig/kappatune-lora-tinyllama-agnews: direct link, hf CLI and curl.
- Browser
- Download file 3.56 kB
-
https://huggingface.co/oswaldoludwig/kappatune-lora-tinyllama-agnews/resolve/main/README.md
- Command line
-
hf download hf://oswaldoludwig/kappatune-lora-tinyllama-agnews/README.md
-
curl -L -o README.md https://huggingface.co/oswaldoludwig/kappatune-lora-tinyllama-agnews/resolve/main/README.md
3.56 kB
| library_name: peft | |
| license: apache-2.0 | |
| base_model: TinyLlama/TinyLlama-1.1B-Chat-v1.0 | |
| tags: | |
| - base_model:adapter:TinyLlama/TinyLlama-1.1B-Chat-v1.0 | |
| - lora | |
| - transformers | |
| - kappaTune | |
| pipeline_tag: text-generation | |
| model-index: | |
| - name: kappatune-lora-tinyllama-agnews | |
| results: [] | |
| datasets: | |
| - sh0416/ag_news | |
| - fancyzhx/ag_news | |
| - SetFit/ag_news | |
| language: | |
| - en | |
| metrics: | |
| - perplexity | |
| <!-- This model card has been generated automatically according to the information the Trainer had access to. You | |
| should probably proofread and complete it, then remove this comment. --> | |
| # kappatune-lora-tinyllama-agnews | |
| This model is a fine-tuned version of [TinyLlama/TinyLlama-1.1B-Chat-v1.0](https://huggingface.co/TinyLlama/TinyLlama-1.1B-Chat-v1.0) on the **AG News** dataset. It was trained to demonstrate the **KappaTune** fine-tuning methodology, which selectively adapts neural network layers based on their condition number to mitigate catastrophic forgetting. | |
| ## Model description | |
| This model is a LoRA (Low-Rank Adaptation) adapter applied to TinyLlama-1.1B. Unlike standard LoRA, which targets manually specified module types (e.g., all `q_proj` or `v_proj` layers), this adapter was trained using the **KappaTune PEFT Integration**. | |
| Before training, the KappaTune algorithm performed a Singular Value Decomposition (SVD) on all candidate weight matrices to calculate their **Condition Number (kappa)**. | |
| * **High-kappa** tensors (highly specialized, anisotropic weights containing pre-trained knowledge) were frozen. | |
| * **Low-kappa** tensors (numerically stable, general-purpose weights of higher output entropy acting as a "raw marble block") were selected for LoRA adaptation. | |
| This targeted approach ensures the model learns the new domain efficiently while preserving its foundational conversational capabilities. | |
| * **Paper:** *The Condition Number as a Scale-Invariant Proxy for Information Encoding in Neural Units* ([arXiv:2506.16289](https://arxiv.org/abs/2506.16289)) | |
| * **Repository:** [oswaldoludwig/kappaTune](https://github.com/oswaldoludwig/kappaTune) | |
| ## Intended uses & limitations | |
| * **Methodological Proof of Concept:** This model serves primarily as a demonstration of the KappaTune automated layer-selection strategy. | |
| * **Domain Adaptation:** It illustrates how a general-purpose chat model can be steered toward a specific formatting and vocabulary style (News Reporting) using a tiny fraction of trainable parameters. | |
| ## Training and evaluation data | |
| The model was fine-tuned on the **AG News** dataset, a curated collection of news articles categorized into four topics: World, Sports, Business, and Sci/Tech. | |
| ## Training procedure | |
| The model was trained using the Hugging Face `Trainer` API combined with the `kappaTune` optimizer wrapper. Although AG News is traditionally a classification benchmark, the data was formatted as a continuous text stream for this experiment. The model was trained on a **Causal Language Modeling** task (next-token prediction) to adapt its generation style to news reporting, rather than predicting a categorical label. | |
| ### Training hyperparameters | |
| The following hyperparameters were used during training: | |
| - learning_rate: 5e-05 | |
| - train_batch_size: 4 | |
| - eval_batch_size: 8 | |
| - seed: 42 | |
| - optimizer: Use adamw_torch with betas=(0.9,0.999) and epsilon=1e-08 and optimizer_args=No additional optimizer arguments | |
| - lr_scheduler_type: linear | |
| - num_epochs: 3 | |
| ### Training results | |
| ### Framework versions | |
| - PEFT 0.17.1 | |
| - Transformers 4.55.4 | |
| - Pytorch 2.6.0+cu124 | |
| - Datasets 4.1.1 | |
| - Tokenizers 0.21.4 |