FritzStack commited on
Commit
15ea621
·
verified ·
1 Parent(s): cebb0e9

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +91 -0
README.md CHANGED
@@ -11,6 +11,97 @@ language:
11
  - en
12
  ---
13
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  # Uploaded model
15
 
16
  - **Developed by:** FritzStack
 
11
  - en
12
  ---
13
 
14
+
15
+
16
+ ## Model Description
17
+
18
+ This is a **lightweight model** designed for **multi-class, multi-label classification** of sentences based on the dimensional traits of the **Hierarchical Taxonomy of Psychopathology (HiTOP)**.
19
+
20
+ HiTOP is an empirically derived framework that organizes psychopathology into continuously distributed dimensions arranged hierarchically, representing a paradigmatic shift from traditional categorical diagnostic systems. The model conceptualizes mental health conditions along spectra including **internalizing** (e.g., depression, anxiety), **thought disorder**, **detachment**, **disinhibited externalizing**, and **antagonistic externalizing**.
21
+
22
+ ### Architecture
23
+
24
+ This model adapts sentence transformer architectures for multi-label text classification, enabling the simultaneous prediction of multiple HiTOP dimensional traits from individual sentences. The lightweight design makes it suitable for deployment in resource-constrained environments while maintaining strong classification performance.
25
+
26
+ ### Classification Task
27
+
28
+ Unlike traditional categorical diagnosis, this model predicts the **degree** to which a sentence reflects various HiTOP dimensions, acknowledging that psychopathological features exist on continua rather than as discrete categories. Each input sentence can be assigned multiple labels corresponding to different HiTOP traits, capturing the co-occurrence and overlap of psychological symptoms that characterize real-world clinical presentations.
29
+
30
+ ### Applications
31
+
32
+ - **Dimensional assessment**: Evaluating multiple psychopathology dimensions simultaneously from text
33
+ - **Clinical screening**: Identifying patterns of mental health concerns in social media or clinical notes
34
+ - **Research**: Studying the hierarchical structure of psychopathology in naturalistic language data
35
+ - **Symptom tracking**: Monitoring changes across multiple psychological dimensions over time
36
+
37
+ This approach aligns with contemporary evidence-based frameworks for understanding mental health, offering improved reliability and coverage compared to traditional categorical classification systems.
38
+
39
+
40
+
41
+
42
+ ```{python}
43
+ from transformers import AutoModelForCausalLM, AutoTokenizer
44
+ import torch
45
+
46
+
47
+ class HiTOPTraitsPredictor:
48
+ def __init__(self, model_name="FritzStack/HiTOP-QWEN-4bit"):
49
+ self.model_name = model_name
50
+ self.tokenizer = None
51
+ self.model = None
52
+
53
+ def _load_model(self):
54
+ if self.tokenizer is None:
55
+ self.tokenizer = AutoTokenizer.from_pretrained(
56
+ self.model_name,
57
+ trust_remote_code=True
58
+ )
59
+ if self.model is None:
60
+ self.model = AutoModelForCausalLM.from_pretrained(
61
+ self.model_name,
62
+ torch_dtype=torch.float16,
63
+ device_map="auto",
64
+ trust_remote_code=True
65
+ )
66
+
67
+ def batch_predict(self, texts, max_new_tokens=50, do_sample=False, top_k=10):
68
+ self._load_model()
69
+ prompts = [f"{text}. HiTOP Traits: " for text in texts]
70
+ inputs = self.tokenizer(prompts, return_tensors="pt", padding=True, truncation=True).to(self.model.device)
71
+
72
+ with torch.no_grad():
73
+ outputs = self.model.generate(
74
+ **inputs,
75
+ max_new_tokens=max_new_tokens,
76
+ do_sample=do_sample,
77
+ top_k=top_k,
78
+ pad_token_id=self.tokenizer.eos_token_id
79
+ )
80
+
81
+ results = []
82
+ for i, output in enumerate(outputs):
83
+ generated_text = self.tokenizer.decode(
84
+ output[len(inputs.input_ids[i]):],
85
+ skip_special_tokens=False
86
+ ).strip()
87
+ results.append(generated_text.replace('<|im_end|>', ''))
88
+
89
+ return results
90
+
91
+ predictor = HiTOPTraitsPredictor()
92
+
93
+ texts = [
94
+ "I feel sad and unmotivated most days",
95
+ "I get very angry and irritable with people",
96
+ "I have trouble concentrating and staying focused"
97
+ ]
98
+ results = predictor.batch_predict(texts, max_new_tokens=50)
99
+ for text, result in zip(texts, results):
100
+ print(f"Input: {text}")
101
+ print(f"HiTOP Traits: {result}\n")
102
+ ```
103
+
104
+
105
  # Uploaded model
106
 
107
  - **Developed by:** FritzStack