Instructions to use mobilint/bert-base-uncased with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use mobilint/bert-base-uncased with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("fill-mask", model="mobilint/bert-base-uncased", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("mobilint/bert-base-uncased", trust_remote_code=True, device_map="auto") - Mobilint
How to use mobilint/bert-base-uncased with Mobilint:
# pip install mblt-model-zoo from mblt_model_zoo.vision import MBLT_Engine model = MBLT_Engine( model_cls="bert-base-uncased", model_type="DEFAULT", model_path="", core_mode="global8", ) try: image = model.preprocess("path/to/image.jpg") output = model(image) result = model.postprocess(output) finally: model.dispose() - Notebooks
- Google Colab
- Kaggle
Download proxy_bert.py from mobilint/bert-base-uncased: direct link, hf CLI and curl.
- Browser
- Download file 1.06 kB
-
https://huggingface.co/mobilint/bert-base-uncased/resolve/main/proxy_bert.py
- Command line
-
hf download hf://mobilint/bert-base-uncased/proxy_bert.py
-
curl -L -o proxy_bert.py https://huggingface.co/mobilint/bert-base-uncased/resolve/main/proxy_bert.py
1.06 kB
| try: | |
| from transformers_mblt.models.bert.configuration_bert import ( | |
| MobilintBertConfig, | |
| ) | |
| from transformers_mblt.models.bert.modeling_bert import ( | |
| MobilintBertForMaskedLM, | |
| ) | |
| except ModuleNotFoundError as exc: | |
| if exc.name != "transformers_mblt": | |
| raise | |
| # Hub repositories are shared with mblt-model-zoo, which exposes the same classes under its legacy path. | |
| try: | |
| from mblt_model_zoo.hf_transformers.models.bert.configuration_bert import ( | |
| MobilintBertConfig, | |
| ) | |
| from mblt_model_zoo.hf_transformers.models.bert.modeling_bert import ( | |
| MobilintBertForMaskedLM, | |
| ) | |
| except ModuleNotFoundError as legacy_exc: | |
| if legacy_exc.name not in {"mblt_model_zoo", "mblt_model_zoo.hf_transformers"}: | |
| raise | |
| raise ImportError( | |
| "This model requires 'transformers-mblt' to be installed. " | |
| "Please run: pip install transformers-mblt" | |
| ) from legacy_exc | |
| __all__ = ["MobilintBertConfig", "MobilintBertForMaskedLM"] |