-
Notifications
You must be signed in to change notification settings - Fork 16k
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
Tiktoken import bug? #3811
Comments
Having this issue as well. |
Changing to AttributeError: module 'tiktoken' has no attribute 'encoding_for_model' tiktoken 0.1.2 |
Here is the constructor
Thus we can see that if we use
New:
As you can see in the source code, the model defaults to
In your project directory, e.g.,
|
In summary, my proposed changes that made it work for me are: https://github.com/hwchase17/langchain/blob/master/langchain/embeddings/openai.py#L188 https://github.com/hwchase17/langchain/blob/master/langchain/embeddings/openai.py#L107 |
@shawnesquivel did you create PR with this fix? |
There is an open PR that is somewhat related #3819 I don't think it incorporates the default model that I used though. |
I had this issue and was able to resolve it by installing faiss-cpu pip install faiss-cpu |
I have the same problem, and @rahdor ,your suggestion can't effect🤡 |
I also received the this message with more details: "most likely due to a circular import" After tracking the packages I found that the my local py file is the same as the file name being used: "token.py" |
Hi, @sudowoodo200. I'm Dosu, and I'm helping the LangChain team manage their backlog. I wanted to let you know that we are marking this issue as stale. Based on my understanding, the issue is about a bug in the import of the If this issue is still relevant to the latest version of the LangChain repository, please let us know by commenting on the issue. Otherwise, feel free to close the issue yourself. If we don't hear back from you, the issue will be automatically closed in 7 days. Thank you for your understanding and contribution to the LangChain project. If you have any further questions or concerns, please don't hesitate to reach out. Best regards, |
I named my python script |
https://github.com/hwchase17/langchain/blob/adcad98bee03ac8486f328b4f316017a6ccfc808/langchain/embeddings/openai.py#L159
Getting "no attribute" error for
tiktoken.model
. Believe that this is because tiktoken has changed their import model, per code here. Change totiktoken.encoding_for_model(self.model)
?The text was updated successfully, but these errors were encountered: