Recommends config to use for model tuning.
Project description
Tuning Config Recommender
⚡️ Supercharge your fine-tuning users with completely automated tuning configurations for their choice of model, and dataset enabling instant one-click tuning deployment 🚀.
Installation
pip install -e .
or from PyPI
pip install tuning_config_recommender
Library Usage
An example is given in lib_usage.py file which generates tuning configuration for fms-hf-tuning stack given model ibm-granite/granite-4.0-h-350m and dataset with HF ID ought/raft.
python lib_usage.py
CLI usage
python src/tuning_config_recommender/cli.py --tuning-data-config ./artifacts/test/tuning_tuning_data_config.yaml --accelerate-config ./artifacts/test/accelerate_config.yaml --tuning-config ./artifacts/test/tuning_config.yaml --compute-config ./artifacts/test/compute_config.yaml --output-dir ./output
or using the package
python tuning_config_recommender.cli --tuning-data-config ./artifacts/test/tuning_tuning_data_config.yaml --accelerate-config ./artifacts/test/accelerate_config.yaml --tuning-config ./artifacts/test/tuning_config.yaml --compute-config ./artifacts/test/compute_config.yaml --output-dir ./output
Custom rules-dir usage
python src/tuning_config_recommender/cli.py --tuning-data-config ./artifacts/test/tuning_data_config.yaml --accelerate-config ./artifacts/test/accelerate_config.yaml --tuning-config ./artifacts/test/tuning_config.yaml --compute-config ./artifacts/test/compute_config.yaml --output-dir ./output --rules-dir custom_rules_dir
or using the package as
python tuning_config_recommender.cli --tuning-data-config ./artifacts/test/tuning_data_config.yaml --accelerate-config ./artifacts/test/accelerate_config.yaml --tuning-config ./artifacts/test/tuning_config.yaml --compute-config ./artifacts/test/compute_config.yaml --output-dir ./output --rules-dir custom_rules_dir
Writing custom action rules for custom modification would require following the below
- Should start with name "Custom_"
- Should subclass from
Actionclass
An example can be found at custom_rules_dir.
API Usage
After installing it as a module you can start an API as
uvicorn tuning_config_recommender.api:app --reload
/docs endpoint provides details on the endpoint to make requests.
Architecture
Concepts
Intermediate Representation (IR)
IR is the standard format that all input formats have to be converted to so that rule engine can work on the IR without worrying about the exact input or output formats which could differ from one stack to another. There is a caveat with IR, not all arguments in the IR are strictly defined in the sense that the actions currently written may add some new arguments and IR or rule engine are restrictive about it. Its up to do the adapter if it wishes to consume it or not for the target format.
Action
An action takes IR as input at its current state and performs some heuristics and constructs a new IR object which is used as a JSON Merge patch by the rule-engine. Addtionally, the returned new IR object can also hold various information about the patch such as severity, type and natural language comments. As shown in the architecture, an action would be called multiple times by the rule engine until it explicitly calls out skip. When to skip is the responsibility of the action which could be a heuristic based on the state of the IR when its called. Some example actions can be seen here.
Rule Engine
Rule engine passes the IR across actions in the sequence they are defined and collects all JSON merge patches. These JSON merge patches are then applied over the IR. This process is again iterated until all actions call out for a skip. Finally, JSON patches (is different from the merge patch) with respect to the orginal IR provided to the rule engine is prepared while preserving all the metadata (comments etc) for each of the patch along with the final IR to adapters.
Adapter
Adapter converts source format to required IR format and consumes final IR and json patches as needed to deliver the target format. Adapters can be found here.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tuning_config_recommender-0.1.7-py3-none-any.whl.
File metadata
- Download URL: tuning_config_recommender-0.1.7-py3-none-any.whl
- Upload date:
- Size: 73.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
238ffeb43dacb3246578cf3ab3caec9f3f23f2bbe77a90de1c8eac2ec68e6a05
|
|
| MD5 |
ff3f91dd7603f1f44810f54debbcbf37
|
|
| BLAKE2b-256 |
e89cca196061b8e131cf47aca902318aa22e5b5ddd9a9986087cdee916621a22
|
Provenance
The following attestation bundles were made for tuning_config_recommender-0.1.7-py3-none-any.whl:
Publisher:
publish.yml on foundation-model-stack/tuning-config-recommender
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tuning_config_recommender-0.1.7-py3-none-any.whl -
Subject digest:
238ffeb43dacb3246578cf3ab3caec9f3f23f2bbe77a90de1c8eac2ec68e6a05 - Sigstore transparency entry: 869301218
- Sigstore integration time:
-
Permalink:
foundation-model-stack/tuning-config-recommender@ee3391eb81f7feaf26af775d4cd3b253aaefbd3a -
Branch / Tag:
refs/tags/v0.1.7 - Owner: https://github.com/foundation-model-stack
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ee3391eb81f7feaf26af775d4cd3b253aaefbd3a -
Trigger Event:
release
-
Statement type: