0

I'm trying to run this notebook in Colab.

from openai.embeddings_utils import get_embedding

# This will take just under 10 minutes
df['babbage_similarity'] = df.combined.apply(lambda x: get_embedding(x, engine='text-similarity-babbage-001'))
df['babbage_search'] = df.combined.apply(lambda x: get_embedding(x, engine='text-search-babbage-doc-001'))
df.to_csv('/content/documents.csv')

This code block fails when I try to run it -- I get this error:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-31-b04fdb9f95d8> in <module>()
      5
      6 
----> 7 from openai.embeddings_utils import get_embedding
      8 
      9 # This will take just under 10 minutes

10 frames
/usr/local/lib/python3.7/dist-packages/distributed/config.py in <module>()
     18 
     19 with open(fn) as f:
---> 20     defaults = yaml.load(f)
     21 
     22 dask.config.update_defaults(defaults)

TypeError: load() missing 1 required positional argument: 'Loader'

Based on Googling around, it seems that this is an version issue specific to Colab. But I haven't been able to fix it. Any have any ideas?

Mashu
  • 79
  • 2
  • 5

1 Answers1

0

in config.py:

replace this:

with open(fn) as f:
    defaults = yaml.load(f)

with this:

with open(fn) as f:
    defaults = yaml.safe_load(f)
joanis
  • 10,635
  • 14
  • 30
  • 40
Lans
  • 1