Skip to contents

A PEFT LoRA adapter (rank 16, alpha 32, covering all 7 attention/MLP projections: `q/k/v/o_proj`, `gate/up/down_proj`) fine-tuned on top of `Qwen/Qwen2-1.5B` as a causal language model, for generating AITA-style text (e.g. verdicts/responses to Reddit "Am I the Asshole" posts), trained on the `corpus_reddit_aita10k` corpus. Unlike the vecs_* matrix models, this ships as a directory of PEFT adapter files (adapter_config.json, adapter_model.safetensors) plus the Qwen2 tokenizer (tokenizer.json, vocab.json, merges.txt, etc.) — not a single R object, and not the base model itself.

Format

A directory of PEFT LoRA adapter + tokenizer files

Source

LoRA fine-tune of `Qwen/Qwen2-1.5B` on the `corpus_reddit_aita10k` corpus for AITA-style text generation

Details

`load_pretrained()` does not read this into an R object. It returns a list with `$path` (the extracted adapter directory) and `$config` (parsed `adapter_config.json`: `r`, `lora_alpha`, `target_modules`, `task_type`, `base_model_name_or_path`). To use the model, fetch the base model (`Qwen/Qwen2-1.5B`) separately and apply this adapter on top of it, e.g. via `reticulate` + Python `peft`/`transformers`.

Examples

if (FALSE) { # \dontrun{

## download the model (once per machine)
download_pretrained("lora_qwen1.5b_aita_gen")

## load the model each session
adapter <- load_pretrained("lora_qwen1.5b_aita_gen")

adapter$path
adapter$config$task_type == "CAUSAL_LM"

## apply the adapter to the base model on the caller side, e.g.:
# transformers <- reticulate::import("transformers")
# peft <- reticulate::import("peft")
# base <- transformers$AutoModelForCausalLM$from_pretrained(
#   adapter$config$base_model_name_or_path
# )
# model <- peft$PeftModel$from_pretrained(base, adapter$path)

} # }