Skip to content

Commit

Permalink
Cleanup some lumina te code.
Browse files Browse the repository at this point in the history
  • Loading branch information
comfyanonymous committed Feb 25, 2025
1 parent 96d891c commit f400760
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions comfy/text_encoders/lumina2.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,6 @@ def __init__(self, embedding_directory=None, tokenizer_data={}):

class Gemma2_2BModel(sd1_clip.SDClipModel):
def __init__(self, device="cpu", layer="hidden", layer_idx=-2, dtype=None, attention_mask=True, model_options={}):
llama_scaled_fp8 = model_options.get("llama_scaled_fp8", None)
if llama_scaled_fp8 is not None:
model_options = model_options.copy()
model_options["scaled_fp8"] = llama_scaled_fp8

super().__init__(device=device, layer=layer, layer_idx=layer_idx, textmodel_json_config={}, dtype=dtype, special_tokens={"start": 2, "pad": 0}, layer_norm_hidden_state=False, model_class=comfy.text_encoders.llama.Gemma2_2B, enable_attention_masks=attention_mask, return_attention_masks=attention_mask, model_options=model_options)


Expand All @@ -35,10 +30,10 @@ def __init__(self, device="cpu", dtype=None, model_options={}):
def te(dtype_llama=None, llama_scaled_fp8=None):
class LuminaTEModel_(LuminaModel):
def __init__(self, device="cpu", dtype=None, model_options={}):
if llama_scaled_fp8 is not None and "llama_scaled_fp8" not in model_options:
if llama_scaled_fp8 is not None and "scaled_fp8" not in model_options:
model_options = model_options.copy()
model_options["llama_scaled_fp8"] = llama_scaled_fp8
if dtype_llama is not None:
dtype = dtype_llama
model_options["scaled_fp8"] = llama_scaled_fp8
if dtype_llama is not None:
dtype = dtype_llama
super().__init__(device=device, dtype=dtype, model_options=model_options)
return LuminaTEModel_

0 comments on commit f400760

Please sign in to comment.