Add GPTModelFast (#584)

* Add GPTModelFast

* update
This commit is contained in:
Sebastian Raschka
2025-03-27 14:00:25 -05:00
committed by GitHub
parent c9271ac427
commit e07a7abdd5
7 changed files with 204 additions and 61 deletions

View File

@@ -50,11 +50,12 @@ Once installed, you can import code from any chapter using:
from llms_from_scratch.ch02 import GPTDatasetV1, create_dataloader_v1
from llms_from_scratch.ch03 import (
MultiHeadAttention,
SelfAttention_v1,
SelfAttention_v2,
CausalAttention,
MultiHeadAttentionWrapper
MultiHeadAttentionWrapper,
MultiHeadAttention,
PyTorchMultiHeadAttention # Bonus: Faster variant using PyTorch's scaled_dot_product_attention
)
from llms_from_scratch.ch04 import (
@@ -63,6 +64,7 @@ from llms_from_scratch.ch04 import (
FeedForward,
TransformerBlock,
GPTModel,
GPTModelFast # Bonus: Faster variant using PyTorch's scaled_dot_product_attention
generate_text_simple
)