hainc commited on
Commit ·
8edea13
1
Parent(s): 9414d33
Update README with instructions for uploading model weights
Browse files
README.md
CHANGED
|
@@ -18,14 +18,81 @@ Model này được fine-tuned từ Qwen3-4B-Instruct-2507 cho các tác vụ li
|
|
| 18 |
- **Parameters**: 4.0B
|
| 19 |
- **Context Length**: 262,144 tokens
|
| 20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
## Usage
|
| 22 |
|
|
|
|
|
|
|
| 23 |
```python
|
| 24 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 25 |
|
| 26 |
model_name = "hainguyen306201/bank-model"
|
| 27 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 28 |
-
model = AutoModelForCausalLM.from_pretrained(
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
|
| 30 |
# Sử dụng model...
|
| 31 |
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
- **Parameters**: 4.0B
|
| 19 |
- **Context Length**: 262,144 tokens
|
| 20 |
|
| 21 |
+
## Setup Model Weights
|
| 22 |
+
|
| 23 |
+
Model này hiện đã có đầy đủ config và tokenizer files. Để có thể sử dụng và training, bạn cần upload model weights từ base model Qwen3-4B-Instruct-2507.
|
| 24 |
+
|
| 25 |
+
### Cách 1: Sử dụng script tự động (Khuyến nghị)
|
| 26 |
+
|
| 27 |
+
```bash
|
| 28 |
+
# Cài đặt dependencies
|
| 29 |
+
pip install huggingface_hub transformers
|
| 30 |
+
|
| 31 |
+
# Chạy script để tải và upload model weights
|
| 32 |
+
python upload_model_weights.py
|
| 33 |
+
```
|
| 34 |
+
|
| 35 |
+
Script này sẽ:
|
| 36 |
+
1. Tải toàn bộ model weights từ `Qwen/Qwen3-4B-Instruct-2507` (~8GB)
|
| 37 |
+
2. Upload lên repository `hainguyen306201/bank-model`
|
| 38 |
+
|
| 39 |
+
### Cách 2: Upload thủ công bằng Python
|
| 40 |
+
|
| 41 |
+
```python
|
| 42 |
+
from huggingface_hub import HfApi, snapshot_download
|
| 43 |
+
|
| 44 |
+
# Tải model từ base model
|
| 45 |
+
snapshot_download(
|
| 46 |
+
repo_id="Qwen/Qwen3-4B-Instruct-2507",
|
| 47 |
+
local_dir="./temp_model",
|
| 48 |
+
local_dir_use_symlinks=False
|
| 49 |
+
)
|
| 50 |
+
|
| 51 |
+
# Upload lên bank-model repo
|
| 52 |
+
api = HfApi()
|
| 53 |
+
api.upload_folder(
|
| 54 |
+
folder_path="./temp_model",
|
| 55 |
+
repo_id="hainguyen306201/bank-model",
|
| 56 |
+
repo_type="model",
|
| 57 |
+
ignore_patterns=["*.md", "*.txt"] # Bỏ qua README và các file text
|
| 58 |
+
)
|
| 59 |
+
```
|
| 60 |
+
|
| 61 |
## Usage
|
| 62 |
|
| 63 |
+
Sau khi đã upload model weights, bạn có thể sử dụng model như sau:
|
| 64 |
+
|
| 65 |
```python
|
| 66 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 67 |
|
| 68 |
model_name = "hainguyen306201/bank-model"
|
| 69 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 70 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 71 |
+
model_name,
|
| 72 |
+
torch_dtype="auto",
|
| 73 |
+
device_map="auto"
|
| 74 |
+
)
|
| 75 |
|
| 76 |
# Sử dụng model...
|
| 77 |
```
|
| 78 |
+
|
| 79 |
+
## Training
|
| 80 |
+
|
| 81 |
+
Model này có thể được fine-tune tiếp cho các tác vụ ngân hàng cụ thể:
|
| 82 |
+
|
| 83 |
+
```python
|
| 84 |
+
from transformers import AutoModelForCausalLM, TrainingArguments, Trainer
|
| 85 |
+
|
| 86 |
+
# Load model
|
| 87 |
+
model = AutoModelForCausalLM.from_pretrained("hainguyen306201/bank-model")
|
| 88 |
+
|
| 89 |
+
# Setup training arguments
|
| 90 |
+
training_args = TrainingArguments(
|
| 91 |
+
output_dir="./results",
|
| 92 |
+
num_train_epochs=3,
|
| 93 |
+
per_device_train_batch_size=4,
|
| 94 |
+
# ... các tham số khác
|
| 95 |
+
)
|
| 96 |
+
|
| 97 |
+
# Training...
|
| 98 |
+
```
|