AdithyaSK's picture
AdithyaSK HF Staff
Stage Harbor release files 68501-69000
7cae575 verified
|
Raw History Blame Contribute Delete
1.96 kB

Add LoRA support for the tensor-parallel models supplied by the installed Transformers integration.

A model loaded with tp_plan="auto" has linear layers marked with _hf_tp_plan and _hf_device_mesh. LoRA should work when those layers use the supported colwise and rowwise plans across two GPUs. Keep the ordinary non-parallel LoRA behavior working.

The expected behavior is:

  • Adapter forward and backward computation follows the base layer's partitioning. Training must leave the replicated adapter weights consistent across ranks: the A factor for colwise layers and the B factor for rowwise layers.
  • Replicated factors start from the same initialized values on every rank with standard (init_lora_weights=True) and Gaussian (init_lora_weights="gaussian") initialization. This task covers those two initialization modes. Sharded factors retain the appropriate local dimensions.
  • A non-parallel adapter checkpoint can be loaded into the parallel model. Both factors must contain the correct values for their local partition, including nonzero saved factors; a successful load or matching shape alone is insufficient.
  • Multiple named adapters can be added and selected with the existing PEFT APIs. Switching adapters must select that adapter's computation and switching back must restore its results.
  • If the installed Transformers version is older than 5.4.0, attempting to wrap a parallel base model raises a RuntimeError explaining that Transformers >= 5.4.0 is required. Export is_transformers_ge_v5_4_0 from peft.import_utils consistently with the other version helpers.

The image supplies Transformers 5.4.0, two CUDA devices and offline copies of peft-internal-testing/zephyr-smol_llama-100m-sft-full and Qwen/Qwen3-0.6B. Use /opt/tasksmith-venv/bin/python for the preinstalled environment. Work in /workspace and implement changes under src/peft. The evaluator runs in a fresh environment with your submitted source files.