niqun123123 commited on
Commit
dd134b4
·
verified ·
1 Parent(s): cea9a98

Upload configuration_autojev.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. configuration_autojev.py +32 -0
configuration_autojev.py ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Configuration for a Qwen backbone with a dynamic-option decision head."""
2
+ import math
3
+ from transformers.models.qwen3_5.configuration_qwen3_5 import Qwen3_5Config
4
+
5
+
6
+ class AutoJevConfig(Qwen3_5Config):
7
+ model_type = "autojev_decision"
8
+
9
+ def __init__(self, codes=None, token_ids=None, max_options=255, temperature=1.0,
10
+ base_model="Qwen/Qwen3.8-27B", initialization_step=0,
11
+ max_input_length=8192, **kwargs):
12
+ super().__init__(**kwargs)
13
+ if max_options != 255:
14
+ raise ValueError("This artifact uses exactly 255 option positions")
15
+ if not math.isfinite(temperature) or temperature <= 0:
16
+ raise ValueError("temperature must be positive and finite")
17
+ self.max_options = max_options
18
+ self.codes = list(codes or [])
19
+ self.token_ids = list(token_ids or [])
20
+ if self.codes or self.token_ids:
21
+ if len(self.codes) != max_options or len(set(self.codes)) != max_options:
22
+ raise ValueError("Expected 255 unique answer codes")
23
+ if len(self.token_ids) != max_options or len(set(self.token_ids)) != max_options:
24
+ raise ValueError("Expected 255 unique answer token IDs")
25
+ if any(type(i) is not int or not 0 <= i < self.text_config.vocab_size for i in self.token_ids):
26
+ raise ValueError("Answer token IDs outside base vocabulary")
27
+ self.temperature = float(temperature)
28
+ self.base_model = base_model
29
+ self.initialization_step = initialization_step
30
+ self.max_input_length = int(max_input_length)
31
+ if self.max_input_length < 1:
32
+ raise ValueError("max_input_length must be positive")