Skip to content
DeepForgeby svx
All problems
EasyDeep Learningdl-152

Adapter Bottleneck Params

Problem

Count the parameters of a bottleneck adapter: the down projection d_model * bottleneck, the up projection bottleneck * d_model, and, when bias is enabled, one bias of size bottleneck and one of size d_model.

The signature is adapter_bottleneck_params(d_model, bottleneck, bias=True). Return an integer.

Hint

Adapters project down to a small bottleneck and back up to the model dimension.

Test cases

case 1
in: [768,64]
expected: 99136
case 2
in: [768,64,false]
expected: 98304
case 3
in: [128,16]
expected: 4240
case 4
in: [64,8]
expected: 1096
Starter codePython
def adapter_bottleneck_params(d_model, bottleneck, bias=True):
    # Your code here
    pass

4 test cases · run your code against them in the editor