Instructions to use sarubi/AuthorMix with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use sarubi/AuthorMix with PEFT:
Task type is invalid.
- Notebooks
- Google Colab
- Kaggle
|
Download README.md from sarubi/AuthorMix: direct link, hf CLI and curl.
- Browser
- Download file 3.83 kB
-
https://huggingface.co/sarubi/AuthorMix/resolve/main/README.md
- Command line
-
hf download hf://sarubi/AuthorMix/README.md
-
curl -L -o README.md https://huggingface.co/sarubi/AuthorMix/resolve/main/README.md
3.83 kB
| base_model: meta-llama/Llama-3.1-8B-Instruct | |
| library_name: peft | |
| # AuthorMix author adapters | |
| These ten LoRA adapters form the high-resource author library for AuthorMix. | |
| They were trained on Llama 3.1 8B Instruct with rank 8 and alpha 16. | |
| Each adapter was trained on paired sentences for one author. The input was a | |
| neutral paraphrase of one of the author’s sentences, and the training target | |
| was the original sentence. This teaches the adapter to rewrite neutral text | |
| in that author’s style while preserving its meaning. | |
| The base model and target-specific mixture weights are supplied separately. | |
| - [Published paper (ACL Anthology)](https://aclanthology.org/2026.emnlp-main.2215/) | |
| - [arXiv preprint](https://arxiv.org/abs/2603.23069) | |
| - [Code and training instructions](https://github.com/text-adaptation-saar/AuthorMix) | |
| | Adapter directory | Author | | |
| | --- | --- | | |
| | `adapters/MT/` | Mark Twain | | |
| | `adapters/VW/` | Virginia Woolf | | |
| | `adapters/VL/` | Vernon Lee | | |
| | `adapters/CPG/` | Charlotte Perkins Gilman | | |
| | `adapters/GO/` | George Orwell | | |
| | `adapters/JA/` | Jane Austen | | |
| | `adapters/NH/` | Nathaniel Hawthorne | | |
| | `adapters/OW/` | Oscar Wilde | | |
| | `adapters/PGW/` | P. G. Wodehouse | | |
| | `adapters/SR/` | Samuel Richardson | | |
| ## Run an individual adapter | |
| This example rewrites a neutral sentence in Jane Austen's style. Change | |
| `author` to another code from the table to use a different adapter. | |
| Request access to [Llama 3.1 8B Instruct](https://huggingface.co/meta-llama/Llama-3.1-8B-Instruct) | |
| and sign in with `hf auth login` before running this example. It assumes a CUDA | |
| environment with enough memory to load the 8B base model. | |
| ```bash | |
| pip install torch transformers peft accelerate huggingface_hub | |
| ``` | |
| ```python | |
| from pathlib import Path | |
| import torch | |
| from huggingface_hub import snapshot_download | |
| from peft import PeftModel | |
| from transformers import AutoModelForCausalLM, AutoTokenizer | |
| base_id = "meta-llama/Llama-3.1-8B-Instruct" | |
| author = "JA" | |
| adapter_dir = f"adapters/{author}" | |
| snapshot = snapshot_download("sarubi/AuthorMix", allow_patterns=f"{adapter_dir}/*") | |
| tokenizer = AutoTokenizer.from_pretrained(base_id) | |
| base = AutoModelForCausalLM.from_pretrained( | |
| base_id, torch_dtype=torch.float16, device_map="auto" | |
| ) | |
| model = PeftModel.from_pretrained(base, str(Path(snapshot) / adapter_dir)).eval() | |
| text = "She arrived early and waited for the others in the sitting room." | |
| inputs = tokenizer.apply_chat_template( | |
| [{"role": "user", "content": f"Paraphrase\n{text}"}], | |
| add_generation_prompt=True, | |
| tokenize=True, | |
| return_dict=True, | |
| return_tensors="pt", | |
| ).to(model.device) | |
| with torch.inference_mode(): | |
| output = model.generate( | |
| **inputs, max_new_tokens=128, do_sample=False, | |
| pad_token_id=tokenizer.eos_token_id, | |
| ) | |
| print(tokenizer.decode(output[0, inputs["input_ids"].shape[-1]:], skip_special_tokens=True)) | |
| ``` | |
| This example uses one author adapter. To learn mixing weights for a new author | |
| and combine multiple adapters, follow the | |
| [AuthorMix training instructions](https://github.com/text-adaptation-saar/AuthorMix). | |
| ## Citation | |
| ```bibtex | |
| @inproceedings{thillainathan-etal-2026-authormix, | |
| title = {{A}uthor{M}ix: Modular Authorship Style Transfer via Layer-wise Adapter Mixing}, | |
| author = {Thillainathan, Sarubi and Lee, Ji-Ung and Sullivan, Michael and Koller, Alexander}, | |
| editor = {Lee, Hung-Yi and Dev, Sunipa and Li, Junyi Jessy and Elliott, Desmond}, | |
| booktitle = {Proceedings of the 2026 Conference on Empirical Methods in Natural Language Processing}, | |
| month = oct, | |
| year = {2026}, | |
| address = {Budapest, Hungary}, | |
| publisher = {Association for Computational Linguistics}, | |
| url = {https://aclanthology.org/2026.emnlp-main.2215/}, | |
| doi = {10.18653/2026.emnlp-main.2215}, | |
| pages = {50382--50416}, | |
| isbn = {979-8-89176-459-0} | |
| } | |
| ``` | |