Image-Text-to-Text
Transformers
Safetensors
English
molmo
text-generation
multimodal
olmo
pixmo
conversational
custom_code
Instructions to use amete7/qvla with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use amete7/qvla with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="amete7/qvla", trust_remote_code=True) messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("amete7/qvla", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use amete7/qvla with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "amete7/qvla" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "amete7/qvla", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/amete7/qvla
- SGLang
How to use amete7/qvla with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "amete7/qvla" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "amete7/qvla", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "amete7/qvla" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "amete7/qvla", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - Docker Model Runner
How to use amete7/qvla with Docker Model Runner:
docker model run hf.co/amete7/qvla
Atharva Mete commited on
Commit ·
dd4b88e
1
Parent(s): 57b4d23
fixed initialization
Browse files- modeling_molmo.py +14 -3
modeling_molmo.py
CHANGED
|
@@ -1759,9 +1759,14 @@ class Molmo(nn.Module):
|
|
| 1759 |
self.__num_fwd_flops: Optional[int] = None
|
| 1760 |
|
| 1761 |
self.total_vocab_size = config.vocab_size + config.additional_vocab_size + config.skill_vocab_size
|
| 1762 |
-
|
| 1763 |
-
|
| 1764 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1765 |
|
| 1766 |
def reset_parameters(self):
|
| 1767 |
if self.vision_backbone is not None:
|
|
@@ -1773,6 +1778,9 @@ class Molmo(nn.Module):
|
|
| 1773 |
if hasattr(self.transformer.wte, "new_embedding"):
|
| 1774 |
nn.init.normal_(self.transformer.wte.new_embedding, std=self.config.new_embedding_init_range)
|
| 1775 |
|
|
|
|
|
|
|
|
|
|
| 1776 |
if hasattr(self.transformer, "wpe"):
|
| 1777 |
nn.init.normal_(self.transformer.wpe, mean=0.0, std=1.0)
|
| 1778 |
|
|
@@ -1780,6 +1788,9 @@ class Molmo(nn.Module):
|
|
| 1780 |
|
| 1781 |
if hasattr(self.transformer, "ff_out"):
|
| 1782 |
nn.init.normal_(self.transformer.ff_out, mean=0.0, std=0.02)
|
|
|
|
|
|
|
|
|
|
| 1783 |
|
| 1784 |
if self.config.block_group_size == 1:
|
| 1785 |
for block in self.transformer.blocks:
|
|
|
|
| 1759 |
self.__num_fwd_flops: Optional[int] = None
|
| 1760 |
|
| 1761 |
self.total_vocab_size = config.vocab_size + config.additional_vocab_size + config.skill_vocab_size
|
| 1762 |
+
|
| 1763 |
+
def init_weights(self):
|
| 1764 |
+
if hasattr(self.transformer, "skill_ff_out"):
|
| 1765 |
+
nn.init.xavier_uniform_(self.transformer.skill_ff_out.weight)
|
| 1766 |
+
if self.transformer.skill_ff_out.bias is not None:
|
| 1767 |
+
nn.init.zeros_(self.transformer.skill_ff_out.bias)
|
| 1768 |
+
if hasattr(self.transformer.wte, "skill_embedding"):
|
| 1769 |
+
nn.init.xavier_uniform_(self.transformer.wte.skill_embedding)
|
| 1770 |
|
| 1771 |
def reset_parameters(self):
|
| 1772 |
if self.vision_backbone is not None:
|
|
|
|
| 1778 |
if hasattr(self.transformer.wte, "new_embedding"):
|
| 1779 |
nn.init.normal_(self.transformer.wte.new_embedding, std=self.config.new_embedding_init_range)
|
| 1780 |
|
| 1781 |
+
if hasattr(self.transformer.wte, "skill_embedding"):
|
| 1782 |
+
nn.init.xavier_uniform_(self.transformer.wte.skill_embedding)
|
| 1783 |
+
|
| 1784 |
if hasattr(self.transformer, "wpe"):
|
| 1785 |
nn.init.normal_(self.transformer.wpe, mean=0.0, std=1.0)
|
| 1786 |
|
|
|
|
| 1788 |
|
| 1789 |
if hasattr(self.transformer, "ff_out"):
|
| 1790 |
nn.init.normal_(self.transformer.ff_out, mean=0.0, std=0.02)
|
| 1791 |
+
|
| 1792 |
+
if hasattr(self.transformer, "skill_ff_out"):
|
| 1793 |
+
nn.init.normal_(self.transformer.skill_ff_out, mean=0.0, std=0.02)
|
| 1794 |
|
| 1795 |
if self.config.block_group_size == 1:
|
| 1796 |
for block in self.transformer.blocks:
|