perf: use lighter topic model

This commit is contained in:
2026-02-15 20:29:17 +00:00
parent 0d0e86524f
commit fb20c3ab1b
2 changed files with 2 additions and 2 deletions

View File

@@ -12,7 +12,7 @@ app = Flask(__name__)
CORS(app, resources={r"/*": {"origins": "http://localhost:5173"}}) CORS(app, resources={r"/*": {"origins": "http://localhost:5173"}})
# Global State # Global State
posts_df = pd.read_json('posts_test.jsonl', lines=True) posts_df = pd.read_json('posts.jsonl', lines=True)
with open("topic_buckets.json", "r", encoding="utf-8") as f: with open("topic_buckets.json", "r", encoding="utf-8") as f:
domain_topics = json.load(f) domain_topics = json.load(f)
stat_obj = StatGen(posts_df, domain_topics) stat_obj = StatGen(posts_df, domain_topics)

View File

@@ -63,7 +63,7 @@ class NLP:
def _get_topic_model(cls, device_str: str) -> SentenceTransformer: def _get_topic_model(cls, device_str: str) -> SentenceTransformer:
model = cls._topic_models.get(device_str) model = cls._topic_models.get(device_str)
if model is None: if model is None:
model = SentenceTransformer("all-mpnet-base-v2", device=device_str) model = SentenceTransformer("all-MiniLM-L6-v2", device=device_str)
cls._topic_models[device_str] = model cls._topic_models[device_str] = model
return model return model