MaartenGr / MaartenGr/BERTopic
Problem loading model trained with larger datasets
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 7.8k
- Forks
- 921
- Avg merge
- 22h 24m
- Merged PRs (30d)
- 5
Description
Hello,
I've been training BERTopic models with resumes in English of candidates from all around the world. I am training it all on Google Cloud, using AI Platform, and I had no issues training and loading models until 5K documents. But when I train a model with 10K documents or more (using the exact same code), the training goes well and the model is saved, but I can't load it because of this error:
Here's my 'get_model' function, which loads the model from a Cloud Storage bucket, where it is automatically saved once the training is finished:
def get_model(bucketname, filename):
storage_client = storage.Client()
bucket = storage_client.bucket(bucketname)
blob = bucket.blob(filename)
with TemporaryFile() as temp_file:
#download blob into temp file
blob.download_to_file(temp_file)
temp_file.seek(0)
#load into joblib
print(temp_file)
model=joblib.load(temp_file)
return model
# Usage:
loaded_model = get_model(bucketname, filename)
The bertopic version I'm using is 0.14.1, and the joblib's is 1.2.0.
As I said, I had no issue loading models trained with less documents (5k, 3k, 1k), the problem appears when I use larger datasets. Are you familiar with this problem? Do you see any issue with my code?
Thank you in advance @MaartenGr , your work is wonderful!!
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the get_model function and reproduce loading both the smaller and larger saved models from the Cloud Storage bucket using the shown TemporaryFile and joblib.load flow. Compare the saved artifacts and the loading exception, then define done as successfully loading models trained on larger datasets without changing the training code.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- google-cloud, python
- Domain
- cloud, machine-learning
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100