Note: Users are permitted to use this model in accordance with the Llama 3 Community License Agreement. Additionally, due to the licensing restrictions of the dataset used to train this model, which prohibits commercial use, the Dragonfly-Med model is restricted to non-commercial use only.
Model Details
Dragonfly-Med is a multimodal biomedical visual-language model, trained by instruction tuning on Llama 3.
The primary use of Dragonfly-Med is research on large visual-language models.
It is primarily intended for researchers and hobbyists in natural language processing, machine learning, and artificial intelligence.
How to Get Started with the Model
💿 Installation
Create a conda environment and install necessary packages
As a final step, please run the following command.
pip install --upgrade -e .
🧠 Inference
If you have successfully completed the installation process, then you should be able to follow the steps below.
Question: Provide a brief description of the given image.
Load necessary packages
import torch
from PIL import Image
from transformers import AutoProcessor, AutoTokenizer
from dragonfly.models.modeling_dragonfly import DragonflyForCausalLM
from dragonfly.models.processing_dragonfly import DragonflyProcessor
from pipeline.train.train_utils import random_seed
Instantiate the tokenizer, processor, and model.
device = torch.device("cuda:0")
tokenizer = AutoTokenizer.from_pretrained("togethercomputer/Llama-3-8B-Dragonfly-Med-v1")
clip_processor = AutoProcessor.from_pretrained("openai/clip-vit-base-patch32")
image_processor = clip_processor.image_processor
processor = DragonflyProcessor(image_processor=image_processor, tokenizer=tokenizer, image_encoding_style="llava-hd")
model = DragonflyForCausalLM.from_pretrained("togethercomputer/Llama-3-8B-Dragonfly-Med-v1")
model = model.to(torch.bfloat16)
model = model.to(device)
Now, lets load the image and process them.
image = Image.open("ROCO_04197.jpg")
image = image.convert("RGB")
images = [image]
# images = [None] # if you do not want to pass any images
text_prompt = "<|start_header_id|>user<|end_header_id|>\n\nSummarize the visual content of the image.<|eot_id|><|start_header_id|>assistant<|end_header_id|>\n\n"
inputs = processor(text=[text_prompt], images=images, max_length=2048, return_tensors="pt", is_generate=True)
inputs = inputs.to(device)
Finally, let us generate the responses from the model
@misc{chen2024dragonfly,
title={Dragonfly: Multi-Resolution Zoom Supercharges Large Visual-Language Model},
author={Kezhen Chen and Rahul Thapa and Rahul Chalamala and Ben Athiwaratkun and Shuaiwen Leon Song and James Zou},
year={2024},
eprint={2406.00977},
archivePrefix={arXiv},
primaryClass={cs.CV}
}
LLama-3-Dragonfly-Med huggingface.co is an AI model on huggingface.co that provides LLama-3-Dragonfly-Med's model effect (), which can be used instantly with this SillyTilly LLama-3-Dragonfly-Med model. huggingface.co supports a free trial of the LLama-3-Dragonfly-Med model, and also provides paid use of the LLama-3-Dragonfly-Med. Support call LLama-3-Dragonfly-Med model through api, including Node.js, Python, http.
LLama-3-Dragonfly-Med huggingface.co is an online trial and call api platform, which integrates LLama-3-Dragonfly-Med's modeling effects, including api services, and provides a free online trial of LLama-3-Dragonfly-Med, you can try LLama-3-Dragonfly-Med online for free by clicking the link below.
SillyTilly LLama-3-Dragonfly-Med online free url in huggingface.co:
LLama-3-Dragonfly-Med is an open source model from GitHub that offers a free installation service, and any user can find LLama-3-Dragonfly-Med on GitHub to install. At the same time, huggingface.co provides the effect of LLama-3-Dragonfly-Med install, users can directly use LLama-3-Dragonfly-Med installed effect in huggingface.co for debugging and trial. It also supports api for free installation.
LLama-3-Dragonfly-Med install url in huggingface.co: