All problems
LoRA Parameter Count
Problem
Count the trainable parameters of a LoRA adapter on a d_in x d_out weight matrix: rank * (d_in + d_out) for the low-rank A and B matrices (biases are frozen).
The signature is lora_param_count(d_in, d_out, rank). Return an integer.
Hint
A tiny rank makes adapters hundreds of times smaller than the base matrix.
Test cases
case 1
in: [768,768,8]
expected: 12288
case 2
in: [512,512,4]
expected: 4096
case 3
in: [1024,1024,16]
expected: 32768
case 4
in: [64,32,2]
expected: 192
Starter codePython
def lora_param_count(d_in, d_out, rank):
# Your code here
pass4 test cases · run your code against them in the editor