Download inference/_compat.py from mwei/WeMM-JEV: direct link, hf CLI and curl.
- Browser
- Download file 1.32 kB
-
https://huggingface.co/mwei/WeMM-JEV/resolve/main/inference/_compat.py
- Command line
-
hf download hf://mwei/WeMM-JEV/inference/_compat.py
-
curl -L -o _compat.py https://huggingface.co/mwei/WeMM-JEV/resolve/main/inference/_compat.py
1.32 kB
| """Optional Decision Index integration.""" | |
| try: | |
| from decision_index.engines.base import Engine, NativeAbstention, Unsupported | |
| except ModuleNotFoundError as exc: | |
| if exc.name not in ("decision_index", "decision_index.engines", "decision_index.engines.base"): | |
| raise | |
| class Unsupported(ValueError): | |
| pass | |
| class NativeAbstention(Exception): | |
| def __init__(self, raw): | |
| self.raw = raw | |
| super().__init__("Native model selected its additional abstention outcome") | |
| class Engine: | |
| name = "engine" | |
| provenance = {} | |
| latency = "In-process request wall time including prompt construction; excludes model loading." | |
| def __init__(self, **options): | |
| self.options = options | |
| def __call__(self, state, questions): | |
| raise NotImplementedError | |
| def warmup(self): | |
| warm = {"warmup": {"type": "choice", "instructions": "Which color is named?", "criteria": {"red": "red", "blue": "blue"}}} | |
| for _ in range(2): | |
| try: | |
| self("The color is red.", warm) | |
| except NativeAbstention: | |
| pass | |
| def runtime(self): | |
| return {} | |
| def synchronize(self): | |
| pass | |
| def close(self): | |
| pass | |