Instructions to use hbin0701/opsd-lora with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use hbin0701/opsd-lora with PEFT:
Task type is invalid.
- Notebooks
- Google Colab
- Kaggle
File size: 1,166 Bytes
b6d5136 | 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 27 28 29 30 31 32 | """Variant registry. `load("p1_surgical")` returns that folder's TeacherVariant
instance; `available()` lists the folders. No variant name is hardcoded anywhere —
a folder with a utils.py exporting `VARIANT` is automatically discoverable."""
import importlib.util
import importlib # noqa: F401 (original re-exported both)
import os
import sys
from agents.variants.base import TeacherVariant # noqa: F401 (re-exported for convenience)
_DIR = os.path.dirname(__file__)
def available():
"""Variant folder names (any subdir with a utils.py)."""
return sorted(
d for d in os.listdir(_DIR)
if os.path.exists(os.path.join(_DIR, d, "utils.py"))
)
def load(name):
"""Import agents/variants/<name>/utils.py and return its VARIANT() instance."""
path = os.path.join(_DIR, name, "utils.py")
if not os.path.exists(path):
raise ValueError(f"unknown variant {name}; available: {available()}")
spec = importlib.util.spec_from_file_location(f"agents.variants.{name}.utils", path)
mod = importlib.util.module_from_spec(spec)
sys.modules[spec.name] = mod
spec.loader.exec_module(mod)
return mod.VARIANT()
|