From utils import gemini in L2_colab_prompting_and_parameters.ipynb

The line was commented out but the next line

gemini(“What is a multimodal model?”, model=model)

requires the function so I uncommented it, but to no avail — utils was not found.

So I did a pip install utils, but the package doesn’t contain gemini.

Not sure what to do. Earlier instructions seem to suggest everything I need is already in Colab.

Important Note:

If using Google Colab, all the

from utils import ...

functions and all required images are readily accessible in the notebook. Execute the following cells to proceed.

how do I get unstuck? Just trying to follow along on my own machine.

Thanks.

Hi @SriRaman,

Execute the cells which follow this markdown.

Best,
Mubsi

Thanks, Mubsi.

I don’t know what cells you are referring to. I was following along on the colab from github and executing each line sequentially. When I got to

!pip install utils
from utils import gemini

I got the following messages including the error I was referring to:

Collecting utils
Downloading utils-1.0.2.tar.gz (13 kB)
Preparing metadata (setup.py) … done
Building wheels for collected packages: utils
Building wheel for utils (setup.py) … done
Created wheel for utils: filename=utils-1.0.2-py2.py3-none-any.whl size=13905 sha256=daea971ce915acc0b350edf9df7c80e8a1c90925e942cf32e6364db5de000bd8
Stored in directory: /root/.cache/pip/wheels/b8/39/f5/9d0ca31dba85773ececf0a7f5469f18810e1c8a8ed9da28ca7
Successfully built utils
Installing collected packages: utils
Successfully installed utils-1.0.2

ImportError Traceback (most recent call last)
in <cell line: 2>()
1 get_ipython().system(‘pip install utils’)
----> 2 from utils import gemini

ImportError: cannot import name ‘gemini’ from ‘utils’ (/usr/local/lib/python3.10/dist-packages/utils/init.py)


NOTE: If your import is failing due to a missing package, you can
manually install dependencies using either !pip or !apt.

To view examples of installing some common dependencies, click the
“Open Examples” button below.

and that’s where I got stuck and tried some other things.

Hi @SriRaman,

Please note, you don’t have to do anything extra when trying to run the colab, except add your project ID.

I’d suggest to open a fresh copy of the colab again and try running everything.

If you come across any issue, send me a screenshot.

Thanks,
Mubsi

Thanks much. I was confusing the project name and project id.

still not quite sure why the import failed. Where will I get the gemini function in the future?

In any case, I’m making some progress.

Thanks, again.

Raman

1 Like

Hi @SriRaman,

Well, all the functions from utils.py have been made available in the colab for a smooth notebook run, under the heading Utils Functions.

For notebooks which are not using anything from the utils.py, you will not see this heading in them.

Optionally, you can look at the utils.py files in the GitHub repository, for example, this is the file for L2 notebook.

Best,
Mubsi

Terrific! That’s just what I needed to start planning for my further development. A little blueprint.

Raman

1 Like