mirror of
https://github.com/run-llama/llama_docs_bot.git
synced 2026-07-16 03:44:02 -04:00
4_embeddings: ValueError: "InstructorEmbeddings" object has no field "_model" #5
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @jonmach on GitHub (Dec 8, 2023).
I"m working through the llama_docs_bot files and there is an issue with the InstructorEmbeddings class that relies on BaseEmbedding:
Running the following:
I get the following error:
This is a list of my installed modules with versions etc.
@jonmach commented on GitHub (Dec 8, 2023):
Problem resolved by adding:
to the InstructorEmbeddings class
@Omegapy commented on GitHub (Dec 30, 2023):
I also got the error:
My solution
This is my fix:
My results are the same as the video:
@mvitas commented on GitHub (Jul 23, 2024):
Current working solution as of Jul 23rd 2024.
Adding instance var model with pydantic validation in place
BaseEmbedding class has pydantic validation, meaning that no extra fields can be added to InstructorEmbeddings child class out of the box.
Add following code to allow extra fields to be defined.
class Config: extra = Extra.allowInitialize BaseEmbedding super class before initializing model