Run this model with HF Jobs
Run OpenGVLab/InternVL-14B-224px on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/OpenGVLab/InternVL-14B-224px. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/OpenGVLab/InternVL-14B-224px on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use OpenGVLab/InternVL-14B-224px with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use OpenGVLab/InternVL-14B-224px with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-feature-extraction", model="OpenGVLab/InternVL-14B-224px", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModel processor = AutoProcessor.from_pretrained("OpenGVLab/InternVL-14B-224px", trust_remote_code=True) model = AutoModel.from_pretrained("OpenGVLab/InternVL-14B-224px", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
Fix incorrect image embedding when running with a single GPU and 24GB VRAM
#3
by xdedss - opened
113 unmodified lines114115116117118119120121122123124125126127128129130131132133134135136137138139140141142113 unmodified lines k_bias = self.k_bias v_bias = self.v_bias
# simulate module forward hooks to let accelerate load the actual weight # see https://github.com/huggingface/accelerate/blob/1f7a79b428749f45187ec69485f2c966fe21926e/src/accelerate/hooks.py#L163 simulate_hooks = hasattr(self.q, '_hf_hook')
if simulate_hooks: self.q._hf_hook.pre_forward(self.q, x) q = F.linear(input=x, weight=self.q.weight, bias=q_bias) if simulate_hooks: self.q._hf_hook.post_forward(self.q, x) q = q.reshape(B, N, 1, self.num_heads, -1).permute(2, 0, 3, 1, 4).squeeze(0) # (B, N_head, N_q, dim)
if simulate_hooks: self.k._hf_hook.pre_forward(self.k, k) k = F.linear(input=k, weight=self.k.weight, bias=k_bias) if simulate_hooks: self.k._hf_hook.post_forward(self.k, k) k = k.reshape(B, N_k, 1, self.num_heads, -1).permute(2, 0, 3, 1, 4).squeeze(0)
if simulate_hooks: self.v._hf_hook.pre_forward(self.v, v) v = F.linear(input=v, weight=self.v.weight, bias=v_bias) if simulate_hooks: self.v._hf_hook.post_forward(self.v, v) v = v.reshape(B, N_v, 1, self.num_heads, -1).permute(2, 0, 3, 1, 4).squeeze(0)
q = q * self.scalemodeling_internvl.py+16