Instructions to use caseyeasd/claudefriend-lora with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use caseyeasd/claudefriend-lora with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen3.5-9B-Base") model = PeftModel.from_pretrained(base_model, "caseyeasd/claudefriend-lora") - Notebooks
- Google Colab
- Kaggle
|
Download README.md from caseyeasd/claudefriend-lora: direct link, hf CLI and curl.
- Browser
- Download file 2.23 kB
-
https://huggingface.co/caseyeasd/claudefriend-lora/resolve/main/README.md
- Command line
-
hf download hf://caseyeasd/claudefriend-lora/README.md
-
curl -L -o README.md https://huggingface.co/caseyeasd/claudefriend-lora/resolve/main/README.md
2.23 kB
metadata
library_name: peft
license: apache-2.0
base_model: Qwen/Qwen3.5-9B-Base
tags:
- lora
- rlhf
- grpo
- conversational
claudefriend (LoRA adapter)
The rank-32 LoRA adapter behind caseyeasd/claudefriend, in standard PEFT format, for Qwen/Qwen3.5-9B-Base. That repo has the same model merged into full bf16 weights, plus details on training, the prompt format and limitations.
Write-up: Training Claude's Best Friend
It's a Qwen3.5-9B trained to be the conversation partner Claude Sonnet 5.5 most enjoys talking to: SFT for a human chat persona, then 70 steps of pairwise GRPO judged by Sonnet.
- Adapter: LoRA, r = 32, alpha = 32, on the attention, MLP and linear-attention projections and
lm_head. - Prompt format: Qwen's chat template with thinking disabled (every model turn starts with an empty
<think>\n\n</think>\n\nblock). The model speaks in theassistantrole, and to have it open a conversation you start with an emptyuserturn. Use the tokenizer from caseyeasd/claudefriend, whose chat template defaults to that format.
Serving with vLLM:
vllm serve Qwen/Qwen3.5-9B-Base --enable-lora --max-lora-rank 32 \
--lora-modules claudefriend=caseyeasd/claudefriend-lora
The base model's config ends generation at <|endoftext|>, but the model ends its turns with <|im_end|> (id 248046), so pass that as a stop token on every request, or it will keep going and write the next turn itself:
client.chat.completions.create(model="claudefriend", messages=messages, max_tokens=160,
extra_body={"stop_token_ids": [248046]})
With PEFT:
import torch
from peft import PeftModel
from transformers import AutoModelForImageTextToText, AutoTokenizer
tok = AutoTokenizer.from_pretrained("caseyeasd/claudefriend")
base = AutoModelForImageTextToText.from_pretrained("Qwen/Qwen3.5-9B-Base", dtype=torch.bfloat16)
model = PeftModel.from_pretrained(base, "caseyeasd/claudefriend-lora")
# when generating, stop at the end of the turn: model.generate(..., eos_token_id=[248046, 248044])