Spaces:
Sleeping
Sleeping
Download scripts/test_lm_head.py from fallingbody/Fallnet: direct link, hf CLI and curl.
- Browser
- Download file 356 Bytes
-
https://huggingface.co/spaces/fallingbody/Fallnet/resolve/main/scripts/test_lm_head.py
- Command line
-
hf download hf://spaces/fallingbody/Fallnet/scripts/test_lm_head.py
-
curl -L -o test_lm_head.py https://huggingface.co/spaces/fallingbody/Fallnet/resolve/main/scripts/test_lm_head.py
356 Bytes
| import torch | |
| from transformers import AutoModelForCausalLM | |
| model = AutoModelForCausalLM.from_pretrained("HuggingFaceTB/SmolLM-135M-Instruct", local_files_only=True) | |
| h_last = torch.randn(1, 5, 576, dtype=torch.float32) | |
| try: | |
| logits = model.lm_head(h_last)[:, -1, :] | |
| print("Logits shape:", logits.shape) | |
| except Exception as e: | |
| print("ERROR:", e) | |