Downloads · 30 days
9
24% of all-time downloads
Mark-CHAE/ViTCM-LLM
ViTCM-LLM is a visual question answering model from Mark-CHAE. Use it for the visual question answering task on the model card, and read the license before you ship it in a product. It is set up for peft. The card lists the license as apache-2.0.
This is a LoRA (Low-Rank Adaptation) adapter for the Qwen2.5-VL-32B-Instruct model, fine-tuned specifically for Traditional Chinese Medicine (TCM) tongue diagnosis tasks.
Downloads · 30 days
9
24% of all-time downloads
All-time downloads
37
Public
Repo size
11.4 MB
Likes
0
Public
Click a slice to open those files.
.json14.2 MB · 89%
From the Hugging Face model README
This is a LoRA (Low-Rank Adaptation) adapter for the Qwen2.5-VL-32B-Instruct model, fine-tuned specifically for Traditional Chinese Medicine (TCM) tongue diagnosis tasks.
This LoRA adapter can be used with the base Qwen2.5-VL-32B-Instruct model for multimodal vision-language tasks including:
The adapter can be loaded with the base model for inference or further fine-tuning on specific TCM diagnosis tasks.
You can try the model directly in the browser using the Visual Question Answering widget above. Simply upload a tongue image and ask a question about it.
from peft import PeftModel
from transformers import AutoTokenizer, AutoModelForCausalLM, AutoProcessor
import torch
from PIL import Image
# Load base model and tokenizer
base_model = AutoModelForCausalLM.from_pretrained(
"Qwen/Qwen2.5-VL-32B-Instruct",
torch_dtype=torch.float16,
device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen2.5-VL-32B-Instruct")
processor = AutoProcessor.from_pretrained("Qwen/Qwen2.5-VL-32B-Instruct")
# Load LoRA adapter
model = PeftModel.from_pretrained(base_model, "Mark-CHAE/ViTCM-LLM")
# Prepare inputs
image = Image.open("tongue_image.jpg")
question = "根据图片判断舌诊内容"
prompt = f"<|im_start|>user\n<image>\n{question}<|im_end|>\n<|im_start|>assistant\n"
inputs = processor(
text=prompt,
images=image,
return_tensors="pt"
)
# Generate response
with torch.no_grad():
outputs = model.generate(
**inputs,
max_length=512,
temperature=0.7,
top_p=0.9,
do_sample=True,
pad_token_id=tokenizer.eos_token_id
)
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
answer = response.split("<|im_start|>assistant")[-1].strip()
print(answer)
APA:
Mark-CHAE. (2024). ViTCM_LLM: Traditional Chinese Medicine Tongue Diagnosis Model. Hugging Face. https://huggingface.co/Mark-CHAE/shezhen
For questions about this model, please contact the model author.