ridger commited on
Commit
e96b530
·
verified ·
1 Parent(s): bce91fc

Upload folder using huggingface_hub

Browse files
Files changed (3) hide show
  1. README.md +33 -0
  2. config.json +1 -0
  3. configuration_ouro.py +4 -0
README.md CHANGED
@@ -31,6 +31,39 @@ tags:
31
  - **Cross-Step Consistency**: Intermediate recurrent outputs can serve as reliable proxies for final answers
32
  - **Explicit Thinking Process**: Trained to generate detailed reasoning steps
33
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
  ## Model Architecture
35
 
36
  Based on Ouro-1.4B with additional reasoning fine-tuning:
 
31
  - **Cross-Step Consistency**: Intermediate recurrent outputs can serve as reliable proxies for final answers
32
  - **Explicit Thinking Process**: Trained to generate detailed reasoning steps
33
 
34
+
35
+ ## Configuration
36
+
37
+ ### Recurrent Steps and Adaptive Exit
38
+
39
+ The model's computational behavior can be configured through the `config.json` file:
40
+
41
+ ```json
42
+ {
43
+ "total_ut_steps": 4,
44
+ "early_exit_threshold": 1.0
45
+ }
46
+ ```
47
+
48
+ - **`total_ut_steps`**: Controls the number of recurrent steps (default: 4). You can adjust this value to trade off between performance and computation time.
49
+ - **`early_exit_threshold`**: Controls the adaptive exit mechanism (default: 1.0). Lower values encourage earlier exit, while 1.0 means always use all steps.
50
+
51
+ **Example: Modify recurrent steps**
52
+ ```python
53
+ from transformers import AutoConfig, AutoModelForCausalLM
54
+
55
+ config = AutoConfig.from_pretrained("ByteDance/Ouro-1.4B-Thinking")
56
+ config.total_ut_steps = 3 # Use 3 recurrent steps instead of 4
57
+ model = AutoModelForCausalLM.from_pretrained(
58
+ "ByteDance/Ouro-1.4B-Thinking",
59
+ config=config,
60
+ device_map="auto"
61
+ )
62
+ ```
63
+
64
+ > **Note**: vLLM does not currently support the adaptive exit feature due to its inference optimization characteristics. When using vLLM, the model will always execute the full number of `total_ut_steps`.
65
+
66
+
67
  ## Model Architecture
68
 
69
  Based on Ouro-1.4B with additional reasoning fine-tuning:
config.json CHANGED
@@ -54,6 +54,7 @@
54
  "tie_word_embeddings": false,
55
  "torch_dtype": "bfloat16",
56
  "total_ut_steps": 4,
 
57
  "transformers_version": "4.55.0",
58
  "use_cache": true,
59
  "use_sliding_window": false,
 
54
  "tie_word_embeddings": false,
55
  "torch_dtype": "bfloat16",
56
  "total_ut_steps": 4,
57
+ "early_exit_threshold": 1.0,
58
  "transformers_version": "4.55.0",
59
  "use_cache": true,
60
  "use_sliding_window": false,
configuration_ouro.py CHANGED
@@ -169,6 +169,8 @@ class OuroConfig(PretrainedConfig):
169
  max_window_layers=28,
170
  layer_types=None,
171
  attention_dropout=0.0,
 
 
172
  **kwargs,
173
  ):
174
  self.vocab_size = vocab_size
@@ -193,6 +195,8 @@ class OuroConfig(PretrainedConfig):
193
  self.rope_theta = rope_theta
194
  self.rope_scaling = rope_scaling
195
  self.attention_dropout = attention_dropout
 
 
196
  # Validate the correctness of rotary position embeddings parameters
197
  # BC: if there is a 'type' field, move it to 'rope_type'.
198
  if self.rope_scaling is not None and "type" in self.rope_scaling:
 
169
  max_window_layers=28,
170
  layer_types=None,
171
  attention_dropout=0.0,
172
+ total_ut_steps=4,
173
+ early_exit_threshold=1.0,
174
  **kwargs,
175
  ):
176
  self.vocab_size = vocab_size
 
195
  self.rope_theta = rope_theta
196
  self.rope_scaling = rope_scaling
197
  self.attention_dropout = attention_dropout
198
+ self.total_ut_steps = total_ut_steps
199
+ self.early_exit_threshold = early_exit_threshold
200
  # Validate the correctness of rotary position embeddings parameters
201
  # BC: if there is a 'type' field, move it to 'rope_type'.
202
  if self.rope_scaling is not None and "type" in self.rope_scaling: