marvin icon indicating copy to clipboard operation
marvin copied to clipboard

Enable Marvin to use HuggingFace models

Open gijswobben opened this issue 1 year ago • 1 comments

First check

  • [X] I added a descriptive title to this issue.
  • [X] I used the GitHub search to look for a similar issue and didn't find it.
  • [X] I searched the Marvin documentation for this feature.

Describe the current behavior

The current implementation requires an OpenAI account/key. OpenAI is doing an awesome job, but it can also be expensive. For some experiments/jobs it's enough to work with a slightly smaller model. HuggingFace hub contains a wealth of models that could be used (e.g. codegen, google/flan-t5-xl or gpt-j) and HuggingFace is supported by langchain so it shouldn't be too difficult to support this.

I know the README says that other models aren't supported because prompts might not translate well, but shouldn't it be up to the user to figure out which model works best for their use case?

Describe the proposed behavior

  1. Set a HuggingFace API key
  2. Set a global config (something like marvin.settings.backend = 'HUGGINGFACE')
  3. Use langchain to load and use the model specified

Example Use

No response

Additional context

No response

gijswobben avatar May 12 '23 06:05 gijswobben

@gijswobben I'm looking into this -- I was about to write that there was some difficulty because Langchain doesn't support huggingface via chat interface but ask and ye shall receive: https://twitter.com/LangChainAI/status/1657430519607623680

Will try to implement soon!

(I'm not sure if this really allows conversation and history the way we expect, especially because of system messages... we'll see)

jlowin avatar May 15 '23 13:05 jlowin

This was implemented in Marvin 0.X.

Moving forward we'll support any bring-your-own-model, with OpenAI as a first class citizen.

aaazzam avatar Jul 11 '23 21:07 aaazzam