google-gemini/cookbook

in Audio.ipyn count_tokens results in 403

ahmetkizilay opened this issue · 3 comments

Description of the bug:

Running the Audio.ipyn file, I am getting 403 error when running the count_tokens step.

You do not have permission to access the File m7gxa43f7pft or it may not exist.

To replicate,
1 - Open the notebook in Google Colab,
2 - Setup the GOOGLE_API_KEY
3 - run all commands

Actual vs expected behavior:

actual behavior: model.count_tokens([your_file]) returns error

I expect all steps in the cookbook execute without errors.

Any other information you'd like to share?

No response

Running model.count_tokens([your_file]) returns file permission access error.

image

Hi @ahmetkizilay - I've just run Audio.ipynb on a Colab session and everything worked fine up to the model.count_tokens([your_file]) cell.

I noticed on your error message that you are using gemini-1.0-pro which is not the model used on the current notebook version.

Could you experiment with the latest version of this notebook and double check if the error persists for you?

cheers,
Luciano Martins.

This seems to be resolved (even with the older model).

model = genai.GenerativeModel("models/gemini-1.0-pro")
model.count_tokens([uploaded_sample])

returns without an error