-
-
Notifications
You must be signed in to change notification settings - Fork 353
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Format image provider #66
Conversation
70b1ce0
to
0987956
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great! You moved very fast on this, my apologies for not getting the opportunity to review this sooner.
Rather than having HF txt2img models live underneath a separate provider, can you try instead defining the implementation inside of our HfImageProvider
class (with provider ID huggingface_hub
)? You will want to override the following methods:
validate_environment()
- Allow
("text2text-generation", "text-generation", "text-to-image")
- Allow
_call()
- Allow the tasks listed above
- Handle output for both txt2txt and txt2img models
You should also be able to leverage super().<method-name>(...)
instead of copying the implementation from LangChain. This would be much more robust as it would be more compatible with later releases of LangChain (that may change the implementation).
70dc2aa
to
4b69326
Compare
@dlqqq The |
e343cfe
to
67ece14
Compare
* Change raw to text. * Add provider/model metadata to output.
38a95a6
to
3064af1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome work! 👍
* Adds image format * WIP: New provider for huggingface_image * Adds image provider to __init__ * Improve magics. * Change raw to text. * Add provider/model metadata to output. * Fixing metadata handling. * Updates user docs * WIP: Prints debug output on initial load * Removes debug info from load * Removes separate provider for images * Outputs image in Base64 format * Removes HF image provider, updates docs * Removes limitation of only supporting JPEG format * Promotes VALID_TASKS out of class * Updates error handling, image generation example notebook * Updates dependencies per @dlqqq --------- Co-authored-by: Brian E. Granger <brgrange@amazon.com> Co-authored-by: Brian E. Granger <ellisonbg@gmail.com>
* Adds image format * WIP: New provider for huggingface_image * Adds image provider to __init__ * Improve magics. * Change raw to text. * Add provider/model metadata to output. * Fixing metadata handling. * Updates user docs * WIP: Prints debug output on initial load * Removes debug info from load * Removes separate provider for images * Outputs image in Base64 format * Removes HF image provider, updates docs * Removes limitation of only supporting JPEG format * Promotes VALID_TASKS out of class * Updates error handling, image generation example notebook * Updates dependencies per @dlqqq --------- Co-authored-by: Brian E. Granger <brgrange@amazon.com> Co-authored-by: Brian E. Granger <ellisonbg@gmail.com>
Fixes #44.
Adds modified
huggingface_hub
provider that calls HuggingFace models and returns an image as Base64-encoded bytes. Adds an image format type that decodes encoded images.