Eclipse-Senpai commited on
Commit
0392ab3
·
verified ·
1 Parent(s): 91941e4

scrub internal project references from modeling_minspark.py

Browse files
Files changed (1) hide show
  1. modeling_minspark.py +2 -5
modeling_minspark.py CHANGED
@@ -1,6 +1,6 @@
1
  """MinSparkForCausalLM: thin Transformers wrapper around the vendored Meiosis.
2
 
3
- Exact semantics: identical to models/2026-07-meiosis/infer.py's generation
4
  loop (EOS prefix once, truncate to last max_seq_len, effort -> loop count).
5
  No KV cache (min-spark 1.1); right-padding is scoring-only; generation is
6
  single-sequence (enforced in prepare_inputs_for_generation).
@@ -38,7 +38,6 @@ class MinSparkForCausalLM(PreTrainedModel, GenerationMixin):
38
  self.model = Meiosis(config.to_meiosis())
39
  self.post_init() # ties weights (no-op: output == input embedding)
40
 
41
- # -- embeddings ----------------------------------------------------
42
  def get_input_embeddings(self) -> nn.Embedding:
43
  return self.model.embed
44
 
@@ -48,7 +47,6 @@ class MinSparkForCausalLM(PreTrainedModel, GenerationMixin):
48
  def get_output_embeddings(self) -> nn.Embedding:
49
  return self.model.embed # tied: unembed reads embed.weight
50
 
51
- # -- forward -------------------------------------------------------
52
  def forward(
53
  self,
54
  input_ids: torch.Tensor,
@@ -153,7 +151,6 @@ class MinSparkForCausalLM(PreTrainedModel, GenerationMixin):
153
  "interior gaps are not supported"
154
  )
155
 
156
- # -- generation -----------------------------------------------------
157
  def prepare_inputs_for_generation(
158
  self,
159
  input_ids: torch.Tensor,
@@ -165,7 +162,7 @@ class MinSparkForCausalLM(PreTrainedModel, GenerationMixin):
165
  """Build the next forward's inputs. Returns exactly these four keys so
166
  generation machinery (cache_position, position_ids, use_cache) is never
167
  echoed into forward, which has no **kwargs. EOS is prepended BEFORE
168
- truncation (infer.py/loader.py parity — it drops off prompts >max_seq_len);
169
  a supplied attention_mask is extended/truncated in lockstep so its length
170
  always matches the returned input_ids (forward validates mask shape)."""
171
  if input_ids.shape[0] != 1:
 
1
  """MinSparkForCausalLM: thin Transformers wrapper around the vendored Meiosis.
2
 
3
+ Exact semantics: identical to the bundled generate.py's generation
4
  loop (EOS prefix once, truncate to last max_seq_len, effort -> loop count).
5
  No KV cache (min-spark 1.1); right-padding is scoring-only; generation is
6
  single-sequence (enforced in prepare_inputs_for_generation).
 
38
  self.model = Meiosis(config.to_meiosis())
39
  self.post_init() # ties weights (no-op: output == input embedding)
40
 
 
41
  def get_input_embeddings(self) -> nn.Embedding:
42
  return self.model.embed
43
 
 
47
  def get_output_embeddings(self) -> nn.Embedding:
48
  return self.model.embed # tied: unembed reads embed.weight
49
 
 
50
  def forward(
51
  self,
52
  input_ids: torch.Tensor,
 
151
  "interior gaps are not supported"
152
  )
153
 
 
154
  def prepare_inputs_for_generation(
155
  self,
156
  input_ids: torch.Tensor,
 
162
  """Build the next forward's inputs. Returns exactly these four keys so
163
  generation machinery (cache_position, position_ids, use_cache) is never
164
  echoed into forward, which has no **kwargs. EOS is prepended BEFORE
165
+ truncation (generate.py parity — it drops off prompts >max_seq_len);
166
  a supplied attention_mask is extended/truncated in lockstep so its length
167
  always matches the returned input_ids (forward validates mask shape)."""
168
  if input_ids.shape[0] != 1: