0xMori commited on
Commit
25941fb
Β·
verified Β·
1 Parent(s): 9624aaf

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +90 -168
README.md CHANGED
@@ -1,199 +1,121 @@
1
  ---
2
  library_name: transformers
3
- tags: []
 
 
 
 
 
 
 
 
 
 
 
 
4
  ---
5
 
6
- # Model Card for Model ID
7
 
8
- <!-- Provide a quick summary of what the model is/does. -->
9
 
10
-
11
-
12
- ## Model Details
13
 
14
  ### Model Description
15
 
16
- <!-- Provide a longer summary of what this model is. -->
17
-
18
- This is the model card of a πŸ€— transformers model that has been pushed on the Hub. This model card has been automatically generated.
19
-
20
- - **Developed by:** [More Information Needed]
21
- - **Funded by [optional]:** [More Information Needed]
22
- - **Shared by [optional]:** [More Information Needed]
23
- - **Model type:** [More Information Needed]
24
- - **Language(s) (NLP):** [More Information Needed]
25
- - **License:** [More Information Needed]
26
- - **Finetuned from model [optional]:** [More Information Needed]
27
-
28
- ### Model Sources [optional]
29
-
30
- <!-- Provide the basic links for the model. -->
31
-
32
- - **Repository:** [More Information Needed]
33
- - **Paper [optional]:** [More Information Needed]
34
- - **Demo [optional]:** [More Information Needed]
35
-
36
- ## Uses
37
-
38
- <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
39
 
40
- ### Direct Use
41
 
42
- <!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
43
 
44
- [More Information Needed]
 
 
 
 
 
45
 
46
- ### Downstream Use [optional]
47
 
48
- <!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
 
49
 
50
- [More Information Needed]
51
 
52
- ### Out-of-Scope Use
 
 
 
 
 
 
 
 
 
 
 
53
 
54
- <!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
 
 
55
 
56
- [More Information Needed]
57
 
58
- ## Bias, Risks, and Limitations
59
 
60
- <!-- This section is meant to convey both technical and sociotechnical limitations. -->
 
 
61
 
62
- [More Information Needed]
 
63
 
64
- ### Recommendations
 
 
 
 
 
65
 
66
- <!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
 
 
 
 
 
67
 
68
- Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
69
 
70
- ## How to Get Started with the Model
 
 
 
 
 
 
71
 
72
- Use the code below to get started with the model.
 
73
 
74
- [More Information Needed]
75
-
76
- ## Training Details
77
 
78
  ### Training Data
79
-
80
- <!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
81
-
82
- [More Information Needed]
83
 
84
  ### Training Procedure
85
-
86
- <!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
87
-
88
- #### Preprocessing [optional]
89
-
90
- [More Information Needed]
91
-
92
-
93
- #### Training Hyperparameters
94
-
95
- - **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
96
-
97
- #### Speeds, Sizes, Times [optional]
98
-
99
- <!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
100
-
101
- [More Information Needed]
102
-
103
- ## Evaluation
104
-
105
- <!-- This section describes the evaluation protocols and provides the results. -->
106
-
107
- ### Testing Data, Factors & Metrics
108
-
109
- #### Testing Data
110
-
111
- <!-- This should link to a Dataset Card if possible. -->
112
-
113
- [More Information Needed]
114
-
115
- #### Factors
116
-
117
- <!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
118
-
119
- [More Information Needed]
120
-
121
- #### Metrics
122
-
123
- <!-- These are the evaluation metrics being used, ideally with a description of why. -->
124
-
125
- [More Information Needed]
126
-
127
- ### Results
128
-
129
- [More Information Needed]
130
-
131
- #### Summary
132
-
133
-
134
-
135
- ## Model Examination [optional]
136
-
137
- <!-- Relevant interpretability work for the model goes here -->
138
-
139
- [More Information Needed]
140
-
141
- ## Environmental Impact
142
-
143
- <!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
144
-
145
- Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
146
-
147
- - **Hardware Type:** [More Information Needed]
148
- - **Hours used:** [More Information Needed]
149
- - **Cloud Provider:** [More Information Needed]
150
- - **Compute Region:** [More Information Needed]
151
- - **Carbon Emitted:** [More Information Needed]
152
-
153
- ## Technical Specifications [optional]
154
-
155
- ### Model Architecture and Objective
156
-
157
- [More Information Needed]
158
-
159
- ### Compute Infrastructure
160
-
161
- [More Information Needed]
162
-
163
- #### Hardware
164
-
165
- [More Information Needed]
166
-
167
- #### Software
168
-
169
- [More Information Needed]
170
-
171
- ## Citation [optional]
172
-
173
- <!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
174
-
175
- **BibTeX:**
176
-
177
- [More Information Needed]
178
-
179
- **APA:**
180
-
181
- [More Information Needed]
182
-
183
- ## Glossary [optional]
184
-
185
- <!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
186
-
187
- [More Information Needed]
188
-
189
- ## More Information [optional]
190
-
191
- [More Information Needed]
192
-
193
- ## Model Card Authors [optional]
194
-
195
- [More Information Needed]
196
-
197
- ## Model Card Contact
198
-
199
- [More Information Needed]
 
