mirror of
https://github.com/skindhu/Build-A-Large-Language-Model-CN.git
synced 2026-07-29 07:10:24 +08:00
add fourth chapter
This commit is contained in:
@@ -108,17 +108,17 @@ class DummyGPTModel(nn.Module):
|
|||||||
|
|
||||||
class DummyTransformerBlock(nn.Module): #C
|
class DummyTransformerBlock(nn.Module): #C
|
||||||
def __init__(self, cfg):
|
def __init__(self, cfg):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
|
||||||
def forward(self, x): #D
|
def forward(self, x): #D
|
||||||
return x
|
return x
|
||||||
|
|
||||||
class DummyLayerNorm(nn.Module): #E
|
class DummyLayerNorm(nn.Module): #E
|
||||||
def __init__(self, normalized_shape, eps=1e-5): #F
|
def __init__(self, normalized_shape, eps=1e-5): #F
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
|
||||||
def forward(self, x):
|
def forward(self, x):
|
||||||
return x
|
return x
|
||||||
|
|
||||||
|
|
||||||
#A 为 TransformerBlock 设置占位符
|
#A 为 TransformerBlock 设置占位符
|
||||||
|
|||||||
Reference in New Issue
Block a user