How to use from the
Use from the
Diffusers library
# Gated model: Login with a HF token with gated access permission
hf auth login
pip install -U diffusers transformers accelerate
import torch
from diffusers import DiffusionPipeline

# switch to "mps" for apple devices
pipe = DiffusionPipeline.from_pretrained("LexieK/COIN", dtype=torch.bfloat16, device_map="cuda")

prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k"
image = pipe(prompt).images[0]

You need to agree to share your contact information to access this model

This repository is publicly accessible, but you have to accept the conditions to access its files and content.

Log in or Sign Up to review the conditions and access this model content.

Model Card for COIN

What is COIN?

COIN (Cytology generative fOundatIoN model) is a controllable foundation model for cytology image generation, developed to address the long-standing challenges of data scarcity and privacy constraints in computational cytology.

COIN is trained on 112,226 cytology image–report pairs from 16 anatomical sites, enabling it to generate high-fidelity, text-controllable cytology images that preserve both morphological and diagnostic realism.

It supports a wide range of downstream applications, including AI model data augmentation, diagnostic model pretraining, and content-based image retrieval, making it the first foundation model to provide scalable synthetic data generation for cytopathology.

Usage

Install the conch repository using pip:


pip install git+https://github.com/LexieK7/COIN.git

After succesfully requesting access to the weights:


from diffusers import DiffusionPipeline
import torch
import os

sdxl_base_model = "./sd_xl_1-0"   
lora_model_path = "MODEL PATH"  
save_folder = "./generated_images"
prompt = "No intraepithelial lesion or malignancy (NILM)."
guidance_scale = 7.5
num_inference_steps = 50

pipe = DiffusionPipeline.from_pretrained(sdxl_base_model)
pipe.to("cuda")
pipe.load_lora_weights(lora_model_path)

save_path = os.path.join(save_folder, "example.jpg")
image = pipe(prompt, num_inference_steps=num_inference_steps, guidance_scale=guidance_scale).images[0]
image.save(save_path)

πŸ“„ Citation

If you find this work useful, please cite us:

@article{zheng2026generative,
  title={A Generative Foundation Model for Scalable Cytology Image Synthesis in AI-Powered Diagnostics},
  author={Zheng, Ke and Zheng, Xueyi and Wang, Jue and Zhang, Xinke and Chen, Shiping and Chen, Qunxi and Fu, Sha and Xie, Dan and Wang, Ruixuan and Lai, Junpeng and others},
  journal={Clinical Cancer Research},
  pages={OF1--OF12},
  year={2026},
  publisher={American Association for Cancer Research}
}
Downloads last month
2
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Model tree for LexieK/COIN

Finetuned
(1192)
this model