File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change 4
4
summary: This is training code with notes for fine-tuning pre-trained GPT-2 model with LoRA.
5
5
---
6
6
7
- # Finetune GPT-2 with [LoRA](index.html)
7
+ # Finetune [ GPT-2](gpt2.html) with [LoRA](index.html)
8
8
9
9
Here's a Colab notebook for training a feedback transformer on Tiny Shakespeare dataset.
10
10
@@ -50,10 +50,15 @@ class Trainer(BaseConfigs):
50
50
51
51
# Dataset
52
52
text : TensorDataset = "tiny_shakespeare"
53
+ # Huggingface tokenizer
53
54
tokenizer = AutoTokenizer .from_pretrained ("gpt2" )
55
+ # [GPT2 model](gpt2.html)
54
56
model : GPTModel
57
+ # Optimizer
55
58
optimizer : torch .optim .Adam
59
+ # Cross entropy loss
56
60
loss_func = torch .nn .CrossEntropyLoss ()
61
+ # Dataloader
57
62
data_loader : DataLoader
58
63
59
64
def _load_pretrained_weights (self ):
@@ -111,7 +116,7 @@ def initialize(self):
111
116
"""
112
117
### Initialize the model, optimizer and dataloader
113
118
"""
114
- # Initialize the model
119
+ # Initialize the [GPT2 model](gpt2.html)
115
120
self .model = GPTModel (
116
121
layer_norm_epsilon = self .layer_norm_epsilon ,
117
122
d_model = self .d_model ,
You can’t perform that action at this time.
0 commit comments