Instructions to use jun47/llava-7b-skin with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use jun47/llava-7b-skin with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("llava-hf/llava-1.5-7b-hf") model = PeftModel.from_pretrained(base_model, "jun47/llava-7b-skin") - Transformers
How to use jun47/llava-7b-skin with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="jun47/llava-7b-skin") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("jun47/llava-7b-skin", dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use jun47/llava-7b-skin with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "jun47/llava-7b-skin" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "jun47/llava-7b-skin", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/jun47/llava-7b-skin
- SGLang
How to use jun47/llava-7b-skin 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 "jun47/llava-7b-skin" \ --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": "jun47/llava-7b-skin", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "jun47/llava-7b-skin" \ --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": "jun47/llava-7b-skin", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use jun47/llava-7b-skin with Docker Model Runner:
docker model run hf.co/jun47/llava-7b-skin
LLaVA-1.5-7B Skin Disease Fine-tuned Model (LoRA)
Model Description
μ΄ λͺ¨λΈμ llava-hf/llava-1.5-7b-hf λ² μ΄μ€ λͺ¨λΈμ κΈ°λ°μΌλ‘ νμΈνλλ LoRA μ΄λν°μ
λλ€. μλ©΄ νΌλΆ μ§νμ μ§λ¨νκ³ , κ΄λ ¨ μΌμ΄ κ°μ΄λλ₯Ό μ 곡νλ λ° νΉνλμ΄ μμ΅λλ€. κΈ°μ‘΄ λ²μ© λͺ¨λΈμ΄ λμμΈ(νκ΅μΈ) νΌλΆ μμ λ°μ΄ν° νμ΅μ΄ λΆμ‘±ν΄ λ°μνλ μ€μ§μ¨κ³Ό ν 루μλ€μ΄μ
(μμ μ²λ°©)μ ν΄κ²°νκ³ μ κ°λ°λμμ΅λλ€.
- Base Model:
llava-hf/llava-1.5-7b-hf - Finetuning Method: 8-bit QLoRA & SFT
- Primary Use Case: μλ©΄ νΌλΆ μ§ν μΆλ‘ λ° λ€μ€ ν΄(Multi-turn) μ§μμλ΅ (μκ° μ§λ¨ μ±λ΄)
Training Details
- Training Data: AI Hubμ 'μλ©΄λΆ νΌλΆμ§ν μ΄λ―Έμ§ ν©μ± λ°μ΄ν°' 9,600μ₯μ κΈ°λ°μΌλ‘, μ΄λ―Έμ§ λΉ 4κ°μ λ¨μΌ ν΄ μ§μμλ΅μ νλμ λν μΈμ μΌλ‘ λ¬Άλ λ©ν°ν΄ μΈμ 체μ΄λ(Multi-turn Session Chaining) κΈ°λ²μ μ μ©νμ¬ 38,400 Turn λνμ (QAμ)μΌλ‘ κ°κ³΅νμ΅λλ€.
- Results: νΌλΆ μ§ν μ§λ¨ Accuracy μ½ 60% ν₯μ (0.093 β 0.148), Macro F1-Score μ½ 65% ν₯μ (0.126 β 0.208). λ°λ³΅ μμ± λ£¨ν(Repetition Loop) λ²κ·Έλ₯Ό λ°μ΄ν° μ μ²λ¦¬ λ 벨μμ μμ² ν΄κ²°νμ΅λλ€.
π Multi-turn Chaining νΉμ±
λ³Έ λͺ¨λΈμ μ΄λ―Έμ§ 1μ₯λΉ 4κ°μ μ°μμ μΈ μ§μμλ΅(QA)μ νλμ λν μΈμ μΌλ‘ λ¬Άλ λ©ν°ν΄ μΈμ 체μ΄λ(Multi-turn Session Chaining) κΈ°λ²μΌλ‘ νλ ¨λμμ΅λλ€.
[νμ΅ λ°μ΄ν°μ μμ]
USER: <image>\nWhat skin disease is visible in this image?
ASSISTANT: Psoriasis
USER: What part of the body is this image of?
ASSISTANT: Face
USER: What symptoms are visible in this image?
ASSISTANT: itching
USER: Describe this disease.
ASSISTANT: An inflammatory skin condition that presents as red papules or plaques covered with scales.
β οΈ μΆλ‘ μ μ£Όμμ¬ν (Repetition Behavior)
λͺ¨λΈμ΄ μμ κ°μ 'λ©ν°ν΄ νλ¦'μ μλ²½νκ² μ μ(κ³Όμ ν©)λμ΄ μμΌλ―λ‘, λ¨μν 1κ°μ μ§λ¬Έλ§ λμ Έλ λͺ¨λΈ μ€μ€λ‘ λ€μ μ§λ¬Έ(USER:)μ μμνμ¬ μ 체 λλ³Έμ λκΉμ§ μΆλ ₯νλ €λ νΉμ§μ 보μ
λλ€.
λ°λΌμ μΆλ‘ μμλ νμ΄μ¬ μ½λλ₯Ό ν΅ν΄ λ¬Έμμ΄μ μ μ ν μ¬λΌμ΄μ±(Slicing)νμ¬ μνλ λ΅λ³λ§ μΆμΆνλ νμ²λ¦¬(Post-processing)κ° νμν©λλ€.
π How to Get Started
1. Requirements (λΌμ΄λΈλ¬λ¦¬ λ²μ )
μ΅μ peft λΌμ΄λΈλ¬λ¦¬μ μ΄λν° λ‘λ νΈνμ±μ μν΄ μλ λΌμ΄λΈλ¬λ¦¬λ€μ λ²μ μ΄ νμν©λλ€. (νΉν torchao >= 0.16.0 νμ)
pip install -U transformers peft accelerate bitsandbytes requests Pillow "torchao>=0.16.0"
2. λͺ¨λΈ λ° μ΄λν° λ‘λ (Model Loading)
λͺ¨λΈμ 8-bit QLoRAλ‘ νλλμμΌλ―λ‘, λ°μ΄ν° νμ μΆ©λμ λ°©μ§νκΈ° μν΄ λ² μ΄μ€ λͺ¨λΈμ 8-bitλ‘ λ‘λν΄μΌ ν©λλ€.
from transformers import AutoProcessor, LlavaForConditionalGeneration, BitsAndBytesConfig
from peft import PeftModel
import torch
# 8-bit μμν μ€μ
quantization_config = BitsAndBytesConfig(
load_in_8bit=True,
llm_int8_threshold=200.0,
llm_int8_skip_modules=["lm_head", "vision_tower", "multi_modal_projector"]
)
# Base Model λ‘λ
base_model_id = "llava-hf/llava-1.5-7b-hf"
base_model = LlavaForConditionalGeneration.from_pretrained(
base_model_id,
quantization_config=quantization_config,
device_map="auto"
)
# νμΈνλλ LoRA Adapter λ‘λ (κ²½κ³ λ°©μ§ μ΅μ
μΆκ°)
adapter_id = "jun47/llava-7b-skin"
model = PeftModel.from_pretrained(base_model, adapter_id, ensure_weight_tying=True)
# Processor λ‘λ (컀μ€ν
ν
νλ¦Ώ 보쑴μ μν΄ μ΄λν° κ²½λ‘μμ λ‘λ)
processor = AutoProcessor.from_pretrained(adapter_id)
3. ν μ€νΈ μΆλ‘ λ° νμ± (Inference & Parsing)
νμ΅ λ°μ΄ν°μ νΉμ±μ μ΄λ € μμ΄ ν둬ννΈλ₯Ό μ¬μ©ν΄μΌ κ°μ₯ μ νν μ§λ¨μ μ»μ μ μμ΅λλ€.
from PIL import Image
import requests
# ν
μ€νΈ μ΄λ―Έμ§ λ‘λ
image_url = "https://example.com/your_skin_image.jpg"
image = Image.open(requests.get(image_url, stream=True).raw)
# 첫 λ²μ§Έ μ§λ¬Έ ν둬ννΈ
prompt = "USER: <image>\nWhat skin disease is visible in this image?\nASSISTANT:"
inputs = processor(text=prompt, images=image, return_tensors="pt").to("cuda")
# ν
μ€νΈ μμ± (λͺ¨λΈμ΄ μ 체 λνλ₯Ό μμ±νλλ‘ λλν ν ν° λΆμ¬)
outputs = model.generate(**inputs, max_new_tokens=200, temperature=0.2, do_sample=True)
input_length = inputs["input_ids"].shape[1]
raw_full_text = processor.decode(outputs[0][input_length:], skip_special_tokens=True)
λ°©λ² 1: μ§λ¨λͺ λ§ κΉλνκ² μΆμΆνκΈ°
λͺ¨λΈμ΄ λ€μ μ§λ¬Έ(USER:)μ μμν΄λ΄κΈ° μ κΉμ§λ§ ν
μ€νΈλ₯Ό μλ¦
λλ€.
diagnosis = raw_full_text.split("USER:")[0].strip()
print("==== AI μ§λ¨ κ²°κ³Ό ====")
print(f"μ§λ¨λͺ
: {diagnosis}")
# μΆλ ₯ μμ: Rosacea
λ°©λ² 2: λͺ¨λΈμ λ©ν°ν΄ νμ΅ νΉμ±μ μμ΄μ©νμ¬ μ§λ¨λͺ + μμΈ μ€λͺ ν λ²μ μΆμΆνκΈ°
λͺ¨λΈμ΄ μ€μ€λ‘ μμ±ν μ 체 4ν΄ λν(νκ°) μ€ν¬λ¦½νΈ μμμ μ κ·μ νμ±μ ν΅ν΄ μ§λ¨λͺ κ³Ό μ΅μ’ μ€λͺ μ λͺ¨λ λμμ±λ μ΅μ ν λ°©μμ λλ€.
# 1. μ§λ¨λͺ
μΆμΆ
diagnosis = raw_full_text.split("USER:")[0].strip()
# 2. μ¦μ μ€λͺ
μΆμΆ ('Describe this disease' μ΄νμ λ΅λ³λ§ κ°μ Έμ΄)
try:
description = raw_full_text.split("Describe this disease. ASSISTANT:")[-1].split("USER:")[0].strip()
except Exception:
description = "μμΈ μ€λͺ
μ μΆμΆν μ μμ΅λλ€."
print("==== AI λ³΅ν© μ§λ¨ κ²°κ³Ό ====")
print(f"μ§λ¨λͺ
: {diagnosis}")
print(f"μμΈ μ€λͺ
: {description}")
- Downloads last month
- 60
Model tree for jun47/llava-7b-skin
Base model
llava-hf/llava-1.5-7b-hf