Skip to content

Conversation

nirbo
Copy link

@nirbo nirbo commented Oct 2, 2025

Summary

  • Add rwkv and rwkv7 entries to the LoRA target-module mapping so Transformers-based RWKV checkpoints automatically receive adapters.
  • Document the new behaviour in the README with a short RWKV snippet.
  • Introduce tests/test_rwkv_lora.py, a tiny forward/backward regression guarded by PEFT_RUN_RWKV_TESTS=1 so the Triton compile remains opt-in.

Testing

  make quality

  python -m pytest tests/test_rwkv_lora.py   # (skipped unless PEFT_RUN_RWKV_TESTS=1)

  # To exercise the RWKV-specific test:
  PEFT_RUN_RWKV_TESTS=1 python -m pytest tests/test_rwkv_lora.py

Copy link
Member

@BenjaminBossan BenjaminBossan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding default target modules for RWKV. I have some comments, please take a look.

# prints something like: Preheat the oven to 350 degrees and place the cookie dough in a baking dish [...]
```

> [!NOTE]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO this README entry can be removed, as we generally don't highlight individual models here.

@@ -0,0 +1,49 @@
# Copyright 2025-present the HuggingFace Inc. team.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There isn't really a need to add this test here, we don't have tests just to ensure that the default target modules are being set. I did, however, confirm that the test passes locally.

I could see an argument to add it to the general test suite, since RWKV has a different architecture:

PEFT_DECODER_MODELS_TO_TEST = [
"hf-internal-testing/tiny-random-OPTForCausalLM",
"hf-internal-testing/tiny-random-GPT2LMHeadModel",
"hf-internal-testing/tiny-random-BloomForCausalLM",
"hf-internal-testing/tiny-random-gpt_neo",
"hf-internal-testing/tiny-random-GPTJForCausalLM",
"hf-internal-testing/tiny-random-GPTBigCodeForCausalLM",
"trl-internal-testing/tiny-random-LlamaForCausalLM",
"peft-internal-testing/tiny-dummy-qwen2",
"hf-internal-testing/tiny-random-Gemma3ForCausalLM",
]

However, at the moment, the PEFT CI is already stressing the rate limit of HF Hub, so adding yet another model would not be a good idea. I think that if this situation relaxes and if we find that there is a big demand for RWKV finetuning with PEFT, we can consider that option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants