1aurent/PatchCamelyon
Preview • Updated • 4.86k • 12
How to use lens-ai/clip-vit-base-patch32_pcam_finetuned with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("feature-extraction", model="lens-ai/clip-vit-base-patch32_pcam_finetuned") # Load model directly
from transformers import AutoTokenizer, AutoModel
tokenizer = AutoTokenizer.from_pretrained("lens-ai/clip-vit-base-patch32_pcam_finetuned")
model = AutoModel.from_pretrained("lens-ai/clip-vit-base-patch32_pcam_finetuned")This repository contains a fine-tuned version of the CLIP ViT Base Patch32 model on the PatchCamelyon (PCAM) dataset. The model is optimized for histopathological image classification.
openai/clip-vit-base-patch32PatchCamelyonEnsure you have transformers, torch, and safetensors installed:
pip install transformers torch safetensors
from transformers import CLIPProcessor, CLIPModel
import torch
model_path = "lens-ai/clip-vit-base-patch32_pcam_finetuned"
model = CLIPModel.from_pretrained(model_path)
processor = CLIPProcessor.from_pretrained(model_path)
from PIL import Image
image = Image.open("sample_image.png")
inputs = processor(images=image, return_tensors="pt")
outputs = model.get_image_features(**inputs)
We plan to release additional metrics, including robustness evaluation with adversarial attacks in future updates.
This model is released under the MIT License.
For any questions, please reach out to Venkata Tej at LensAI.