Download models/__init__.py from singhamAstram/micro-glm-tinystories: direct link, hf CLI and curl.
- Browser
- Download file 1.02 kB
-
https://huggingface.co/singhamAstram/micro-glm-tinystories/resolve/main/models/__init__.py
- Command line
-
hf download hf://singhamAstram/micro-glm-tinystories/models/__init__.py
-
curl -L -o __init__.py https://huggingface.co/singhamAstram/micro-glm-tinystories/resolve/main/models/__init__.py
1.02 kB
| """ | |
| Model registry for PyTorch model architectures. | |
| Each model class must implement: | |
| __init__(self, vocab_size, block_size, n_layer, n_head, n_embd, dropout) | |
| forward(self, idx, targets=None) -> (logits, loss) | |
| generate(self, idx, max_new_tokens, temperature=1.0, top_k=40) | |
| """ | |
| from .micro_gpt import MicroGPT | |
| from .micro_gpt_tf import MicroGPT_TF | |
| from .micro_glm import MicroGLM | |
| from .micro_deepseek import MicroDeepSeek | |
| MODEL_REGISTRY = { | |
| 'micro_gpt': MicroGPT, | |
| 'micro_gpt_tf': MicroGPT_TF, | |
| 'micro_glm': MicroGLM, | |
| 'micro_deepseek': MicroDeepSeek, | |
| } | |
| def get_model(arch_name: str): | |
| """Return the model class for a given architecture name.""" | |
| if arch_name not in MODEL_REGISTRY: | |
| available = ', '.join(sorted(MODEL_REGISTRY.keys())) | |
| raise ValueError(f"Unknown architecture '{arch_name}'. Available: {available}") | |
| return MODEL_REGISTRY[arch_name] | |
| def list_models(): | |
| """Return list of available model architecture names.""" | |
| return sorted(MODEL_REGISTRY.keys()) |