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

A notebook for question and answer generation using one of the most powerful opensource NLU models, FLAN-T5-11B. #215

Merged
merged 5 commits into from
Jan 14, 2023

Conversation

Rallio67
Copy link
Collaborator

This is code that can be run in a notebook or by itself to generate a dictionary for use in creating synthetic dialogue that can be verified for factual accuracy. To use this notebook your need your trusted source material to be in the format of a list of strings (they will be truncated to under 1100 characters). Requires transformers and accelerate. Make sure to use T5 with bfloat16 or full precision.

It would be nice if someone can convert this approach to work on colab. T5-11B should be able to run on TPU with colab.

This is code that can be run in a notebook or by itself to generate a dictionary for use in creating synthetic dialogue that can be verified for factual accuracy. To use this notebook your need your trusted source material to be in the format of a list of strings (they will be truncated to under 1100 characters). Requires transformers and accelerate. Make sure to use T5 with bfloat16 or full precision.
@yk
Copy link
Collaborator

yk commented Dec 31, 2022

could you a) run pre-commit to pass linting, and b) could you have a look at how the folder structure of notebooks/ looks like and make yours in the same way? doesn't have to be .ipynb obviously, but the accompanying short markdown file that informs people what a piece of code does is quite helpful

@TwoDukes
Copy link
Contributor

TwoDukes commented Jan 1, 2023

It would be nice if someone can convert this approach to work on colab. T5-11B should be able to run on TPU with colab.

Colab Link
Swapped down to -xl model by default for free tier users wanting to work with it. Can be changed to back to -xxl if you have pro available

@Rallio67
Copy link
Collaborator Author

Rallio67 commented Jan 1, 2023

I think it should be fixed now. I ran pre-commit and added the .md file and changed to have correct folder structure. Let me know if this works now. TwoDukes you may want to use the changes I put in. There was some whitespace problems and a few unused variables that were left over from other things I was doing before. I actually forgot incorporating the logits score was some custom code I wrote. I think I implemented it correctly, but someone else checking that may be helpful.

@yk
Copy link
Collaborator

yk commented Jan 2, 2023

  • you might need to add & commit again after running pre-commit if it was not all green. there are 2 things it does: auto-fixes (in which case the file has new changes & needs to be added again), or it yells at you, in which case you need to fix it (and also add the file again). pre-commit is currently still failing, so if you ran it, you might need to add & commit it again.
  • For the future, if you run pre-commit install once in the repo, it will do this automatically on every commit in the future
  • You might also think of making your code just a bit more interactive. It's not super important because code in the notebooks/ folder is meant as scrappy demonstrations of stuff, but an easy thing you could do is instead of making your scripts be top-level scripts, make them into typer scripts. typer makes it super easy to make a script into a cli, then all the constants that are just "somewhere in the code" can be made automatically into command line parameters, and a help text is generated, etc. etc. i.e. not urgent and not necessary, but it might even speed up your own development process :)

@andreaskoepf
Copy link
Collaborator

@Rallio67 pre-commit still reports problems, can you fix and give it another try?

@gameveloster
Copy link

Whats the GPU VRAM requirements for the XXL model?

@Rallio67
Copy link
Collaborator Author

You need a 24 gigabyte card and you need to use bfloat16. RTX3090 and other ampere level cards works with 24 gigabyte memory like the A10, A100, A5000 etc.

@yk yk requested a review from andrewm4894 as a code owner January 14, 2023 22:15
@yk yk enabled auto-merge (squash) January 14, 2023 22:15
@yk yk merged commit a203900 into LAION-AI:main Jan 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants