Instructions to use LexieK/COIN with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use LexieK/COIN with Diffusers:
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] - Notebooks
- Google Colab
- Kaggle
- Local Apps
- Draw Things
- DiffusionBee
| base_model: | |
| - stabilityai/stable-diffusion-xl-base-1.0 | |
| license: apache-2.0 | |
| language: | |
| - en | |
| tags: | |
| - cytology | |
| - pathology | |
| - medical-imaging | |
| - diffusion-model | |
| - image-generation | |
| - text-to-image | |
| library_name: diffusers | |
| pipeline_tag: text-to-image | |
| # 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} | |
| } | |
| ``` | |