|
|
--- |
|
|
license: mit |
|
|
metrics: |
|
|
- accuracy |
|
|
--- |
|
|
|
|
|
# Minimal Transformer Demo |
|
|
|
|
|
This is a very small Transformer model for demonstration purposes. |
|
|
|
|
|
## Usage |
|
|
|
|
|
```python |
|
|
import torch |
|
|
from huggingface_hub import hf_hub_download |
|
|
|
|
|
# Load the model |
|
|
model_path = hf_hub_download(repo_id="your_username/minimal-transformer-demo", filename="pytorch_model.bin") |
|
|
state_dict = torch.load(model_path) |
|
|
|
|
|
# Create the model architecture (must match the saved model!) |
|
|
# ... (define MinimalTransformer and MinimalTransformerBlock classes here) ... |
|
|
|
|
|
model = MinimalTransformer() # Use appropriate parameters |
|
|
model.load_state_dict(state_dict) |
|
|
model.eval() # Set to evaluation mode |
|
|
|
|
|
# Now you can use the model for inference |