Skip to content

Commit

Permalink
fixes #531
Browse files Browse the repository at this point in the history
  • Loading branch information
amaiya committed Jun 14, 2024
1 parent f5f939f commit 91f7166
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Most recent releases are shown at the top. Each release shows:

### fixed:
- Remove references to `paper-qa` (#530)
- Reduce memory footprint of `TopicModel.filter` (#531)


## 0.41.3 (2024-04-05)
Expand Down
6 changes: 4 additions & 2 deletions ktrain/text/eda.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,8 +369,10 @@ def filter(self, obj):
"Length of obj is not consistent with the number of documents "
+ "supplied to get_topic_model"
)
obj = np.array(obj) if isinstance(obj, list) else obj
return obj[self.bool_array]
#obj = np.array(obj) if isinstance(obj, list) else obj
#return obj[self.bool_array]
from itertools import compress
return list(compress(obj, self.bool_array))

def get_docs(self, topic_ids=[], doc_ids=[], rank=False):
"""
Expand Down
1 change: 1 addition & 0 deletions tests/testenv.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@

os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
os.environ["CUDA_VISIBLE_DEVICES"] = "0"
os.environ["TF_USE_LEGACY_KERAS"] = "1"
CURRDIR = os.path.dirname(__file__)
sys.path.insert(0, os.path.join(CURRDIR, ".."))

0 comments on commit 91f7166

Please sign in to comment.