Spaces:
Sleeping
Sleeping
Premchandyadav369
feat: deploy interactive Q-TensorFormer demo with trained weights and Gradio 4 UI
67ded87 Download src/hf_model.py from Premchan369/Q-TensorFormer: direct link, hf CLI and curl.
- Browser
- Download file 1.21 kB
-
https://huggingface.co/spaces/Premchan369/Q-TensorFormer/resolve/main/src/hf_model.py
- Command line
-
hf download hf://spaces/Premchan369/Q-TensorFormer/src/hf_model.py
-
curl -L -o hf_model.py https://huggingface.co/spaces/Premchan369/Q-TensorFormer/resolve/main/src/hf_model.py
1.21 kB
| """ | |
| Hugging Face Transformers Integration for Q-TensorFormer. | |
| Provides first-class Hugging Face ecosystem compatibility: | |
| - QTensorFormerConfig (inherits PretrainedConfig) | |
| - QTensorFormerForCausalLM (inherits PreTrainedModel, GenerationMixin) | |
| - AutoConfig & AutoModelForCausalLM registration | |
| - Generation support with past_key_values and Adaptive KV Cache | |
| - save_pretrained and from_pretrained serialization | |
| """ | |
| import sys | |
| import os | |
| # Re-export authoritative root implementations | |
| from configuration_qtensorformer import QTensorFormerConfig, factorize_dim | |
| from modeling_qtensorformer import ( | |
| QTensorFormerForCausalLM, | |
| QTensorFormerModel, | |
| QTensorFormerPreTrainedModel, | |
| QTensorFormerBlock, | |
| QTensorFormerAttention, | |
| QTensorFormerMLP, | |
| TensorTrainLinear, | |
| AdaptiveKVCache, | |
| PIDResourceController, | |
| QTensorFormerRMSNorm, | |
| ) | |
| __all__ = [ | |
| "QTensorFormerConfig", | |
| "QTensorFormerForCausalLM", | |
| "QTensorFormerModel", | |
| "QTensorFormerPreTrainedModel", | |
| "QTensorFormerBlock", | |
| "QTensorFormerAttention", | |
| "QTensorFormerMLP", | |
| "TensorTrainLinear", | |
| "AdaptiveKVCache", | |
| "PIDResourceController", | |
| "QTensorFormerRMSNorm", | |
| "factorize_dim", | |
| ] | |