Functions
FUNC make_config_dict
config_file: Path to a YAML configuration file. Exactly one ofconfig_fileandconfig_dictmust be provided.config_dict: Pre-parsed configuration dict (fromyaml.safe_load()). Exactly one ofconfig_fileandconfig_dictmust be provided.
- Validated configuration dict with optional fields set to
Noneand JSON - string fields parsed to Python objects.
ValueError: If both or neither ofconfig_fileandconfig_dictare provided, if a required field is missing, if an unexpected top-level field is encountered, or if a JSON field cannot be parsed.
FUNC obtain_lora
intrinsic_name: Short name of the intrinsic model, such as"certainty".target_model_name: Name of the base model for the LoRA or aLoRA adapter.repo_id: Hugging Face Hub repository containing a collection of LoRA and/or aLoRA adapters for intrinsics.revision: Git revision of the repository to download from.alora: IfTrue, load the aLoRA version of the intrinsic; otherwise use LoRA.cache_dir: Local directory to use as a cache (Hugging Face Hub format), orNoneto use the default location.file_glob: Only files matching this glob will be downloaded to the cache.
- Full path to the local copy of the specified (a)LoRA adapter, suitable for
- passing to commands that serve the adapter.
ValueError: If the specified intrinsic adapter cannot be found in the Hugging Face Hub repository at the expected path.
FUNC obtain_io_yaml
io.yaml configuration file for an intrinsic.
Downloads an io.yaml configuration file for an intrinsic
with a model repository that follows the format of the
Granite Intrinsics Library if one is not
already in the local cache.
Args:
intrinsic_name: Short name of the intrinsic model, such as"certainty".target_model_name: Name of the base model for the LoRA or aLoRA adapter.repo_id: Hugging Face Hub repository containing a collection of LoRA and/or aLoRA adapters for intrinsics.revision: Git revision of the repository to download from.alora: IfTrue, load the aLoRA version of the intrinsic; otherwise use LoRA.cache_dir: Local directory to use as a cache (Hugging Face Hub format), orNoneto use the default location.
- Full path to the local copy of the
io.yamlfile, suitable for passing to IntrinsicsRewriter.