Spaces:
Sleeping
Sleeping
Download scripts/check_unsloth.py from Nitishkumar-ai/commitguard-env: direct link, hf CLI and curl.
- Browser
- Download file 443 Bytes
-
https://huggingface.co/spaces/Nitishkumar-ai/commitguard-env/resolve/main/scripts/check_unsloth.py
- Command line
-
hf download hf://spaces/Nitishkumar-ai/commitguard-env/scripts/check_unsloth.py
-
curl -L -o check_unsloth.py https://huggingface.co/spaces/Nitishkumar-ai/commitguard-env/resolve/main/scripts/check_unsloth.py
443 Bytes
| import torch | |
| from unsloth import FastLanguageModel | |
| try: | |
| model, tokenizer = FastLanguageModel.from_pretrained( | |
| model_name="unsloth/Llama-3.2-1B-Instruct-bnb-4bit", | |
| max_seq_length=1024, | |
| load_in_4bit=True, | |
| ) | |
| print("Successfully loaded model in 4-bit on this GPU.") | |
| print(f"Memory allocated: {torch.cuda.memory_allocated() / 1024**2:.1f} MB") | |
| except Exception as e: | |
| print(f"Failed to load model: {e}") | |