1
  ---
2
  library_name: transformers
3
+ base_model:
4
+ - google/gemma-2-9b-it
5
+ language:
6
+ - ko
7
+ pipeline_tag: text-generation
8
+ tags:
9
+ - mental-health
10
+ - cbt
11
+ - counseling
12
+ - psychology
13
+ - wellness
14
+ - qlora
15
+ license: gemma
16
  ---
17
 
18
+ # 🧠 Doran-i (CBT Counseling Specialist)
19
 
20
+ ![Model Architecture](https://img.shields.io/badge/Model-Gemma_2_9B-blue) ![Task](https://img.shields.io/badge/Task-CBT_Counseling-green) ![Technique](https://img.shields.io/badge/Technique-QLoRA_Fine_Tuning-orange) ![Status](https://img.shields.io/badge/Status-Stable_Release-brightgreen)
21
 
22
+ ## πŸ“– Model Details
 
 
23
 
24
  ### Model Description
25
 
26
+ **Doran-i(λ„λž€μ΄)**λŠ” κ΅¬κΈ€μ˜ κ³ μ„±λŠ₯ μ˜€ν”ˆ λͺ¨λΈμΈ `gemma-2-9b-it`λ₯Ό 기반으둜, **CBT(μΈμ§€ν–‰λ™μΉ˜λ£Œ) 기법**을 μˆ˜ν–‰ν•  수 μžˆλ„λ‘ μ •κ΅ν•˜κ²Œ λ―Έμ„Έμ‘°μ •(Fine-tuning)된 ν•œκ΅­μ–΄ 심리 상담 AI λͺ¨λΈμž…λ‹ˆλ‹€.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
 
28
+ κΈ°μ‘΄ `Gemma 3`의 μ‹€ν—˜μ  μ•„ν‚€ν…μ²˜ λŒ€μ‹ , κ²€μ¦λœ μ„±λŠ₯κ³Ό μ•ˆμ •μ„±μ„ μžλž‘ν•˜λŠ” **Gemma 2 9B**λ₯Ό μ±„νƒν•˜μ—¬ ν•œκ΅­μ–΄ λ‰˜μ•™μŠ€ νŒŒμ•… λŠ₯λ ₯κ³Ό μƒλ‹΄μ˜ 깊이λ₯Ό λŒ€ν­ κ°•ν™”ν–ˆμŠ΅λ‹ˆλ‹€.
29
 
30
+ λ‹¨μˆœν•œ μœ„λ‘œλ₯Ό λ„˜μ–΄, λ‚΄λ‹΄μžμ˜ 말 속에 μˆ¨κ²¨μ§„ **12κ°€μ§€ 인지 μ™œκ³‘(Cognitive Distortion)**을 νƒμ§€ν•˜κ³ , **μ†Œν¬λΌν…ŒμŠ€μ‹ 질문(Socratic Questioning)**을 톡해 λ‚΄λ‹΄μžκ°€ 슀슀둜 뢀정적 μ‚¬κ³ μ˜ 고리λ₯Ό λŠλ„λ‘ λ•μŠ΅λ‹ˆλ‹€.
31
 
32
+ - **Developed by:** Kong Yoonseo (0xMori) @ Safori
33
+ - **Model type:** Causal Language Model (QLoRA Fine-tuned)
34
+ - **Language(s):** Korean (ν•œκ΅­μ–΄)
35
+ - **License:** Gemma Terms of Use
36
+ - **Base Model:** `google/gemma-2-9b-it`
37
+ - **Hardware:** Trained on NVIDIA T4, Merged on TPU v5e-8
38
 
39
+ ### Model Sources
40
 
41
+ - **Repository:** [https://huggingface.co/0xMori/gemma-2-9b-safori-cbt-merged](https://huggingface.co/0xMori/gemma-2-9b-safori-cbt-merged)
42
+ - **Service Github:** [[Team Safori](https://github.com/safori-team)]
43
 
44
+ ## 🎯 Uses
45
 
46
+ ### Direct Use (JSON Output)
47
+ 이 λͺ¨λΈμ€ κ΅¬μ‘°ν™”λœ JSON ν˜•μ‹μœΌλ‘œ 상담 κ²°κ³Όλ₯Ό 좜λ ₯ν•˜λ„λ‘ ν›ˆλ ¨λ˜μ—ˆμŠ΅λ‹ˆλ‹€:
48
+ ```json
49
+ {
50
+ "emotion": "sad",
51
+ "empathy": "λ‚΄λ‹΄μžμ˜ 감정에 λŒ€ν•œ κΉŠμ€ 곡감 멘트",
52
+ "detected_distortion": "흑백논리",
53
+ "analysis": "λ‚΄λ‹΄μžκ°€ μ™œ 그런 생각을 ν•˜κ²Œ λ˜μ—ˆλŠ”μ§€μ— λŒ€ν•œ 뢄석",
54
+ "socratic_question": "λ°˜λ°• 증거λ₯Ό 찾도둝 μœ λ„ν•˜λŠ” 질문",
55
+ "alternative_thought": "긍정적 λŒ€μ•ˆ 사고 μ˜ˆμ‹œ"
56
+ }
57
+ ```
58
 
59
+ ### Out-of-Scope Use (μ‚¬μš© μ œν•œ)
60
+ - **의료적 진단:** 이 λͺ¨λΈμ€ μ˜μ‚¬κ°€ μ•„λ‹ˆλ©°, μ •μ‹ μ§ˆν™˜μ„ μ§„λ‹¨ν•˜κ±°λ‚˜ 약물을 μ²˜λ°©ν•  수 μ—†μŠ΅λ‹ˆλ‹€.
61
+ - **즉각적인 μœ„κΈ° κ°œμž…:** μžμ‚΄/μžν•΄ λ“± 응급 상황 λ°œμƒ μ‹œ 핫라인 μ•ˆλ‚΄κ°€ ν•„μš”ν•©λ‹ˆλ‹€.
62
 
63
+ ## πŸ’» How to Get Started
64
 
65
+ **Hugging Face Transformers** 라이브러리λ₯Ό μ‚¬μš©ν•˜μ—¬ λ°”λ‘œ μ‹€ν–‰ν•  수 μžˆμŠ΅λ‹ˆλ‹€.
66
 
67
+ ```python
68
+ import torch
69
+ from transformers import AutoTokenizer, AutoModelForCausalLM
70
 
71
+ # Merged Model (μ–΄λŒ‘ν„° 병합 μ™„λ£Œ)
72
+ model_id = "0xMori/gemma-2-9b-safori-cbt-merged"
73
 
74
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
75
+ model = AutoModelForCausalLM.from_pretrained(
76
+ model_id,
77
+ device_map="auto",
78
+ torch_dtype=torch.float16
79
+ )
80
 
81
+ # Alpaca 포맷 (ν•™μŠ΅ μ‹œ μ‚¬μš©ν•œ 포맷 μ€€μˆ˜ ꢌμž₯)
82
+ prompt = """당신은 전문적인 μΈοΏ½οΏ½ν–‰λ™μΉ˜λ£Œ(CBT) AI 상담사 'λ„λž€μ΄'μž…λ‹ˆλ‹€.
83
+ ### μ‚¬μš©μž μž…λ ₯:
84
+ μ‚¬λžŒλ“€μ΄ λ‹€ λ‚˜λ₯Ό μ‹«μ–΄ν•˜λŠ” 것 κ°™μ•„μ„œ λͺ¨μž„에 λ‚˜κ°€κΈ°κ°€ λ‘λ €μ›Œ.
85
+ ### 응닡 (JSON):
86
+ ""
87
 
88
+ input_ids = tokenizer(prompt, return_tensors="pt").to("cuda")
89
 
90
+ outputs = model.generate(
91
+ **input_ids,
92
+ max_new_tokens=512,
93
+ do_sample=True,
94
+ temperature=0.7,
95
+ top_p=0.9
96
+ )
97
 
98
+ print(tokenizer.decode(outputs[0], skip_special_tokens=True))
99
+ ```
100
 
101
+ ## βš™οΈ Training Details
 
 
102
 
103
  ### Training Data
104
+ - **Custom Dataset (Safori CBT):** μΈμ§€ν–‰λ™μΉ˜λ£Œ 이둠을 λ°”νƒ•μœΌλ‘œ 자체 κ΅¬μΆ•ν•œ κ³ ν’ˆμ§ˆ ν•œκ΅­μ–΄ 상담 λŒ€ν™”μ…‹ (μ•½ 400건).
105
+ - **Preprocessing:**
106
+ - `Input(λ‚΄λ‹΄μž λ°œν™”)` - `Output(JSON ꡬ쑰)` ν˜•νƒœμ˜ Alpaca ν”„λ‘¬ν”„νŠΈ 포맷 적용.
107
+ - λ‹€μ–‘ν•œ 인지 μ™œκ³‘ μœ ν˜•(흑백사고, κ³Όμž‰μΌλ°˜ν™” λ“±)을 골고루 λΆ„ν¬μ‹œν‚΄.
108
 
109
  ### Training Procedure
110
+ - **Technique:** QLoRA (Quantized Low-Rank Adaptation)
111
+ - **Optimization Strategy:**
112
+ - **Early Stopping:** Training Loss 0.65 도달 μ‹œ 과적합 λ°©μ§€λ₯Ό μœ„ν•΄ μ‘°κΈ° μ’…λ£Œ.
113
+ - **Stable Environment:** ν˜Έν™˜μ„± μ΄μŠˆκ°€ μžˆλŠ” Unsloth λŒ€μ‹  **Pure Hugging Face (TRL 0.8.6)** 라이브러리 μ‚¬μš©.
114
+
115
+ - **Hyperparameters:**
116
+ - Learning Rate: 2e-4
117
+ - Batch Size: 1 (Gradient Accumulation: 8) -> Effective Batch Size 8
118
+ - Optimizer: paged_adamw_8bit
119
+ - Quantization: 4-bit (NF4)
120
+ - LoRA Rank (r): 16, Alpha: 16
121
+ - Max Sequence Length: 2048