Upload folder using huggingface_hub
Browse files- README.md +22 -0
- colar_r1_cot.ckpt +3 -0
- hparams.yaml +108 -0
README.md
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
base_model: deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B
|
| 3 |
+
library_name: peft
|
| 4 |
+
pipeline_tag: text-generation
|
| 5 |
+
tags:
|
| 6 |
+
- latent-reasoning
|
| 7 |
+
- colar
|
| 8 |
+
- research
|
| 9 |
+
---
|
| 10 |
+
# colar-r1-cot
|
| 11 |
+
|
| 12 |
+
R1 CoT 基座阶段(纯 CoT 预热, 10ep)
|
| 13 |
+
|
| 14 |
+
- **Base model:** `deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B`
|
| 15 |
+
- **Files:** `colar_r1_cot.ckpt`, `hparams.yaml`
|
| 16 |
+
|
| 17 |
+
## Loading (PyTorch-Lightning checkpoint — NOT AutoModel-loadable)
|
| 18 |
+
Weights live under the top-level key `['state_dict']` and only fit the custom CoLaR scaffold (base LLM + `[PAD]` resize + r128 q/v LoRA + a `LatentPolicy` MLP), loaded `strict=False`. Load the base separately and splice this `state_dict` in. Runtime env:
|
| 19 |
+
```
|
| 20 |
+
COLAR_BASE=<base> COLAR_CKPT=colar-gsm/colar_best.ckpt COLAR_EMB_STD=0.018 COLAR_COMPRESS=5 COLAR_MAXLAT=64 TORCH_FORCE_NO_WEIGHTS_ONLY_LOAD=1
|
| 21 |
+
```
|
| 22 |
+
`TORCH_FORCE_NO_WEIGHTS_ONLY_LOAD=1` is required for these older Lightning ckpts.
|
colar_r1_cot.ckpt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b123152c6a1b60e4bcf688755ebe548ca02310e39cf81a4f9e96f90d640f426a
|
| 3 |
+
size 69792287
|
hparams.yaml
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
model_kwargs:
|
| 2 |
+
model_id: DeepSeek-R1-Distill-Qwen-1.5B
|
| 3 |
+
sft_method: cot
|
| 4 |
+
chat_template: false
|
| 5 |
+
do_lora: true
|
| 6 |
+
lora_config:
|
| 7 |
+
r: 128
|
| 8 |
+
lora_alpha: 32
|
| 9 |
+
answer_generation_config:
|
| 10 |
+
max_new_tokens: 256
|
| 11 |
+
do_sample: true
|
| 12 |
+
top_p: 0.9
|
| 13 |
+
temperature: 1.0
|
| 14 |
+
training_kwargs:
|
| 15 |
+
optimizer:
|
| 16 |
+
target: torch.optim.AdamW
|
| 17 |
+
lr: 0.0001
|
| 18 |
+
weight_decay: 0.01
|
| 19 |
+
use_scheduler: false
|
| 20 |
+
scheduler:
|
| 21 |
+
target: constant_schedule_with_warmup
|
| 22 |
+
warmup_steps: 1000
|
| 23 |
+
all_config:
|
| 24 |
+
trainer:
|
| 25 |
+
target: lightning.pytorch.trainer.Trainer
|
| 26 |
+
devices:
|
| 27 |
+
- 0
|
| 28 |
+
max_steps: -1
|
| 29 |
+
check_val_every_n_epoch: 1
|
| 30 |
+
log_every_n_steps: 10
|
| 31 |
+
num_sanity_val_steps: 2
|
| 32 |
+
gradient_clip_val: 1.0
|
| 33 |
+
reload_dataloaders_every_n_epochs: 0
|
| 34 |
+
accumulate_grad_batches: 4
|
| 35 |
+
precision: bf16-mixed
|
| 36 |
+
use_distributed_sampler: true
|
| 37 |
+
strategy: auto
|
| 38 |
+
logger:
|
| 39 |
+
target: lightning.pytorch.loggers.TensorBoardLogger
|
| 40 |
+
save_dir: logs/cot
|
| 41 |
+
name: qsa-gsm_math
|
| 42 |
+
version: 20260725-205605_408408_cot_r1
|
| 43 |
+
max_epochs: 10
|
| 44 |
+
callbacks:
|
| 45 |
+
- target: lightning.pytorch.callbacks.ModelCheckpoint
|
| 46 |
+
save_last: true
|
| 47 |
+
save_top_k: 3
|
| 48 |
+
mode: max
|
| 49 |
+
monitor: monitor
|
| 50 |
+
auto_insert_metric_name: false
|
| 51 |
+
filename: epoch{epoch}__step{step}__monitor{monitor:.3f}
|
| 52 |
+
save_weights_only: true
|
| 53 |
+
seed: null
|
| 54 |
+
model:
|
| 55 |
+
target: src.models.cot.LitCot
|
| 56 |
+
model_kwargs:
|
| 57 |
+
model_id: DeepSeek-R1-Distill-Qwen-1.5B
|
| 58 |
+
sft_method: cot
|
| 59 |
+
chat_template: false
|
| 60 |
+
do_lora: true
|
| 61 |
+
lora_config:
|
| 62 |
+
r: 128
|
| 63 |
+
lora_alpha: 32
|
| 64 |
+
answer_generation_config:
|
| 65 |
+
max_new_tokens: 256
|
| 66 |
+
do_sample: true
|
| 67 |
+
top_p: 0.9
|
| 68 |
+
temperature: 1.0
|
| 69 |
+
training_kwargs:
|
| 70 |
+
optimizer:
|
| 71 |
+
target: torch.optim.AdamW
|
| 72 |
+
lr: 0.0001
|
| 73 |
+
weight_decay: 0.01
|
| 74 |
+
use_scheduler: false
|
| 75 |
+
scheduler:
|
| 76 |
+
target: constant_schedule_with_warmup
|
| 77 |
+
warmup_steps: 1000
|
| 78 |
+
dataloader:
|
| 79 |
+
batch_size: 4
|
| 80 |
+
val_batch_size: 32
|
| 81 |
+
num_workers: 8
|
| 82 |
+
pin_memory: true
|
| 83 |
+
persistent_workers: true
|
| 84 |
+
data_module:
|
| 85 |
+
target: src.datasets.qsa.QSADataModule
|
| 86 |
+
dataset_name: gsm_math
|
| 87 |
+
tiny_dataset: false
|
| 88 |
+
epoch_scaling: 1
|
| 89 |
+
args:
|
| 90 |
+
model: cot
|
| 91 |
+
dataset: qsa
|
| 92 |
+
trainer: default
|
| 93 |
+
devices: '0'
|
| 94 |
+
no_log: false
|
| 95 |
+
log_suffix: cot_r1
|
| 96 |
+
resume_ckpt_path: null
|
| 97 |
+
load_ckpt_path: null
|
| 98 |
+
workspace_path: /content/ws
|
| 99 |
+
do_test: false
|
| 100 |
+
test_ckpt_path: ''
|
| 101 |
+
test_times: 5
|
| 102 |
+
seed: 0
|
| 103 |
+
unkown_args:
|
| 104 |
+
dataset_name: gsm_math
|
| 105 |
+
model_id: DeepSeek-R1-Distill-Qwen-1.5B
|
| 106 |
+
batch_size: '4'
|
| 107 |
+
accumulate_grad_batches: '4'
|
| 108 |
+
max_epochs: '10'
|