Comments (6)
Same here
from keybert.
Could you share the full error message? Also, did you try installing KeyBERT from the main branch?
from keybert.
Keybert version as installed via poetry:
➜ pip list | grep keybert
keybert 0.8.4
Full error message:
...
...
63 embeddings = embedding_model.encode(docs, convert_to_tensor=True)
65 # Extract keywords
---> 66 keywords = kw_model.extract_keywords(
67 docs,
68 embeddings=embeddings,
69 threshold=.75,
70 )
71 logger.info(f"Keywords: {keywords}")
72 return keywords
File ~/miniconda3/envs/_____/lib/python3.10/site-packages/keybert/_llm.py:107, in KeyLLM.extract_keywords(self, docs, check_vocab, candidate_keywords, threshold, embeddings)
105 else:
106 selected_keywords = None
--> 107 in_cluster_keywords = self.llm.extract_keywords(
108 selected_docs,
109 selected_keywords
110 )
111 in_cluster_keywords = {
112 doc_id: in_cluster_keywords[index]
113 for index, cluster in enumerate(clusters)
114 for doc_id in cluster
115 }
117 # Update out cluster keywords with in cluster keywords
File ~/miniconda3/envs/_____/lib/python3.10/site-packages/keybert/llm/_openai.py:189, in OpenAI.extract_keywords(self, documents, candidate_keywords)
187 else:
188 response = self.client.completions.create(model=self.model, prompt=prompt, **self.generator_kwargs)
--> 189 keywords = response.choices[0].message.content.strip()
190 keywords = [keyword.strip() for keyword in keywords.split(\",\")]
191 all_keywords.append(keywords)
File ~/miniconda3/envs/_____/lib/python3.10/site-packages/pydantic/main.py:792, in BaseModel.__getattr__(self, item)
789 return super().__getattribute__(item) # Raises AttributeError if appropriate
790 else:
791 # this is the current error
--> 792 raise AttributeError(f'{type(self).__name__!r} object has no attribute {item!r}')
AttributeError: 'CompletionChoice' object has no attribute 'message'"
from keybert.
@cdolek Thanks for sharing. I have a feeling that this is not the full error message since there are multiple steps missing in the message. It is not possible that line 107 itself raises this error as it points towards another line in the code. Could you see whether you can get the full error message?
Also, did you try installing KeyBERT from the main branch? I believe there was a fix there implemented a while ago.
from keybert.
@MaartenGr I installed keybert as a package not by cloning the main branch. I just checked if the version of package matched with the repo. But, I can try cloning as well.
Updated the error message above to include full output.
from keybert.
@cdolek Yes, based on the error message, cloning from the main branch might just fix the issue.
from keybert.
Related Issues (20)
- Allow KeyBERT to pass `batch_size` to `llm.encode()` method HOT 5
- Make system content as variable HOT 2
- Fail to parse OpenAI api response HOT 2
- Extract keywords from multiple documents given a nested list of candidates for each document. HOT 1
- can't import keybert HOT 9
- Using KeyBERT with a locally saved model HOT 1
- Not able to use gensim HOT 5
- Why and how the same model for doc_embeddings and word_embeddings? HOT 1
- Setup check. Script to get keywords for comparing against SimpleMaths, TextRank and Philology results HOT 5
- Add more LLMs HOT 1
- OSError: libcudart.so.12: cannot open shared object file: No such file or directory HOT 2
- KeyLLM error: AttributeError: 'str' object has no attribute 'completions' HOT 9
- CLI tool like YAKE
- keybert benchmarks with respect to other phrase extraction techniques. HOT 1
- Drop support for Python < 3.8 HOT 5
- pre-commit-hooks: replace black and flake8 HOT 2
- OpenAi api HOT 4
- How to get the keywords' embedding? HOT 5
- max token with openAI HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from keybert.