Token Classification
Transformers
ONNX
Safetensors
English
ultrabert
information-extraction
extractive-qa
ner
span-extraction
tasksource
custom_code
Instructions to use tasksource/UltraBERT-150M-clairic-extraction with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use tasksource/UltraBERT-150M-clairic-extraction with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("token-classification", model="tasksource/UltraBERT-150M-clairic-extraction", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForTokenClassification tokenizer = AutoTokenizer.from_pretrained("tasksource/UltraBERT-150M-clairic-extraction", trust_remote_code=True) model = AutoModelForTokenClassification.from_pretrained("tasksource/UltraBERT-150M-clairic-extraction", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
Download configuration_ultrabert.py from tasksource/UltraBERT-150M-clairic-extraction: direct link, hf CLI and curl.
- Browser
- Download file 2.21 kB
-
https://huggingface.co/tasksource/UltraBERT-150M-clairic-extraction/resolve/main/configuration_ultrabert.py
- Command line
-
hf download hf://tasksource/UltraBERT-150M-clairic-extraction/configuration_ultrabert.py
-
curl -L -o configuration_ultrabert.py https://huggingface.co/tasksource/UltraBERT-150M-clairic-extraction/resolve/main/configuration_ultrabert.py
2.21 kB
| from __future__ import annotations | |
| from collections.abc import Iterable | |
| from transformers.configuration_utils import PretrainedConfig | |
| class UltrabertConfig(PretrainedConfig): | |
| model_type = "ultrabert" | |
| def __init__( | |
| self, | |
| vocab_size=32000, | |
| hidden_size=4096, | |
| intermediate_size=11008, | |
| prediction_head_size=None, | |
| num_hidden_layers=32, | |
| num_attention_heads=32, | |
| num_key_value_heads=None, | |
| attention_windows=None, | |
| hidden_act="silu", | |
| initializer_range=0.02, | |
| rms_norm_eps=1e-6, | |
| pad_token_id=0, | |
| bos_token_id=0, | |
| eos_token_id=0, | |
| tie_word_embeddings=False, | |
| rope_theta=10000.0, | |
| attention_bias=False, | |
| attention_dropout=0.0, | |
| mlp_bias=False, | |
| head_dim=None, | |
| classifier_dropout=0.0, | |
| **kwargs, | |
| ): | |
| super().__init__( | |
| pad_token_id=pad_token_id, | |
| bos_token_id=bos_token_id, | |
| eos_token_id=eos_token_id, | |
| tie_word_embeddings=tie_word_embeddings, | |
| **kwargs, | |
| ) | |
| self.vocab_size = vocab_size | |
| self.hidden_size = hidden_size | |
| self.intermediate_size = intermediate_size | |
| self.prediction_head_size = prediction_head_size | |
| self.num_hidden_layers = num_hidden_layers | |
| self.num_attention_heads = num_attention_heads | |
| self.num_key_value_heads = num_key_value_heads or num_attention_heads | |
| self.attention_windows = ( | |
| attention_windows | |
| if isinstance(attention_windows, Iterable) | |
| else [attention_windows] * num_hidden_layers | |
| ) | |
| self.hidden_act = hidden_act | |
| self.initializer_range = initializer_range | |
| self.rms_norm_eps = rms_norm_eps | |
| self.rope_theta = ( | |
| rope_theta | |
| if isinstance(rope_theta, Iterable) | |
| else [rope_theta] * num_hidden_layers | |
| ) | |
| self.attention_bias = attention_bias | |
| self.attention_dropout = attention_dropout | |
| self.mlp_bias = mlp_bias | |
| self.head_dim = head_dim or self.hidden_size // self.num_attention_heads | |
| self.classifier_dropout = classifier_dropout | |