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
Close
Hashes for aiconfig_extension_hugging_face-0.0.7.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 89be187bd0af07523e0d8bfd7043424f851515e839b5f300e140ca0b22a8d589 |
|
MD5 | 92deaccf88eea737872a7e8e298ad9d9 |
|
BLAKE2b-256 | c0c4f6b2ab177a1f0a01a67d7a2e510eb16ac9f48c8f952fc25f1ff0e20874ec |
Close
Hashes for aiconfig_extension_hugging_face-0.0.7-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d46f2b6c7c4babf0db015bdece361c6d0adfa4f61799cf5b4cd1f452db774f85 |
|
MD5 | e8a230af7fbbb2ed9468d0c2a567938b |
|
BLAKE2b-256 | e7fbb8d8078a88c1eb6f830b608a09f0c15a32f4ff2c0d21b1a95eac084c0e89 |