Open hanouticelina opened 2 days ago
This tracks for me! Thanks for the really well detailed proposition! A PR would be awesome 🤗
+1 looks great and helps a lot with the structure of the wrapping we had not worked that much on yet 🥇
Great! I will open a PR this week!
Hi @cfahlgren1 and @davidberenstein1957, really nice work, i like the idea! while going through the code, I had a refactoring idea to make it easier to add support for other text generation/chat completion clients (#15 and #6), and I thought I might drop it here! 🤗
Currently, we modify the client's methods directly (see : observers/models/openai.py#L210) which might not work for all clients as some might not support this kind of method replacement. Also, writing the library as a patch over the client SDK would make it more maintainable and less prone to compatibility issues.
So here is what i have in mind — instead of modifying the client directly, we create a simple patch that wraps any client:
observers/models/base.py
here is how it looks with
transformers.pipeline
:in
observers/models/transformers.py
in
observers/models/openai.py
The same pattern works for
huggingface_hub.InferenceClient
!WDYT? of course, there are still some things that can be improved but this is basically the initial idea. if that makes sense for you, I'd be happy to open a PR for that (with tests obviously!)