SFT, Instruction Tuning, Data & PEFT · Problem 2 of 6
Implement a LoRA-wrapped linear layer (frozen trainable scaled by ). [HuggingFace]
Implement the function/class skeleton in the editor. Any correct approach is accepted.
import math
import torch
import torch.nn as nn
class LoRALinear(nn.Module):
def __init__(self, base: nn.Linear, r: int=8, alpha: int=16, dropout: float=0.0):
raise NotImplementedError
def forward(self, x):
raise NotImplementedError
@torch.no_grad()
def merge(self):
raise NotImplementedErrorReady when you are
Submit your solution and a structured review appears here — verdict, score, and concrete feedback. Any correct approach passes.
Implement a LoRA-wrapped linear layer (frozen trainable scaled by ). [HuggingFace]
Implement the function/class skeleton in the editor. Any correct approach is accepted.