linear#

(s3prl.nn.linear)

Common linear models

Authors:
  • Leo 2022

FrameLevelLinear#

class s3prl.nn.linear.FrameLevelLinear(input_size: int, output_size: int, hidden_size: int = 256)[source][source]#

Bases: FrameLevel

The frame-level linear probing model used in SUPERB Benchmark

call_super_init: bool = False[source]#
dump_patches: bool = False[source]#
forward(x, x_len)[source]#
Parameters:
  • x (torch.FloatTensor) – (batch_size, seq_len, input_size)

  • x_len (torch.LongTensor) – (batch_size, )

Returns:

tuple

  1. ys (torch.FloatTensor): (batch_size, seq_len, output_size)

  2. ys_len (torch.LongTensor): (batch_size, )

property input_size: int[source]#
property output_size: int[source]#
training: bool[source]#

MeanPoolingLinear#

class s3prl.nn.linear.MeanPoolingLinear(input_size: int, output_size: int, hidden_size: int = 256)[source][source]#

Bases: UtteranceLevel

The utterance-level linear probing model used in SUPERB Benchmark

call_super_init: bool = False[source]#
dump_patches: bool = False[source]#
forward(x, x_len)[source]#
Parameters:
  • x (torch.FloatTensor) – (batch_size, seq_len, input_size)

  • x_len (torch.LongTensor) – (batch_size, )

Returns:

torch.FloatTensor

(batch_size, output_size)

property input_size: int[source]#
property output_size: int[source]#
training: bool[source]#