mirror of
https://github.com/wassname/lora-lite.git
synced 2026-08-17 11:21:36 +08:00
feat: ia3 variant, real bnb 4bit/8bit smoke, dev guide split, user-only readme
This commit is contained in:
@@ -1 +1 @@
|
||||
from . import lora, pissa, delora # noqa: F401 side-effect: register
|
||||
from . import lora, pissa, delora, ia3 # noqa: F401 side-effect: register
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
"""IA3-style output gating. y_new = y * g, with g initialized to ones."""
|
||||
import torch
|
||||
from torch import nn
|
||||
|
||||
from ..variant import register, ParamSpec
|
||||
|
||||
|
||||
@register
|
||||
class IA3:
|
||||
name = "ia3"
|
||||
|
||||
@staticmethod
|
||||
def param_specs(d_in, d_out, cfg):
|
||||
return {"lora_g": ParamSpec((d_out,), init="ones", trainable=True)}
|
||||
|
||||
@staticmethod
|
||||
def init(layer: nn.Linear, cfg) -> None:
|
||||
return
|
||||
|
||||
@staticmethod
|
||||
def forward(layer: nn.Linear, x: torch.Tensor, y: torch.Tensor) -> torch.Tensor:
|
||||
return y * layer.lora_g
|
||||
Reference in New Issue
Block a user