jyliuAI commited on
Commit
fd6d31f
·
verified ·
1 Parent(s): 38cb179

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +111 -0
README.md ADDED
@@ -0,0 +1,111 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - en
4
+ - de
5
+ pipeline_tag: text-generation
6
+ library_name: pytorch
7
+ tags:
8
+ - seq-drifting
9
+ - one-step-generation
10
+ - non-autoregressive
11
+ - text-generation
12
+ - translation
13
+ - summarization
14
+ - reasoning
15
+ ---
16
+
17
+ # One-Step Text Generation by Seq-Drifting
18
+
19
+ [Paper](ARXIV_URL_PLACEHOLDER) · [Code](https://github.com/jyliu-ai/Seq-Drifting)
20
+
21
+ Seq-Drifting generates a text sequence in one generator forward pass, then decodes continuous token representations into discrete tokens. This repository contains checkpoints for unconditional generation, text continuation, translation, summarization, and reasoning.
22
+
23
+ ## Checkpoints
24
+
25
+ | Task | Checkpoint | Setting |
26
+ | --- | --- | --- |
27
+ | Unconditional generation | `unconditional_128_P.pt` | 128 tokens, P |
28
+ | Unconditional generation | `unconditional_128_S.pt` | 128 tokens, S |
29
+ | Unconditional generation | `unconditional_1024_P.pt` | Long sequence, P |
30
+ | Unconditional generation | `unconditional_1024_S.pt` | Long sequence, S |
31
+ | LM1B continuation | `conditional_64_P.pt` | 64-token prefix → 64 tokens, P |
32
+ | LM1B continuation | `conditional_64_S.pt` | 64-token prefix → 64 tokens, S |
33
+ | OpenWebText2 continuation | `conditional_512_P.pt` | 64-token prefix → 512 tokens, P |
34
+ | WMT14 De → En | `WMT.pt` | Translation |
35
+ | XSum | `XSum.pt` | Summarization |
36
+ | SVAMP / ASDiv | `math_reasoning.pt` | Mathematical reasoning |
37
+ | ProofWriter | `proofwriter.pt` | Logical reasoning, true/false |
38
+
39
+ **P** uses public pretrained GPT-2 for support-set construction. **S** uses GPT-2 trained from scratch on the corresponding corpus, then frozen. The 128-token unconditional checkpoints use the conditional architecture at the end of unconditional warmup, with a constant visible prefix. The 1024 checkpoints use the original unconditional architecture; the exact generation length is stored in the checkpoint configuration.
40
+
41
+ ## Usage
42
+
43
+ Use the custom PyTorch loaders and task scripts in the code repository.
44
+
45
+ ```bash
46
+ git clone https://github.com/jyliu-ai/Seq-Drifting.git
47
+ cd Seq-Drifting
48
+ python -m pip install -r requirements.txt
49
+ ```
50
+
51
+ Each test script automatically downloads its checkpoint from this repository. Testing defaults to one GPU and EMA weights.
52
+
53
+ ### Unconditional generation
54
+
55
+ ```bash
56
+ LENGTH=128 VARIANT=P bash scripts/eval_unconditional.sh
57
+ LENGTH=128 VARIANT=S MODEL=/path/to/lm1b-scratch-gpt2 bash scripts/eval_unconditional.sh
58
+
59
+ LENGTH=1024 VARIANT=P bash scripts/eval_unconditional.sh
60
+ LENGTH=1024 VARIANT=S bash scripts/eval_unconditional.sh
61
+ ```
62
+
63
+ ### Conditional generation
64
+
65
+ ```bash
66
+ DATASET=lm1b VARIANT=P TEST_JSON=data/lm1b/test.jsonl bash scripts/eval_conditional.sh
67
+
68
+ DATASET=lm1b VARIANT=S MODEL=/path/to/lm1b-scratch-gpt2 \
69
+ TEST_JSON=data/lm1b/test.jsonl bash scripts/eval_conditional.sh
70
+
71
+ DATASET=owt OWT_DIR=data/openwebtext2 CHECKPOINT=conditional_512_P.pt \
72
+ bash scripts/eval_conditional.sh
73
+ ```
74
+
75
+ ### Translation and summarization
76
+
77
+ ```bash
78
+ python -m common.prepare_seq2seq --dataset wmt14_de_en --output-dir data/wmt14_de_en
79
+ DATA_DIR=data/wmt14_de_en TEACHER=/path/to/original-wmt-support-model CHECKPOINT=WMT.pt \
80
+ bash scripts/eval_translation.sh
81
+
82
+ python -m common.prepare_seq2seq --dataset xsum --output-dir data/xsum
83
+ DATA_DIR=data/xsum TEACHER=/path/to/original-xsum-support-model CHECKPOINT=XSum.pt \
84
+ bash scripts/eval_summarization.sh
85
+ ```
86
+
87
+ ### Reasoning
88
+
89
+ ```bash
90
+ MODEL=Qwen/Qwen2.5-0.5B BACKBONE=Qwen/Qwen2.5-0.5B \
91
+ TEST_JSON=data/svamp_test.jsonl CHECKPOINT=math_reasoning.pt bash scripts/eval_math.sh
92
+
93
+ MODEL=Qwen/Qwen2.5-0.5B BACKBONE=Qwen/Qwen2.5-0.5B \
94
+ TEST_JSON=data/asdiv_test.jsonl CHECKPOINT=math_reasoning.pt bash scripts/eval_math.sh
95
+
96
+ MODEL=Qwen/Qwen2.5-0.5B BACKBONE=Qwen/Qwen2.5-0.5B \
97
+ TEST_JSON=data/proofwriter_all_test.jsonl CHECKPOINT=proofwriter.pt bash scripts/eval_proofwriter.sh
98
+ ```
99
+
100
+ LM1B uses prepared `query`/`response` JSONL. Reasoning uses prepared `question`/`answer` JSONL, with final answers marked by `####` (`generated` can replace `answer`). OpenWebText2 uses `*.jsonl.zst` shards.
101
+
102
+ ## Model paths
103
+
104
+ `MODEL`, `TEACHER`, `EMBED_MODEL`, and `BACKBONE` accept a model ID or a local Hugging Face model directory. `CHECKPOINT` selects the Seq-Drifting `.pt` file.
105
+
106
+ - For 128-token S and conditional S evaluation, `MODEL` must point to the original frozen scratch-trained GPT-2 used for the embedding table.
107
+ - The original 1024 implementation stores the embedding model separately from its training support model. Evaluation reads `embed_model` and `tokenizer_name` from the checkpoint; use `EMBED_MODEL` and `TOKENIZER` to relocate them if needed.
108
+ - WMT/XSum require the original task-specific frozen model for its embedding table. Use `TEACHER` to relocate it, or omit the override if its saved path is available.
109
+ - Reasoning uses the checkpoint's original embedding model and backbone. Override `MODEL` and `BACKBONE` when their saved paths have moved.
110
+
111
+ Training commands and P/S settings are listed in the [code README](https://github.com/jyliu-ai/Seq-Drifting#readme). Evaluation reports fluency/diversity for open-ended generation, BLEU for translation, ROUGE for summarization, and answer accuracy for reasoning. Experimental results are in the paper.