Skip to content

Commit b260349

Browse files
committed
LoRA GPT2 n_heads fix and notes
1 parent 012fc7f commit b260349

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

labml_nn/lora/experiment.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
summary: This is training code with notes for fine-tuning pre-trained GPT-2 model with LoRA.
55
---
66
7-
# Finetune GPT-2 with [LoRA](index.html)
7+
# Finetune [GPT-2](gpt2.html) with [LoRA](index.html)
88
99
Here's a Colab notebook for training a feedback transformer on Tiny Shakespeare dataset.
1010
@@ -50,10 +50,15 @@ class Trainer(BaseConfigs):
5050

5151
# Dataset
5252
text: TensorDataset = "tiny_shakespeare"
53+
# Huggingface tokenizer
5354
tokenizer = AutoTokenizer.from_pretrained("gpt2")
55+
# [GPT2 model](gpt2.html)
5456
model: GPTModel
57+
# Optimizer
5558
optimizer: torch.optim.Adam
59+
# Cross entropy loss
5660
loss_func = torch.nn.CrossEntropyLoss()
61+
# Dataloader
5762
data_loader: DataLoader
5863

5964
def _load_pretrained_weights(self):
@@ -111,7 +116,7 @@ def initialize(self):
111116
"""
112117
### Initialize the model, optimizer and dataloader
113118
"""
114-
# Initialize the model
119+
# Initialize the [GPT2 model](gpt2.html)
115120
self.model = GPTModel(
116121
layer_norm_epsilon=self.layer_norm_epsilon,
117122
d_model=self.d_model,

0 commit comments

Comments
 (0)