Feature Extraction
Transformers
Safetensors
sensenova_loop
text-generation
vision
vision-encoder
multimodal
qwen3_5
custom_code
Instructions to use gatilin/sensenova-loop-9b-vision-encoder with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use gatilin/sensenova-loop-9b-vision-encoder with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("feature-extraction", model="gatilin/sensenova-loop-9b-vision-encoder", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("gatilin/sensenova-loop-9b-vision-encoder", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
Download component.py from gatilin/sensenova-loop-9b-vision-encoder: direct link, hf CLI and curl.
- Browser
- Download file 1.17 kB
-
https://huggingface.co/gatilin/sensenova-loop-9b-vision-encoder/resolve/main/component.py
- Command line
-
hf download hf://gatilin/sensenova-loop-9b-vision-encoder/component.py
-
curl -L -o component.py https://huggingface.co/gatilin/sensenova-loop-9b-vision-encoder/resolve/main/component.py
1.17 kB
| """Load the original SenseNova-Loop visual tower and merger from this bundle.""" | |
| import json | |
| from pathlib import Path | |
| import torch | |
| from accelerate import init_empty_weights | |
| from safetensors.torch import load_file | |
| from transformers.models.qwen3_5.configuration_qwen3_5 import Qwen3_5VisionConfig | |
| from transformers.models.qwen3_5.modeling_qwen3_5 import Qwen3_5VisionModel | |
| def load_vision_model(path='.', dtype=torch.float32, device='cpu'): | |
| path = Path(path) | |
| config = json.loads((path / 'config.json').read_text())['vision_config'] | |
| config.pop('deepstack_visual_indexes', None) | |
| config = Qwen3_5VisionConfig(**config) | |
| config._attn_implementation = 'sdpa' | |
| with init_empty_weights(include_buffers=False): | |
| model = Qwen3_5VisionModel(config) | |
| weights = load_file(str(path / 'model.safetensors'), device='cpu') | |
| prefix = 'model.visual.' | |
| if not weights or not all(k.startswith(prefix) for k in weights): | |
| raise ValueError('Unexpected tensor names') | |
| model.load_state_dict({k[len(prefix):]: v for k, v in weights.items()}, strict=True, assign=True) | |
| return model.to(device=device, dtype=dtype).eval().requires_grad_(False) | |