Expand description
Transformer module with full model implementation and weight loading
This module provides:
Transformer- Complete transformer model for language modelingTransformerConfig- Model architecture configurationload_safetensors_weights- Load weights from SafeTensors filesArchitecture- Model architecture type for weight mappingMultiHeadAttentionWithLoRA- Attention with deep LoRA injectionLoRAProjection- Linear projection with LoRA adapters
Re-exports§
pub use wgpu_block::WgpuForwardPass;
Modules§
- init
- Weight initialization utilities (C-INIT-001).
- wgpu_
block - wgpu-accelerated transformer forward pass
Structs§
- Block
Weights - Downloaded weight data from a CUDA transformer block.
- Cuda
Grad Workspace - Shared gradient workspace for weight gradients (one per model, NOT per layer).
- Cuda
Nf4Transformer Block - CUDA-accelerated transformer block with NF4-quantized frozen weights.
- Cuda
Transformer Block - CUDA-accelerated transformer block
- Encoder
Block - Encoder transformer block (BERT/RoBERTa).
- Encoder
Feed Forward - Encoder feed-forward network with GELU activation (BERT/RoBERTa/CodeBERT).
- Encoder
Model - Complete encoder model (BERT/RoBERTa/CodeBERT).
- GpuBlock
Optimizer State - GPU-resident AdamW optimizer state for one transformer block.
- Layer
Norm - Layer Normalization with bias (used by BERT/RoBERTa/CodeBERT encoders).
- Learned
Position Embedding - Learned absolute position embedding for encoder models (BERT, RoBERTa, CodeBERT).
- LoRA
Projection - LoRA-enabled linear projection
- Multi
Head Attention - Multi-head self-attention layer
- Multi
Head Attention With LoRA - Multi-head attention with deep LoRA injection
- Transformer
- Complete transformer model
- Transformer
Config - Configuration for transformer models
Enums§
- Architecture
- Architecture type for weight name mapping
- Cuda
Block - Unified enum for CUDA transformer blocks (fp32 or NF4-quantized).
- Model
Architecture - Model architecture family.
Functions§
- load_
safetensors_ weights - Load transformer weights from SafeTensors file(s)
- validate_
weights - Validate that loaded weights match expected architecture