Skip to contents

A PEFT LoRA adapter (rank 8, alpha 32, target modules `q_proj`/`v_proj`) fine-tuned on top of `Qwen/Qwen2-1.5B` for binary sequence classification of Reddit "Am I the Asshole" (AITA) posts, via a 2-way `score` head (base_model.model.score.weight, shape `[2, 1536]`), 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 verdict classification

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_cls")

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

adapter$path
adapter$config$task_type == "SEQ_CLS"

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

} # }