aashish1904 commited on
Commit
8a4e375
1 Parent(s): c316f87

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +266 -0
README.md ADDED
@@ -0,0 +1,266 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ ---
3
+
4
+ base_model: meta-llama/Llama-3.2-3B-Instruct
5
+ library_name: sft
6
+ datasets:
7
+ - lianghsun/tw-emergency-medicine-bench
8
+ - lianghsun/tw-legal-nlp
9
+ - lianghsun/tw-structured-law-article
10
+ - lianghsun/tw-legal-synthetic-qa
11
+ - lianghsun/tw-law-article-qa
12
+ - lianghsun/tw-judgment-qa
13
+ - lianghsun/tw-bar-examination-2020-chat
14
+ tags:
15
+ - legal
16
+ - TW
17
+ - Taiwan
18
+ - ROC
19
+ license: llama3.2
20
+ language:
21
+ - zh
22
+ pipeline_tag: text-generation
23
+
24
+ ---
25
+
26
+ [![QuantFactory Banner](https://lh7-rt.googleusercontent.com/docsz/AD_4nXeiuCm7c8lEwEJuRey9kiVZsRn2W-b4pWlu3-X534V3YmVuVc2ZL-NXg2RkzSOOS2JXGHutDuyyNAUtdJI65jGTo8jT9Y99tMi4H4MqL44Uc5QKG77B0d6-JfIkZHFaUA71-RtjyYZWVIhqsNZcx8-OMaA?key=xt3VSDoCbmTY7o-cwwOFwQ)](https://hf.co/QuantFactory)
27
+
28
+
29
+ # QuantFactory/Llama-3.2-Taiwan-Legal-3B-Instruct-GGUF
30
+ This is quantized version of [lianghsun/Llama-3.2-Taiwan-Legal-3B-Instruct](https://huggingface.co/lianghsun/Llama-3.2-Taiwan-Legal-3B-Instruct) created using llama.cpp
31
+
32
+ # Original Model Card
33
+
34
+
35
+ # Model Card for Model lianghsun/Llama-3.2-Taiwan-Legal-3B-Instruct
36
+ ![Training Status](https://img.shields.io/badge/training-in%20progress-orange) ![Epoch Progress](https://img.shields.io/badge/epoch-10%25-yellow) ![Welcome Feedback](https://img.shields.io/badge/welcome-feedback-brightgreen)
37
+
38
+
39
+ ![image/png](https://cdn-uploads.huggingface.co/production/uploads/618dc56cbc345ca7bf95f3cd/W6-UDg0_cNm4WJVlR9tiD.png)
40
+ 基於 [meta-llama/Llama-3.2-3B-Instruct](meta-llama/Llama-3.2-3B-Instruct) 模型,透過中華民國台灣法律條文及判決書等相關資料集進行微調。
41
+
42
+ ## Model Details
43
+
44
+ ### Model Description
45
+
46
+ 基於 [meta-llama/Llama-3.2-3B-Instruct](meta-llama/Llama-3.2-3B-Instruct) 模型,此微調過程使用了來自中華民國台灣的法律條文與相關判決書資料集,以提升模型在法律領域的專業知識與應用能力。這些資料集涵蓋了法律條文的結構、判決書的格式,法庭上常見的法律語言與術語,並包含了部分法律資料科學任務的應用,使模型能夠更準確地理解和處理與台灣法律體系相關的問題。經過這些微調,模型將能夠更好地為法律專業人士提供幫助,並在台灣法制框架內提供更精準的回應與建議。
47
+
48
+ - **Developed by:** [Huang Liang Hsun](https://www.linkedin.com/in/lianghsunhuang)
49
+ - **Model type:** LlamaForCausalLM
50
+ - **Language(s) (NLP)**: 主要處理繁體中文(zh-tw),針對中華民國台灣的法律用語與判決書進行微調。
51
+ - **License**: [llama3.2](https://huggingface.co/meta-llama/Llama-3.2-1B/blob/main/LICENSE.txt)
52
+ - **Finetuned from model**: [meta-llama/Llama-3.2-3B-Instruct](meta-llama/Llama-3.2-3B-Instruct)
53
+
54
+ ### Model Sources
55
+
56
+ - **Repository:** [lianghsun/Llama-3.2-Taiwan-Legal-3B-Instruct](https://huggingface.co/lianghsun/Llama-3.2-Taiwan-Legal-3B-Instruct)
57
+ - **Demo:** (WIP)
58
+
59
+ ## Uses
60
+
61
+ <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
62
+
63
+ ### Direct Use
64
+
65
+ <!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
66
+ 此模型可以直接用於理解和生成繁體中文法律文本,適合需要處理台灣法律相關問題的應用場景。模型預設的指令和回應能夠有效提供法律資訊、釐清法律條文、並生成符合法律專業的回應。其直接使用範圍包括但不限於法律資訊查詢、法律文本摘要、和基本的法條對話。
67
+
68
+ ### Downstream Use
69
+
70
+ <!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
71
+ 經過微調後,該模型可用於更具體的法律任務,如自動判決書分析、法律實體識別(NER)、法規編號轉換,以及法律合規審查輔助。此模型可以無縫集成至法律數據科學應用或法律技術(LegalTech)系統中,幫助法律專業人士或企業提升工作效率。
72
+
73
+ ### Out-of-Scope Use
74
+
75
+ <!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
76
+ 該模型並不適用於非法律相關領域的生成任務,且不應用於進行可能涉及誤導或錯誤的法律建議,尤其是在未經專業審查的情況下。避免將模型用於未經授權或非法用途,如生成具爭議性或具偏見的法律建議。
77
+
78
+ ## Bias, Risks, and Limitations
79
+
80
+ 模型在生成法律條文和判決書內容時,可能會生成虛構或不存在的法條或判決書內容,這是模型的內在限制之一。使用者在參考這些資料時,應謹慎檢查生成的內容,並避免將模型輸出視為法律依據。建議在實際應用中,將模型生成的結果與可靠的法律見解和來源進行比對,確保準確性、合法性和適用性。
81
+
82
+ ### Recommendations
83
+
84
+ <!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
85
+
86
+ 此模型雖然經過法律文本的微調,但在於法律文本的數量及基礎模型為 SLM,模型能���仍有極限,使用者應注意以下風險與限制:
87
+
88
+ 1. **偏見風險**:
89
+ 模型可能會反映其訓練資料中的潛在偏見。由於法律文本的特定性,模型可能更熟悉某些法規、條文或判決案例,而在其他領域表現較弱。特別是在處理不常見的法律問題或未被訓練過的新法規時,模型的輸出可能會帶有偏見。
90
+
91
+ 2. **技術限制**:
92
+ 雖然模型能夠處理大部分的法律文本,但對於結構極其複雜或語言模棱兩可的法律條文,模型可能無法產生精確的回答。使用者應避免完全依賴模型的輸出,尤其在法律決策過程中,建議進行額外的專業檢查。
93
+
94
+ 3. **法律責任**:
95
+ 模型並非專業法律顧問,因此其生成的回應不應被視為正確的法律建議。使用者應確保在理性且專業背景下進行模型的應用,並避免在關鍵決策中過度依賴模型。
96
+
97
+ 4. **誤用風險**:
98
+ 不當使用模型進行錯誤或誤導性的法律建議,可能對個人或企業造成負面影響。使用者應謹慎應用模型於合規或法律相關任務中,並保持對其輸出的檢視及校正。
99
+
100
+ 為了減少這些風險,建議使用者在應用模型輸出時進行二次檢查,特別是在涉及法律決策的情境中。本模型現階段為提供法律科技領域進行大語言模型研究,並非取代專業法律工作者之專業建議。
101
+
102
+ ## How to Get Started with the Model
103
+
104
+ ### Using vLLM
105
+
106
+ 要使用 [vLLM Docker image](https://docs.vllm.ai/en/latest/serving/deploying_with_docker.html) 來啟動此模型,您可以按照以下操作:
107
+ ```
108
+ docker run --runtime nvidia --gpus all \
109
+ -v ~/.cache/huggingface:/root/.cache/huggingface \
110
+ --env "HUGGING_FACE_HUB_TOKEN=<secret>" \
111
+ -p 8000:8000 \
112
+ --ipc=host \
113
+ vllm/vllm-openai:latest \
114
+ --model lianghsun/Llama-3.2-Taiwan-Legal-3B-Instruct
115
+ ```
116
+
117
+ ## Training Details
118
+
119
+ ### Training Data
120
+
121
+ - [lianghsun/tw-legal-nlp](https://huggingface.co/datasets/lianghsun/tw-legal-nlp)
122
+ - [lianghsun/tw-structured-law-article](https://huggingface.co/datasets/lianghsun/tw-structured-law-article)
123
+ - [lianghsun/tw-legal-synthetic-qa](https://huggingface.co/datasets/lianghsun/tw-legal-synthetic-qa)
124
+ - [lianghsun/tw-law-article-qa](https://huggingface.co/datasets/lianghsun/tw-law-article-qa)
125
+ - [lianghsun/tw-judgment-qa](https://huggingface.co/datasets/lianghsun/tw-judgment-qa)
126
+ - [lianghsun/tw-bar-examination-2020-chat](https://huggingface.co/datasets/lianghsun/tw-bar-examination-2020-chat)
127
+ - [lianghsun/tw-emergency-medicine-bench](https://huggingface.co/datasets/lianghsun/tw-emergency-medicine-bench)
128
+
129
+
130
+ ### Training Procedure
131
+
132
+ <!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
133
+
134
+ #### Preprocessing
135
+
136
+ 無。基本上我們並沒有針對 [meta-llama/Llama-3.2-3B-Instruct](meta-llama/Llama-3.2-3B-Instruct) 做任何的預訓練或更改其模型架構;Tokenizer 也是採用原生所提供的。
137
+
138
+ #### Training Hyperparameters
139
+
140
+ - **Training regime**: bf16 mixed precision
141
+ - **Learning rate**: 5e-06
142
+ - **Batch size**: 6 (per device)
143
+ - **Epochs**: 10 *(Note: 由於算力成本考量,在 `epoch: 0.78` 就停止訓練)*
144
+ - **Gradient accumulation steps**: 8
145
+ - **Cutoff length**: 2048
146
+ - **Scheduler**: cosine
147
+ - **Optimizer**: adamw_torch
148
+ - **Max gradient norm**: 1.0
149
+ - **Warmup steps**: 100
150
+ - **Logging steps**: 5
151
+ - **Save steps**: 1000
152
+ - **Max samples**: 1,500,000
153
+
154
+ #### Speeds, Sizes, Times
155
+
156
+ <!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
157
+ *Note: 由於算力成本考量,在 `epoch: 0.78` 就停止訓練,故以下資訊會有部份缺陷及不具參考價值*
158
+
159
+ - **Duration**: 6h 12m 13s
160
+ - **Train runtime**: 22,333 seconds
161
+ - **Train samples per second**: `nan`
162
+ - **Train steps per second**: `nan`
163
+ - **Total training FLOPs**: `nan`
164
+ - **Train loss**: `nan` (final loss: 0.3377)
165
+
166
+ ## Evaluation
167
+
168
+ <!-- This section describes the evaluation protocols and provides the results. -->
169
+ **Note**: ..(WIP)..
170
+
171
+ ### Testing Data, Factors & Metrics
172
+
173
+ #### Testing Data
174
+
175
+ <!-- This should link to a Dataset Card if possible. -->
176
+
177
+ **Note**: ..(WIP)..
178
+
179
+ #### Factors
180
+
181
+ <!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
182
+
183
+ **Note**: ..(WIP)..
184
+
185
+ #### Metrics
186
+
187
+ <!-- These are the evaluation metrics being used, ideally with a description of why. -->
188
+
189
+ **Note**: ..(WIP)..
190
+
191
+ ### Results
192
+
193
+ **Note**: ..(WIP)..
194
+
195
+ #### Summary
196
+
197
+ **Note**: ..(WIP)..
198
+
199
+ ## Model Examination
200
+
201
+ ### 法條回覆
202
+
203
+ **Note**: ..(WIP)..
204
+
205
+ ### 判決書內容
206
+
207
+ **Note**: ..(WIP)..
208
+
209
+ ### 法律 NLP 任務
210
+
211
+ **Note**: ..(WIP)..
212
+
213
+
214
+ ## Environmental Impact
215
+
216
+ - **Hardware Type:** 8 x NVIDIA A100 40GB
217
+ - **Hours used:** 6.03 hours
218
+ - **Cloud Provider:** Google Cloud Platform
219
+ - **Compute Region:** us-central1-c
220
+ - **Carbon Emitted:** `0.86 kgCO$_2$eq`
221
+
222
+ ## Technical Specifications
223
+
224
+ ### Model Architecture and Objective
225
+
226
+ 本模型基於 `meta-llama/Llama-3.2-3B-Instruct`,使用自回歸 Transformer 架構進行語言建模。該模型的主要目標是提升對台灣法律文本的理解與生成能力,尤其是針對判決書、法條的專業處理與應用。透過專門設計的法律文本集進行微調,模型能更精確地回答法律問題並提供相關建議。
227
+
228
+ ### Compute Infrastructure
229
+
230
+ #### Hardware
231
+
232
+ - 8 x NVIDIA A100 40GB
233
+
234
+ #### Software
235
+
236
+ - 微調過程使用了 [hiyouga/LLaMA-Factory](https://github.com/hiyouga/LLaMA-Factory) 框架進行訓練。
237
+
238
+ ## Citation
239
+
240
+ 無。
241
+
242
+ ## Glossary
243
+
244
+ 無。
245
+
246
+ ## More Information
247
+
248
+ ### 算力
249
+ 儘管我們已準備了許多關於中華民國台灣法律領域的資料集,但由於算力資源有限,**無法將所有資料集進行完整訓練**(是的,我們並沒有將全部資料集都進行訓練,僅取出被認為最基礎的法律文本),導致模型尚未達到最佳表現。因此,目前的 checkpoint 是基於有限資源的版本。如果您有意願贊助算力,歡迎與我聯繫。我相信,若能將更多已準備但尚未納入訓練的法律語料進行微調,該模型將能達到繁體中文法律領域的最佳表現。
250
+
251
+ **另外**,和 [lianghsun/Llama-3.2-Taiwan-Legal-1B-Instruct](https://huggingface.co/lianghsun/Llama-3.2-Taiwan-Legal-1B-Instruct) 相較之下,又因為算力成本考量, [lianghsun/Llama-3.2-Taiwan-Legal-3B-Instruct](https://huggingface.co/lianghsun/Llama-3.2-Taiwan-Legal-3B-Instruct) 未訓練到 1 epoch,所以在表現上又更加不如預期。
252
+
253
+ ### 持績更新
254
+ 此模型如有進一步資源,將會不定期更新。
255
+
256
+ ## Model Card Authors
257
+
258
+ [Huang Liang Hsun](https://www.linkedin.com/in/lianghsunhuang)
259
+
260
+ ## Model Card Contact
261
+
262
+ [Huang Liang Hsun](https://www.linkedin.com/in/lianghsunhuang)
263
+
264
+ ### Framework versions
265
+
266
+ - PEFT 0.12.0