File size: 547 Bytes
2ea9ced |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# pylint: disable=abstract-method
from typing import * # pylint: disable=wildcard-import,unused-wildcard-import
import os
from .batch import BatchedLMScorer
class TransformersLMScorer(BatchedLMScorer):
# @overrides
def _build(self, model_name: str, options: Dict[str, Any]) -> None:
super()._build(model_name, options)
# Make transformers cache path configurable.
cache_dir = os.environ.get("TRANSFORMERS_CACHE_DIR", ".transformers_cache")
options["cache_dir"] = options.get("cache_dir", cache_dir)
|