Instructions to use mrinaldi/albertina_M12.json with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use mrinaldi/albertina_M12.json with Transformers:
# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("mrinaldi/albertina_M12.json", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
| # modeling_matformer.py | |
| import os | |
| import sys | |
| matformer_root = os.getenv("MATFORMER_ROOT") | |
| if matformer_root: | |
| matformer_root = os.path.abspath(os.path.expanduser(matformer_root)) | |
| if matformer_root not in sys.path: | |
| sys.path.insert(0, matformer_root) | |
| try: | |
| from matformer.huggingface_integration import ( | |
| MatformerForCausalLM, | |
| MatformerForMaskedLM, | |
| MatformerForSequenceClassification, | |
| MatformerModel, | |
| MatformerConfig, | |
| register_matformer | |
| ) | |
| register_matformer() | |
| except ImportError as e: | |
| import subprocess | |
| import tempfile | |
| print("Installing Matformer from GitHub...") | |
| try: | |
| subprocess.check_call([ | |
| sys.executable, "-m", "pip", "install", | |
| "git+https://github.com/mrinaldi97/matformer.git" | |
| ]) | |
| from matformer.huggingface_integration import ( | |
| MatformerForCausalLM, | |
| MatformerForMaskedLM, | |
| MatformerForSequenceClassification, | |
| MatformerModel, | |
| MatformerConfig, | |
| register_matformer | |
| ) | |
| register_matformer() | |
| except Exception as install_error: | |
| raise ImportError( | |
| "Failed to install Matformer. Install manually:\n" | |
| " pip install git+https://github.com/mrinaldi97/matformer.git\n" | |
| "Or set MATFORMER_ROOT environment variable" | |
| ) from install_error | |