Skip to content
This repository was archived by the owner on Aug 9, 2023. It is now read-only.

Commit adeecc5

Browse files
authored
Merge pull request #175 from wellcometrust/feature/bert_vectorizer_progress_bar
new: Add progress bar to transform method
2 parents 16754b0 + afaaa5b commit adeecc5

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

setup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@
5454
'hdbscan',
5555
'cython',
5656
'flake8',
57-
'black'
57+
'black',
58+
'tqdm'
5859
],
5960
extras_require={
6061
'deep-learning': [

wellcomeml/ml/bert_vectorizer.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from sklearn.base import BaseEstimator, TransformerMixin
88
import numpy as np
99
import torch
10+
import tqdm
1011

1112
from wellcomeml.utils import check_cache_and_download
1213
from wellcomeml.logger import logger
@@ -71,7 +72,7 @@ def bert_embedding(self, x):
7172
return embedded_x.cpu().numpy().flatten()
7273

7374
def transform(self, X, *_):
74-
return np.array([self.bert_embedding(x) for x in X])
75+
return np.array([self.bert_embedding(x) for x in tqdm.tqdm(X)])
7576

7677
def fit(self, *_):
7778
model_name = (

0 commit comments

Comments
 (0)