Image-Text-to-Text
Transformers
Safetensors
internvl_chat
feature-extraction
medical
multimodal
report generation
radiology
clinical-reasoning
MRI
CT
Histopathology
X-ray
Fundus
conversational
custom_code
Instructions to use IQuestLab/Fleming-VL-8B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use IQuestLab/Fleming-VL-8B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="IQuestLab/Fleming-VL-8B", 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 AutoModel model = AutoModel.from_pretrained("IQuestLab/Fleming-VL-8B", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use IQuestLab/Fleming-VL-8B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "IQuestLab/Fleming-VL-8B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "IQuestLab/Fleming-VL-8B", "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/IQuestLab/Fleming-VL-8B
- SGLang
How to use IQuestLab/Fleming-VL-8B 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 "IQuestLab/Fleming-VL-8B" \ --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": "IQuestLab/Fleming-VL-8B", "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 "IQuestLab/Fleming-VL-8B" \ --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": "IQuestLab/Fleming-VL-8B", "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 IQuestLab/Fleming-VL-8B with Docker Model Runner:
docker model run hf.co/IQuestLab/Fleming-VL-8B
Delete configuration_internvl_chat copy.py
Browse files
configuration_internvl_chat copy.py
DELETED
|
@@ -1,97 +0,0 @@
|
|
| 1 |
-
# --------------------------------------------------------
|
| 2 |
-
# InternVL
|
| 3 |
-
# Copyright (c) 2024 OpenGVLab
|
| 4 |
-
# Licensed under The MIT License [see LICENSE for details]
|
| 5 |
-
# --------------------------------------------------------
|
| 6 |
-
|
| 7 |
-
import copy
|
| 8 |
-
|
| 9 |
-
from transformers import AutoConfig, LlamaConfig, Qwen2Config
|
| 10 |
-
from transformers.configuration_utils import PretrainedConfig
|
| 11 |
-
from transformers.utils import logging
|
| 12 |
-
|
| 13 |
-
from .configuration_intern_vit import InternVisionConfig
|
| 14 |
-
|
| 15 |
-
logger = logging.get_logger(__name__)
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
class InternVLChatConfig(PretrainedConfig):
|
| 19 |
-
model_type = 'internvl_chat'
|
| 20 |
-
is_composition = True
|
| 21 |
-
|
| 22 |
-
def __init__(
|
| 23 |
-
self,
|
| 24 |
-
vision_config=None,
|
| 25 |
-
llm_config=None,
|
| 26 |
-
use_backbone_lora=0,
|
| 27 |
-
use_llm_lora=0,
|
| 28 |
-
select_layer=-1,
|
| 29 |
-
force_image_size=None,
|
| 30 |
-
downsample_ratio=0.5,
|
| 31 |
-
template=None,
|
| 32 |
-
dynamic_image_size=False,
|
| 33 |
-
use_thumbnail=False,
|
| 34 |
-
ps_version='v1',
|
| 35 |
-
min_dynamic_patch=1,
|
| 36 |
-
max_dynamic_patch=6,
|
| 37 |
-
**kwargs):
|
| 38 |
-
super().__init__(**kwargs)
|
| 39 |
-
|
| 40 |
-
if vision_config is None:
|
| 41 |
-
vision_config = {'architectures': ['InternVisionModel']}
|
| 42 |
-
logger.info('vision_config is None. Initializing the InternVisionConfig with default values.')
|
| 43 |
-
|
| 44 |
-
if llm_config is None:
|
| 45 |
-
llm_config = {'architectures': ['Qwen2ForCausalLM']}
|
| 46 |
-
logger.info('llm_config is None. Initializing the LlamaConfig config with default values (`LlamaConfig`).')
|
| 47 |
-
|
| 48 |
-
self.vision_config = InternVisionConfig(**vision_config)
|
| 49 |
-
if llm_config.get('architectures')[0] == 'LlamaForCausalLM':
|
| 50 |
-
self.llm_config = LlamaConfig(**llm_config)
|
| 51 |
-
elif llm_config.get('architectures')[0] == 'Qwen2ForCausalLM':
|
| 52 |
-
self.llm_config = Qwen2Config(**llm_config)
|
| 53 |
-
else:
|
| 54 |
-
raise ValueError('Unsupported architecture: {}'.format(llm_config.get('architectures')[0]))
|
| 55 |
-
self.use_backbone_lora = use_backbone_lora
|
| 56 |
-
self.use_llm_lora = use_llm_lora
|
| 57 |
-
self.select_layer = select_layer
|
| 58 |
-
self.force_image_size = force_image_size
|
| 59 |
-
self.downsample_ratio = downsample_ratio
|
| 60 |
-
self.template = template
|
| 61 |
-
self.dynamic_image_size = dynamic_image_size
|
| 62 |
-
self.use_thumbnail = use_thumbnail
|
| 63 |
-
self.ps_version = ps_version # pixel shuffle version
|
| 64 |
-
self.min_dynamic_patch = min_dynamic_patch
|
| 65 |
-
self.max_dynamic_patch = max_dynamic_patch
|
| 66 |
-
# By default, we use tie_word_embeddings=False for models of all sizes.
|
| 67 |
-
self.tie_word_embeddings = self.llm_config.tie_word_embeddings
|
| 68 |
-
|
| 69 |
-
logger.info(f'vision_select_layer: {self.select_layer}')
|
| 70 |
-
logger.info(f'ps_version: {self.ps_version}')
|
| 71 |
-
logger.info(f'min_dynamic_patch: {self.min_dynamic_patch}')
|
| 72 |
-
logger.info(f'max_dynamic_patch: {self.max_dynamic_patch}')
|
| 73 |
-
|
| 74 |
-
def to_dict(self):
|
| 75 |
-
"""
|
| 76 |
-
Serializes this instance to a Python dictionary. Override the default [`~PretrainedConfig.to_dict`].
|
| 77 |
-
|
| 78 |
-
Returns:
|
| 79 |
-
`Dict[str, any]`: Dictionary of all the attributes that make up this configuration instance,
|
| 80 |
-
"""
|
| 81 |
-
output = copy.deepcopy(self.__dict__)
|
| 82 |
-
output['vision_config'] = self.vision_config.to_dict()
|
| 83 |
-
output['llm_config'] = self.llm_config.to_dict()
|
| 84 |
-
output['model_type'] = self.__class__.model_type
|
| 85 |
-
output['use_backbone_lora'] = self.use_backbone_lora
|
| 86 |
-
output['use_llm_lora'] = self.use_llm_lora
|
| 87 |
-
output['select_layer'] = self.select_layer
|
| 88 |
-
output['force_image_size'] = self.force_image_size
|
| 89 |
-
output['downsample_ratio'] = self.downsample_ratio
|
| 90 |
-
output['template'] = self.template
|
| 91 |
-
output['dynamic_image_size'] = self.dynamic_image_size
|
| 92 |
-
output['use_thumbnail'] = self.use_thumbnail
|
| 93 |
-
output['ps_version'] = self.ps_version
|
| 94 |
-
output['min_dynamic_patch'] = self.min_dynamic_patch
|
| 95 |
-
output['max_dynamic_patch'] = self.max_dynamic_patch
|
| 96 |
-
|
| 97 |
-
return output
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|