File size: 787 Bytes
3e011ce |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
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.modelling_matformer import (
MatformerForCausalLM,
MatformerForSequenceClassification,
MatformerModel,
MatformerConfig,
register_matformer
)
register_matformer()
except ImportError as e:
raise ImportError(
"To use this model, please install the Matformer library: "
"`pip install matformer`\\n"
"Alternatively, set the `MATFORMER_ROOT` environment variable to a local clone:\\n"
" export MATFORMER_ROOT=/path/to/matformer"
) from e |