MCPcopy Create free account
hub / github.com/OpenGVLab/EfficientQAT / MultiBlock

Class MultiBlock

quantize/utils.py:8–22  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6
7
8class MultiBlock(nn.Module):
9 def __init__(self, *args, **kwargs) -> None:
10 super().__init__(*args, **kwargs)
11 self.block_list = nn.ModuleList([])
12
13 def add_block(self, block):
14 self.block_list.append(block)
15
16 def forward(self,
17 hidden_states: torch.Tensor,
18 attention_mask: Optional[torch.Tensor] = None,
19 position_ids: Optional[torch.LongTensor] = None):
20 for block in self.block_list:
21 hidden_states = block(hidden_states, attention_mask=attention_mask,position_ids=position_ids)[0]
22 return (hidden_states, )
23
24
25def set_weight_parameters(model, requires_grad):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected