Spaces:
Sleeping
Sleeping
Download engine/scripts/inspect_model.py from lorcapoul/smol-neuron-studio: direct link, hf CLI and curl.
- Browser
- Download file 990 Bytes
-
https://huggingface.co/spaces/lorcapoul/smol-neuron-studio/resolve/main/engine/scripts/inspect_model.py
- Command line
-
hf download hf://spaces/lorcapoul/smol-neuron-studio/engine/scripts/inspect_model.py
-
curl -L -o inspect_model.py https://huggingface.co/spaces/lorcapoul/smol-neuron-studio/resolve/main/engine/scripts/inspect_model.py
990 Bytes
| """Imprime la arquitectura del modelo `MODEL_ID` y el tamaño de `down_proj` por capa. | |
| Uso: cd engine && MODEL_ID=HuggingFaceTB/SmolLM2-360M-Instruct uv run python -m scripts.inspect_model | |
| """ | |
| from app.model import down_proj, load_model, model_id_from_env | |
| def main() -> None: | |
| loaded = load_model(model_id_from_env()) | |
| model, info = loaded.model, loaded.info | |
| print(model) | |
| print() | |
| print(f"Modelo: {info.model_id} ({info.architecture})") | |
| print(f"Dispositivo: {info.device}, {info.dtype}") | |
| print(f"Capas: {info.num_layers}") | |
| print(f"hidden_size: {info.hidden_size}") | |
| print(f"Vocabulario: {info.vocab_size}") | |
| print(f"Neuronas MLP: {sum(info.units_per_layer)} en total") | |
| print() | |
| print(f"{'capa':>4} {'down_proj entrada':>17} {'salida':>6}") | |
| for i in range(info.num_layers): | |
| proj = down_proj(model, i) | |
| print(f"{i:>4} {proj.in_features:>17} {proj.out_features:>6}") | |
| if __name__ == "__main__": | |
| main() | |