Feature Extraction
Transformers
Safetensors
Thai
English
clip_text_camembert
openthaigpt
custom_code
Instructions to use openthaigpt/CLIPTextCamembertModelWithProjection with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use openthaigpt/CLIPTextCamembertModelWithProjection with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("feature-extraction", model="openthaigpt/CLIPTextCamembertModelWithProjection", trust_remote_code=True)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("openthaigpt/CLIPTextCamembertModelWithProjection", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
| from transformers import CamembertConfig | |
| class CLIPTextCamembertConfig(CamembertConfig): | |
| # ref : https://huggingface.co/airesearch/wangchanberta-base-att-spm-uncased/blob/main/config.json | |
| model_type = "clip_text_camembert" | |
| def __init__( | |
| self, | |
| vocab_size=25005, | |
| hidden_size=768, | |
| intermediate_size=3072, | |
| projection_dim=512, | |
| num_hidden_layers=12, | |
| num_attention_heads=12, | |
| max_position_embeddings=512, | |
| hidden_act="gelu", | |
| layer_norm_eps=1e-12, | |
| attention_dropout=0.1, | |
| initializer_range=0.02, | |
| initializer_factor=1.0, | |
| pad_token_id=1, | |
| bos_token_id=0, | |
| eos_token_id=2, | |
| type_vocab_size=1, | |
| **kwargs, | |
| ): | |
| super().__init__( | |
| pad_token_id=pad_token_id, | |
| bos_token_id=bos_token_id, | |
| eos_token_id=eos_token_id, | |
| **kwargs, | |
| ) | |
| self.vocab_size = vocab_size | |
| self.hidden_size = hidden_size | |
| self.intermediate_size = intermediate_size | |
| self.projection_dim = projection_dim | |
| self.num_hidden_layers = num_hidden_layers | |
| self.num_attention_heads = num_attention_heads | |
| self.max_position_embeddings = max_position_embeddings | |
| self.layer_norm_eps = layer_norm_eps | |
| self.hidden_act = hidden_act | |
| self.initializer_range = initializer_range | |
| self.initializer_factor = initializer_factor | |
| self.attention_dropout = attention_dropout | |
| self.type_vocab_size = type_vocab_size | |
| self.auto_map = { | |
| "AutoConfig": "configuration_clip_camembert.CLIPTextCamembertConfig", | |
| "AutoModel": "modeling_clip_camembert.CLIPTextCamembertModelWithProjection", | |
| } | |