Skip to content

Commit

Permalink
LoRA GPT2 n_heads fix and notes
Browse files Browse the repository at this point in the history
  • Loading branch information
vpj committed Aug 18, 2024
1 parent 012fc7f commit b260349
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions labml_nn/lora/experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
summary: This is training code with notes for fine-tuning pre-trained GPT-2 model with LoRA.
---
# Finetune GPT-2 with [LoRA](index.html)
# Finetune [GPT-2](gpt2.html) with [LoRA](index.html)
Here's a Colab notebook for training a feedback transformer on Tiny Shakespeare dataset.
Expand Down Expand Up @@ -50,10 +50,15 @@ class Trainer(BaseConfigs):

# Dataset
text: TensorDataset = "tiny_shakespeare"
# Huggingface tokenizer
tokenizer = AutoTokenizer.from_pretrained("gpt2")
# [GPT2 model](gpt2.html)
model: GPTModel
# Optimizer
optimizer: torch.optim.Adam
# Cross entropy loss
loss_func = torch.nn.CrossEntropyLoss()
# Dataloader
data_loader: DataLoader

def _load_pretrained_weights(self):
Expand Down Expand Up @@ -111,7 +116,7 @@ def initialize(self):
"""
### Initialize the model, optimizer and dataloader
"""
# Initialize the model
# Initialize the [GPT2 model](gpt2.html)
self.model = GPTModel(
layer_norm_epsilon=self.layer_norm_epsilon,
d_model=self.d_model,
Expand Down

0 comments on commit b260349

Please sign in to comment.