We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hi, I still get this error message despite I use the last commit & version from bertopic, could you please help ?
Code:
import openai from bertopic.backend import OpenAIBackend from openai import AzureOpenAI client = AzureOpenAI( api_version = "2023-09-15-preview", api_key =os.getenv("OPENAI_API_KEY").strip(), azure_endpoint ="https://x-.openai.azure.com/", ) embedding_model = OpenAIBackend(client,"text-embedding-3-large")
embeddings = embedding_model.encode(df['PreprocessedText'].tolist(), show_progress_bar=True)
from bertopic import BERTopic
topic_model = BERTopic( embedding_model=embedding_model, vectorizer_model=vectorizer_model, umap_model=umap_model, calculate_probabilities=True, #hdbscan_model=hdbscan_model, representation_model=representation_model, verbose=True, nr_topics=10 )
topics, probs = topic_model.fit_transform(df['PreprocessedText'].values)
The text was updated successfully, but these errors were encountered:
The encode method that you refer to is specific to sentence-transformers package. You would have to use embed instead. I would advise checking out the source code and see which methods are available: https://github.com/MaartenGr/BERTopic/blob/master/bertopic/backend/_openai.py
encode
embed
Sorry, something went wrong.
No branches or pull requests
Hi,
I still get this error message despite I use the last commit & version from bertopic, could you please help ?
Code:
import openai
from bertopic.backend import OpenAIBackend
from openai import AzureOpenAI
client = AzureOpenAI(
api_version = "2023-09-15-preview",
api_key =os.getenv("OPENAI_API_KEY").strip(),
azure_endpoint ="https://x-.openai.azure.com/",
)
embedding_model = OpenAIBackend(client,"text-embedding-3-large")
embeddings = embedding_model.encode(df['PreprocessedText'].tolist(), show_progress_bar=True)
from bertopic import BERTopic
Initialize and train BERTopic model
topic_model = BERTopic(
embedding_model=embedding_model,
vectorizer_model=vectorizer_model,
umap_model=umap_model,
calculate_probabilities=True,
#hdbscan_model=hdbscan_model,
representation_model=representation_model,
verbose=True,
nr_topics=10
)
Fit the topic model and transform the data
topics, probs = topic_model.fit_transform(df['PreprocessedText'].values)
The text was updated successfully, but these errors were encountered: