An extension for using Hugging Face tasks to parse models for AIConfig.
Project description
This extension contains AIConfig model parsers with two main subfolders:
local_inference
: Loads models onto your machine and uses Hugging Face transformers and diffusors locally.remote_inference_client
: Uses Hugging Face's InferenceClient API to connect to models remotely
Usage
Part 1: Update and test this extension
If you are not testing and developing locally (just using the published extension), ignore this and go to Part 2
- From the
aiconfig/extensions/HuggingFace
, run this command:pip3 install build && cd python && python -m build && pip3 install dist/*.whl
- Link your local dev environment to the current dir:
pip3 install -e .
. Afterwards if you dopip3 list | grep aiconfig
, you should see this linked to your local path. If you ever wish to use the published extension, you will need to first remove the extension:pip3 uninstall aiconfig-extension-hugging-face && pip3 install aiconfig-extension-hugging-face
- After you're done testing, be sure to delete the generated folder(s) in the
aiconfig/HuggingFace
dir. It'll probably look something likepython/dist
andpython/<package_name>.egg-info
Part 2: Importing and using this extension
pip3 install aiconfig-extension-hugging-face
- Import the library to your code:
from aiconfig_extension_hugging_face import <EXTENSION>
. - Import the AIConfig model registery:
from aiconfig import ModelRegistryParser
- In code, add all the relevant model parser objects that you want to use from this extension to the registry. Ex:
ModelParserRegistry.register_model_parser(HuggingFaceTextGenerationTransformer())
. You can read the docstrings underModelParserRegistry
class for more info - In your AIConfig, add a field
model_parsers
with the model you want to use and the id of the extension you want to use: . Ex: https://github.com/lastmile-ai/aiconfig/blob/f1840995b7a12acba371a59ac3b8c69b3962fc68/cookbooks/Getting-Started/travel.aiconfig.json#L19-L22 - Now whenever you call
aiconfig.run()
these model parsers will be loaded and available!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file aiconfig_extension_hugging_face-0.0.11.tar.gz
.
File metadata
- Download URL: aiconfig_extension_hugging_face-0.0.11.tar.gz
- Upload date:
- Size: 24.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e33cc17fcb738efc88d301d98a93707657b55362a8cb2f872f5e3436e4df06af |
|
MD5 | 6d226679b53319e13fa30cd51cb0e04d |
|
BLAKE2b-256 | 411779fc36d91a036643f4281b7598870fcbe600717a3dcfcc77d3d8e0b960ef |
File details
Details for the file aiconfig_extension_hugging_face-0.0.11-py3-none-any.whl
.
File metadata
- Download URL: aiconfig_extension_hugging_face-0.0.11-py3-none-any.whl
- Upload date:
- Size: 56.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 935f4182097163af590a90269296d979ccccb84c13f262737b665b822a6fcf5a |
|
MD5 | 965f91d221f8998f426e7b9e9c85fbff |
|
BLAKE2b-256 | 3067ac2b7cbe76d3540c1cea95c8ad1f29d5265e955d940acc061e42f0c12ca6 |