-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsample_application.py
More file actions
38 lines (29 loc) · 1.01 KB
/
sample_application.py
File metadata and controls
38 lines (29 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import json
from clusterer.clustering.clusterer import RdlClusterer
from clusterer.clustering.config import ClustererConfig
def main(argv=None):
dataset_jsonl = "/tmp/tmpbhfrxolz"
config = ClustererConfig(config_file_path="configs/clusterer-config-small.json")
c = RdlClusterer(
embedder_path=config.embedder_path,
embedder_input_size=config.embedder_input_size,
method=config.method,
reduction=config.reduction,
reducer_optim=config.reducer_optim,
reducer_sim_metric=config.reducer_sim_metric,
device=config.device,
load_model=True,
use_reduced_dataset=config.use_reduced_dataset,
clustering_params=config.clustering_params,
)
c.load_dataset(
file_path=dataset_jsonl,
text_column="text",
metadata_column="metadata",
input_type="jsonl",
clear_dataset_if_exists=True,
)
if not c.run(debug=False, normalize_embeddings=True):
return
if __name__ == "__main__":
main()