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 a notebook with BakLLaVA inference from Python #6

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

kopyl
Copy link

@kopyl kopyl commented Oct 20, 2023

Also add notebooks directory in the root of this repo

@kopyl
Copy link
Author

kopyl commented Oct 20, 2023

You can preview the notebook here: https://colab.research.google.com/drive/1yn-25Np_6OiJ7IDBBcuPOsPF9vqWBjzt

@nisten
@Sentdex
@pharaouk
@marianna13

Guys, could you please review and merge?

@mshumer
Copy link

mshumer commented Nov 17, 2023

Hey @kopyl, I'm having trouble with the notebook -- getting this error when running the last cell:

---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-9-b3405b5fe08b> in <cell line: 1>()
      1 with torch.inference_mode():
----> 2     output_ids = model.generate(
      3         input_ids=input_ids,
      4         images=image_tensor,
      5         do_sample=True,

2 frames
/usr/local/lib/python3.10/dist-packages/transformers/generation/utils.py in sample(self, input_ids, logits_processor, stopping_criteria, logits_warper, max_length, pad_token_id, eos_token_id, output_attentions, output_hidden_states, output_scores, return_dict_in_generate, synced_gpus, streamer, **model_kwargs)
   2768             # sample
   2769             probs = nn.functional.softmax(next_token_scores, dim=-1)
-> 2770             next_tokens = torch.multinomial(probs, num_samples=1).squeeze(1)
   2771 
   2772             # finished sentences should have their next token be a padding token

RuntimeError: probability tensor contains either `inf`, `nan` or element < 0

Any ideas as to how this can be fixed?

@kopyl
Copy link
Author

kopyl commented Nov 17, 2023

@mshumer try Runpod. Google Colab sometimes has issues.

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.

2 participants