Instructions to use microsoft/BiomedCLIP-PubMedBERT_256-vit_base_patch16_224 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- OpenCLIP
How to use microsoft/BiomedCLIP-PubMedBERT_256-vit_base_patch16_224 with OpenCLIP:
import open_clip model, preprocess_train, preprocess_val = open_clip.create_model_and_transforms('hf-hub:microsoft/BiomedCLIP-PubMedBERT_256-vit_base_patch16_224') tokenizer = open_clip.get_tokenizer('hf-hub:microsoft/BiomedCLIP-PubMedBERT_256-vit_base_patch16_224') - Notebooks
- Google Colab
- Kaggle
Using this in the diffusers library
#12
by kchoi - opened
Is there a way to use this text encoder as part of diffusers library if we want to generate an image?
I tried passing it as a tokenizer in StableDiffusionPipeline.from_pretrained("runwayml/stable-diffusion-v1-5", tokenizer=tokenizer) but it's expecting a tokenizer of type transformers.tokenization_utils.PreTrainedTokenizer instead of open_clip.tokenizer.HFTokenizer which is what i get if i load BiomedCLIP using tokenizer = open_clip.get_tokenizer('hf-hub:microsoft/BiomedCLIP-PubMedBERT_256-vit_base_patch16_224')
kchoi changed discussion title from Using this clip in diffusers library to Using this in the diffusers library