Instructions to use xjc1022/MELP-Encoder-repro with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use xjc1022/MELP-Encoder-repro with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("feature-extraction", model="xjc1022/MELP-Encoder-repro", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("xjc1022/MELP-Encoder-repro", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
Download configuration_MELP_Encoder.py from xjc1022/MELP-Encoder-repro: direct link, hf CLI and curl.
- Browser
- Download file 1.22 kB
-
https://huggingface.co/xjc1022/MELP-Encoder-repro/resolve/main/configuration_MELP_Encoder.py
- Command line
-
hf download hf://xjc1022/MELP-Encoder-repro/configuration_MELP_Encoder.py
-
curl -L -o configuration_MELP_Encoder.py https://huggingface.co/xjc1022/MELP-Encoder-repro/resolve/main/configuration_MELP_Encoder.py
1.22 kB
| from transformers import PretrainedConfig | |
| class MELPEncoderConfig(PretrainedConfig): | |
| model_type = "melp" | |
| def __init__( | |
| self, | |
| model_size: str = "small", # small by default | |
| shared_emb_dim: int = 256, | |
| embed_dim_caption: int = 768, | |
| use_attentional_pool_contrast: bool = True, | |
| use_attentional_pool_caption: bool = True, | |
| n_queries_contrast: int = 14, | |
| n_queries_caption: int = 128, | |
| attn_pooler_heads: int = 8, | |
| proj: str = "linear", | |
| drop: float = 0., | |
| proj_bias: bool = False, | |
| num_leads: int = 12, | |
| **kwargs | |
| ): | |
| self.model_size = model_size | |
| self.shared_emb_dim = shared_emb_dim | |
| self.embed_dim_caption = embed_dim_caption | |
| self.use_attentional_pool_contrast = use_attentional_pool_contrast | |
| self.use_attentional_pool_caption = use_attentional_pool_caption | |
| self.n_queries_contrast = n_queries_contrast | |
| self.n_queries_caption = n_queries_caption | |
| self.attn_pooler_heads = attn_pooler_heads | |
| self.proj = proj | |
| self.drop = drop | |
| self.proj_bias = proj_bias | |
| self.num_leads = num_leads | |
| super().__init__(**kwargs) | |