Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
| 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
|
|
@@ -16,7 +16,13 @@ tags:
|
|
| 16 |
- TW
|
| 17 |
- Taiwan
|
| 18 |
- ROC
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
language:
|
| 21 |
- zh
|
| 22 |
pipeline_tag: text-generation
|
|
@@ -32,13 +38,24 @@ This is quantized version of [lianghsun/Llama-3.2-Taiwan-Legal-3B-Instruct](http
|
|
| 32 |
# Original Model Card
|
| 33 |
|
| 34 |
|
| 35 |
-
|
| 36 |
-
|
| 37 |
|
|
|
|
| 38 |
|
| 39 |

|
|
|
|
| 40 |
基於 [meta-llama/Llama-3.2-3B-Instruct](meta-llama/Llama-3.2-3B-Instruct) 模型,透過中華民國台灣法律條文及判決書等相關資料集進行微調。
|
| 41 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
## Model Details
|
| 43 |
|
| 44 |
### Model Description
|
|
@@ -63,16 +80,19 @@ This is quantized version of [lianghsun/Llama-3.2-Taiwan-Legal-3B-Instruct](http
|
|
| 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
|
|
@@ -101,6 +121,8 @@ This is quantized version of [lianghsun/Llama-3.2-Taiwan-Legal-3B-Instruct](http
|
|
| 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) 來啟動此模型,您可以按照以下操作:
|
|
@@ -113,60 +135,54 @@ docker run --runtime nvidia --gpus all \
|
|
| 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
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
- **
|
| 143 |
-
- **
|
| 144 |
-
- **
|
| 145 |
-
- **
|
| 146 |
-
- **
|
| 147 |
-
- **
|
| 148 |
-
- **
|
| 149 |
-
- **
|
| 150 |
-
- **
|
| 151 |
-
- **
|
| 152 |
-
- **
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
- **Duration**:
|
| 160 |
-
- **Train runtime**:
|
| 161 |
-
- **Train samples per second**:
|
| 162 |
-
- **Train steps per second**:
|
| 163 |
-
- **Total training FLOPs**:
|
| 164 |
-
- **Train loss**:
|
| 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 |
|
|
@@ -198,6 +214,8 @@ docker run --runtime nvidia --gpus all \
|
|
| 198 |
|
| 199 |
## Model Examination
|
| 200 |
|
|
|
|
|
|
|
| 201 |
### 法條回覆
|
| 202 |
|
| 203 |
**Note**: ..(WIP)..
|
|
@@ -210,14 +228,13 @@ docker run --runtime nvidia --gpus all \
|
|
| 210 |
|
| 211 |
**Note**: ..(WIP)..
|
| 212 |
|
|
|
|
| 213 |
|
| 214 |
-
|
| 215 |
-
|
| 216 |
-
- **
|
| 217 |
-
- **
|
| 218 |
-
- **
|
| 219 |
-
- **Compute Region:** us-central1-c
|
| 220 |
-
- **Carbon Emitted:** `0.86 kgCO$_2$eq`
|
| 221 |
|
| 222 |
## Technical Specifications
|
| 223 |
|
|
@@ -227,9 +244,9 @@ docker run --runtime nvidia --gpus all \
|
|
| 227 |
|
| 228 |
### Compute Infrastructure
|
| 229 |
|
| 230 |
-
#### Hardware
|
| 231 |
|
| 232 |
-
-
|
| 233 |
|
| 234 |
#### Software
|
| 235 |
|
|
@@ -241,6 +258,7 @@ docker run --runtime nvidia --gpus all \
|
|
| 241 |
|
| 242 |
## Glossary
|
| 243 |
|
|
|
|
| 244 |
無。
|
| 245 |
|
| 246 |
## More Information
|
|
@@ -248,8 +266,6 @@ docker run --runtime nvidia --gpus all \
|
|
| 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 |
|
|
@@ -263,4 +279,7 @@ docker run --runtime nvidia --gpus all \
|
|
| 263 |
|
| 264 |
### Framework versions
|
| 265 |
|
| 266 |
-
-
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
|
| 2 |
---
|
| 3 |
|
| 4 |
+
library_name: transformers
|
| 5 |
+
license: llama3.2
|
| 6 |
base_model: meta-llama/Llama-3.2-3B-Instruct
|
|
|
|
| 7 |
datasets:
|
| 8 |
- lianghsun/tw-emergency-medicine-bench
|
| 9 |
- lianghsun/tw-legal-nlp
|
|
|
|
| 10 |
- lianghsun/tw-legal-synthetic-qa
|
| 11 |
- lianghsun/tw-law-article-qa
|
| 12 |
- lianghsun/tw-judgment-qa
|
|
|
|
| 16 |
- TW
|
| 17 |
- Taiwan
|
| 18 |
- ROC
|
| 19 |
+
- llama-factory
|
| 20 |
+
- full
|
| 21 |
+
- generated_from_trainer
|
| 22 |
+
model-index:
|
| 23 |
+
- name: train_2024-10-17
|
| 24 |
+
results: []
|
| 25 |
+
new_version: lianghsun/Llama-3.2-Taiwan-Legal-3B-Instruct
|
| 26 |
language:
|
| 27 |
- zh
|
| 28 |
pipeline_tag: text-generation
|
|
|
|
| 38 |
# Original Model Card
|
| 39 |
|
| 40 |
|
| 41 |
+
<!-- This model card has been generated automatically according to the information the Trainer had access to. You
|
| 42 |
+
should probably proofread and complete it, then remove this comment. -->
|
| 43 |
|
| 44 |
+
# Model Card for Model lianghsun/Llama-3.2-Taiwan-Legal-3B-Instruct
|
| 45 |
|
| 46 |

|
| 47 |
+
|
| 48 |
基於 [meta-llama/Llama-3.2-3B-Instruct](meta-llama/Llama-3.2-3B-Instruct) 模型,透過中華民國台灣法律條文及判決書等相關資料集進行微調。
|
| 49 |
|
| 50 |
+
## Model Update History
|
| 51 |
+
|
| 52 |
+
| Update Date | Model Version | Key Changes |
|
| 53 |
+
|--------------|-----------------------|-------------------------------------|
|
| 54 |
+
| 2024-10-17 | v1.1.0 | Experimental fine-tuning on v1.0.0 with added legal code data from the Republic of China (Taiwan) |
|
| 55 |
+
| 2024-10-10 | v1.0.0 | Full model training completed, but missing legal code data for the Republic of China (Taiwan) |
|
| 56 |
+
| 2024-09-27 | v0.1.0 | Model v0.1.0 released, but training was interrupted after 3 epochs due to lack of compute resources |
|
| 57 |
+
|
| 58 |
+
|
| 59 |
## Model Details
|
| 60 |
|
| 61 |
### Model Description
|
|
|
|
| 80 |
### Direct Use
|
| 81 |
|
| 82 |
<!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
|
| 83 |
+
|
| 84 |
此模型可以直接用於理解和生成繁體中文法律文本,適合需要處理台灣法律相關問題的應用場景。模型預設的指令和回應能夠有效提供法律資訊、釐清法律條文、並生成符合法律專業的回應。其直接使用範圍包括但不限於法律資訊查詢、法律文本摘要、和基本的法條對話。
|
| 85 |
|
| 86 |
### Downstream Use
|
| 87 |
|
| 88 |
<!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
|
| 89 |
+
|
| 90 |
經過微調後,該模型可用於更具體的法律任務,如自動判決書分析、法律實體識別(NER)、法規編號轉換,以及法律合規審查輔助。此模型可以無縫集成至法律數據科學應用或法律技術(LegalTech)系統中,幫助法律專業人士或企業提升工作效率。
|
| 91 |
|
| 92 |
### Out-of-Scope Use
|
| 93 |
|
| 94 |
<!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
|
| 95 |
+
|
| 96 |
該模型並不適用於非法律相關領域的生成任務,且不應用於進行可能涉及誤導或錯誤的法律建議,尤其是在未經專業審查的情況下。避免將模型用於未經授權或非法用途,如生成具爭議性或具偏見的法律建議。
|
| 97 |
|
| 98 |
## Bias, Risks, and Limitations
|
|
|
|
| 121 |
|
| 122 |
## How to Get Started with the Model
|
| 123 |
|
| 124 |
+
<!-- Use the code below to get started with the model. -->
|
| 125 |
+
|
| 126 |
### Using vLLM
|
| 127 |
|
| 128 |
要使用 [vLLM Docker image](https://docs.vllm.ai/en/latest/serving/deploying_with_docker.html) 來啟動此模型,您可以按照以下操作:
|
|
|
|
| 135 |
vllm/vllm-openai:latest \
|
| 136 |
--model lianghsun/Llama-3.2-Taiwan-Legal-3B-Instruct
|
| 137 |
```
|
|
|
|
| 138 |
## Training Details
|
| 139 |
|
| 140 |
+
### Training Data (for v1.1.0)
|
| 141 |
|
| 142 |
- [lianghsun/tw-legal-nlp](https://huggingface.co/datasets/lianghsun/tw-legal-nlp)
|
|
|
|
| 143 |
- [lianghsun/tw-legal-synthetic-qa](https://huggingface.co/datasets/lianghsun/tw-legal-synthetic-qa)
|
| 144 |
- [lianghsun/tw-law-article-qa](https://huggingface.co/datasets/lianghsun/tw-law-article-qa)
|
| 145 |
- [lianghsun/tw-judgment-qa](https://huggingface.co/datasets/lianghsun/tw-judgment-qa)
|
| 146 |
- [lianghsun/tw-bar-examination-2020-chat](https://huggingface.co/datasets/lianghsun/tw-bar-examination-2020-chat)
|
| 147 |
- [lianghsun/tw-emergency-medicine-bench](https://huggingface.co/datasets/lianghsun/tw-emergency-medicine-bench)
|
| 148 |
|
| 149 |
+
### Training procedure
|
|
|
|
|
|
|
|
|
|
| 150 |
|
| 151 |
#### Preprocessing
|
| 152 |
|
| 153 |
無。基本上我們並沒有針對 [meta-llama/Llama-3.2-3B-Instruct](meta-llama/Llama-3.2-3B-Instruct) 做任何的預訓練或更改其模型架構;Tokenizer 也是採用原生所提供的。
|
| 154 |
|
| 155 |
+
#### Training hyperparameters (for v1.1.0)
|
| 156 |
+
|
| 157 |
+
The following hyperparameters were used during training:
|
| 158 |
+
|
| 159 |
+
- **learning_rate:** 0.0004378 (value at epoch 3.9)
|
| 160 |
+
- **train_batch_size:** 12
|
| 161 |
+
- **eval_batch_size:** Not specified
|
| 162 |
+
- **seed:** Not specified
|
| 163 |
+
- **distributed_type:** single-GPU
|
| 164 |
+
- **num_devices:** 1
|
| 165 |
+
- **gradient_accumulation_steps:** 512
|
| 166 |
+
- **total_train_batch_size:** 6144 (train_batch_size * gradient_accumulation_steps)
|
| 167 |
+
- **optimizer:** AdamW
|
| 168 |
+
- **lr_scheduler_type:** cosine
|
| 169 |
+
- **lr_scheduler_warmup_steps:** 100
|
| 170 |
+
- **num_epochs:** 15
|
| 171 |
+
- **grad_norm:** 0.0899 (value at epoch 3.9)
|
| 172 |
+
- **global_step:** 645
|
| 173 |
+
|
| 174 |
+
### Speeds, Sizes, Times (for v1.1.0)
|
| 175 |
+
|
| 176 |
+
- **Duration**: 92h 27m 40s
|
| 177 |
+
- **Train runtime**: 92h 27m 40s
|
| 178 |
+
- **Train samples per second**: Not directly available
|
| 179 |
+
- **Train steps per second**: Approximately 0.002 steps/s
|
| 180 |
+
- **Total training FLOPs**: Not directly provided
|
| 181 |
+
- **Train loss**: 0.0512 (at epoch 3.9)
|
| 182 |
|
| 183 |
## Evaluation
|
| 184 |
|
| 185 |
<!-- This section describes the evaluation protocols and provides the results. -->
|
|
|
|
| 186 |
|
| 187 |
### Testing Data, Factors & Metrics
|
| 188 |
|
|
|
|
| 214 |
|
| 215 |
## Model Examination
|
| 216 |
|
| 217 |
+
<!-- Relevant interpretability work for the model goes here -->
|
| 218 |
+
|
| 219 |
### 法條回覆
|
| 220 |
|
| 221 |
**Note**: ..(WIP)..
|
|
|
|
| 228 |
|
| 229 |
**Note**: ..(WIP)..
|
| 230 |
|
| 231 |
+
## Environmental Impact (for v1.1.0)
|
| 232 |
|
| 233 |
+
- **Hardware Type:** 1 x NVIDIA H100 NVL 80GB
|
| 234 |
+
- **Hours used:** 92h 27m 40s
|
| 235 |
+
- **Cloud Provider:** N/A
|
| 236 |
+
- **Compute Region:** N/A
|
| 237 |
+
- **Carbon Emitted:** N/A
|
|
|
|
|
|
|
| 238 |
|
| 239 |
## Technical Specifications
|
| 240 |
|
|
|
|
| 244 |
|
| 245 |
### Compute Infrastructure
|
| 246 |
|
| 247 |
+
#### Hardware (for v1.1.0)
|
| 248 |
|
| 249 |
+
- 1 x NVIDIA H100 NVL 80GB
|
| 250 |
|
| 251 |
#### Software
|
| 252 |
|
|
|
|
| 258 |
|
| 259 |
## Glossary
|
| 260 |
|
| 261 |
+
<!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
|
| 262 |
無。
|
| 263 |
|
| 264 |
## More Information
|
|
|
|
| 266 |
### 算力
|
| 267 |
儘管我們已準備了許多關於中華民國台灣法律領域的資料集,但由於算力資源有限,**無法將所有資料集進行完整訓練**(是的,我們並沒有將全部資料集都進行訓練,僅取出被認為最基礎的法律文本),導致模型尚未達到最佳表現。因此,目前的 checkpoint 是基於有限資源的版本。如果您有意願贊助算力,歡迎與我聯繫。我相信,若能將更多已準備但尚未納入訓練的法律語料進行微調,該模型將能達到繁體中文法律領域的最佳表現。
|
| 268 |
|
|
|
|
|
|
|
| 269 |
### 持績更新
|
| 270 |
此模型如有進一步資源,將會不定期更新。
|
| 271 |
|
|
|
|
| 279 |
|
| 280 |
### Framework versions
|
| 281 |
|
| 282 |
+
- Transformers 4.45.2
|
| 283 |
+
- Pytorch 2.4.1+cu121
|
| 284 |
+
- Datasets 2.21.0
|
| 285 |
+
- Tokenizers 0.20.0
|