Skip to content
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

Add LanguageModel Op and integration with HuggingFace's GPT2 implementation #30

Merged
merged 7 commits into from
Mar 27, 2023

Conversation

rlouf
Copy link
Member

@rlouf rlouf commented Mar 25, 2023

  • Add a generic LanguageModel Op
  • Transpile scripts containing language models
  • Integrate HugginFace transformers
  • Test on workflows that consist of several calls to a language model

@rlouf
Copy link
Member Author

rlouf commented Mar 26, 2023

I plugged-in HuggingFace's GPT2 and I get the following results:

import outlines


gpt2 = outlines.text.models.GPT2()

output = outlines.script("""
Here is a good joke: ${joke}
And a random fact: ${fact}
""")(joke=gpt2, fact=gpt2)

fn = compile([], [output])
print(fn())
# Here is a good joke:  The last day of 2013  was quite an emotional and fun one.  I wrote,
# And a random fact:  I am going to be living here for a few years with my friend James.  

We still need to fix the following before merging:

  • The LanguageModel instances are stateful: if I use the joke LanguageModel instance for joke and fact I get the same generation. This needs to be fixed.
  • They are not random: running the program twice gives the same results.
  • HF raises a warning when decoding without an input mask. We should figure out why and make sure it is not raised.
  • Add tests for LanguageModel

@rlouf rlouf force-pushed the hf-integration branch 4 times, most recently from cf38771 to 8edb5b6 Compare March 26, 2023 19:43
@rlouf rlouf added the text Linked to text generation label Mar 26, 2023
@rlouf rlouf changed the title Integrate language models Add LanguageModel Op and integration with HuggingFace's GPT2 implementation Mar 27, 2023
@rlouf rlouf merged commit 8e22dc1 into main Mar 27, 2023
@rlouf rlouf deleted the hf-integration branch March 27, 2023 08:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
text Linked to text generation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant