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

Text generation #43

Merged
merged 2 commits into from
Sep 22, 2023
Merged

Text generation #43

merged 2 commits into from
Sep 22, 2023

Conversation

floatingbigcat
Copy link
Collaborator

@floatingbigcat floatingbigcat commented Aug 8, 2023

support text generation with image as input.

  • add image as a input of model for generate funciton
  • add option for tokenizer to tokenize without pad and convert to tensor

Use instruction:

  1. put the image_path and text prompt to jsonl file, set the config of text-generation.yml
    eg: sample_input.jsonl {'image':'image_path', 'text':'your_prompt'}
  2. set up the environment just like the one for training.
  3. run with python deepy.py generate.py -d your_train_configs(eg: 410M.yml summit-setup.yml) text-generation.yml

To do:
support the use_cache=True, which shall speed up the inference.

generate.py Show resolved Hide resolved
@daniel-z-kaplan
Copy link
Collaborator

daniel-z-kaplan commented Aug 25, 2023

Example on how to run:
python3 deepy.py generate.py -d configs magma_pythia_410M.yml magma_setup.yml text-generation.yml

Check text-generation for the input file name, make sure you have that file created, using the {image, text} dict setup described above.

You'll need to use your job.sh source, conda env if relevant, and export torch extensions also.

@kshitijkg kshitijkg merged commit d9e0098 into magma Sep 22, 2023
0 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants