mrfakename commited on
Commit
573876e
·
verified ·
1 Parent(s): d19d0d8

Upgrade to 1.2

Browse files
Files changed (1) hide show
  1. app.py +18 -18
app.py CHANGED
@@ -73,9 +73,9 @@ hf_token = os.environ.get("HF_TOKEN")
73
  lora_v1_path = snapshot_download(repo_id="mrfakename/EmoAct-MiMo", token=hf_token)
74
  print(f"LoRA v1.0 weights downloaded to: {lora_v1_path}")
75
 
76
- print("Downloading EmoAct-MiMo v1.1 (Beta) LoRA weights...")
77
- lora_v1_1_path = snapshot_download(repo_id="mrfakename/EmoAct-MiMo-v1.1", token=hf_token)
78
- print(f"LoRA v1.1 (Beta) weights downloaded to: {lora_v1_1_path}")
79
 
80
  # Load tokenizer and get special tokens
81
  print("Loading tokenizer...")
@@ -123,30 +123,30 @@ merged_model_v1.save_pretrained(merged_model_v1_path)
123
  tokenizer.save_pretrained(merged_model_v1_path)
124
  print(f"Merged model v1.0 saved to {merged_model_v1_path}")
125
 
126
- # Load base model for v1.1
127
- print("Loading base MiMo-Audio model for v1.1...")
128
  base_model_v1_1 = MiMoAudioForCausalLM.from_pretrained(
129
  base_model_path,
130
  args=model_args,
131
  torch_dtype=torch.bfloat16,
132
  device_map="auto",
133
  )
134
- print("Base model v1.1 loaded")
135
 
136
- # Load and merge LoRA v1.1
137
- print("Loading LoRA v1.1 (Beta) adapter...")
138
  model_with_lora_v1_1 = PeftModel.from_pretrained(base_model_v1_1, lora_v1_1_path)
139
- print("Merging LoRA v1.1 (Beta) weights...")
140
  merged_model_v1_1 = model_with_lora_v1_1.merge_and_unload()
141
- print("LoRA v1.1 (Beta) weights merged!")
142
 
143
- # Save merged model v1.1 to temporary directory
144
- print("Saving merged model v1.1...")
145
  merged_model_v1_1_path = "/tmp/merged_mimo_audio_v1_1"
146
  os.makedirs(merged_model_v1_1_path, exist_ok=True)
147
  merged_model_v1_1.save_pretrained(merged_model_v1_1_path)
148
  tokenizer.save_pretrained(merged_model_v1_1_path)
149
- print(f"Merged model v1.1 (Beta) saved to {merged_model_v1_1_path}")
150
 
151
  # Initialize both MimoAudio models
152
  print("Initializing MimoAudio wrappers...")
@@ -163,7 +163,7 @@ print("Both models ready!")
163
  # Dictionary to store models
164
  models = {
165
  "EmoAct-MiMo v1.0 (Stable)": model_v1,
166
- "EmoAct-MiMo v1.1 (Beta - Experimental)": model_v1_1
167
  }
168
 
169
  @spaces.GPU
@@ -218,10 +218,10 @@ with gr.Blocks(title="EmoAct-MiMo TTS") as demo:
218
  with gr.Row():
219
  with gr.Column():
220
  model_selector = gr.Dropdown(
221
- choices=["EmoAct-MiMo v1.0 (Stable)", "EmoAct-MiMo v1.1 (Beta - Experimental)"],
222
  value="EmoAct-MiMo v1.0 (Stable)",
223
  label="Model Selection",
224
- info="v1.0 is the current stable model. v1.1 is a beta experimental version with potentially different characteristics."
225
  )
226
  emotion_input = gr.Textbox(
227
  label="Emotion",
@@ -269,12 +269,12 @@ with gr.Blocks(title="EmoAct-MiMo TTS") as demo:
269
  "YES! YES! I DID IT! (laughs breathlessly) I can't believe it actually worked! This is... this is everything I've ever dreamed of! I'm so happy I could cry!"
270
  ],
271
  [
272
- "EmoAct-MiMo v1.1 (Beta - Experimental)",
273
  "crushing despair, hopelessness, depression, and deep emotional pain, speaking without any accent",
274
  "What's the point anymore? I've tried everything. Nothing changes. Nothing ever gets better. I'm so tired of pretending I'm okay when I'm falling apart inside."
275
  ],
276
  [
277
- "EmoAct-MiMo v1.1 (Beta - Experimental)",
278
  "bitter jealousy, envy, resentment, and seething frustration, speaking without any accent",
279
  "Of course they chose you. They always choose you. <laugh> Must be nice, having everything handed to you while the rest of us break our backs. You don't even appreciate what you have."
280
  ]
 
73
  lora_v1_path = snapshot_download(repo_id="mrfakename/EmoAct-MiMo", token=hf_token)
74
  print(f"LoRA v1.0 weights downloaded to: {lora_v1_path}")
75
 
76
+ print("Downloading EmoAct-MiMo v1.2 (Beta) LoRA weights...")
77
+ lora_v1_1_path = snapshot_download(repo_id="mrfakename/EmoAct-MiMo-v1.2", token=hf_token)
78
+ print(f"LoRA v1.2 (Beta) weights downloaded to: {lora_v1_1_path}")
79
 
80
  # Load tokenizer and get special tokens
81
  print("Loading tokenizer...")
 
123
  tokenizer.save_pretrained(merged_model_v1_path)
124
  print(f"Merged model v1.0 saved to {merged_model_v1_path}")
125
 
126
+ # Load base model for v1.2
127
+ print("Loading base MiMo-Audio model for v1.2...")
128
  base_model_v1_1 = MiMoAudioForCausalLM.from_pretrained(
129
  base_model_path,
130
  args=model_args,
131
  torch_dtype=torch.bfloat16,
132
  device_map="auto",
133
  )
134
+ print("Base model v1.2 loaded")
135
 
136
+ # Load and merge LoRA v1.2
137
+ print("Loading LoRA v1.2 (Beta) adapter...")
138
  model_with_lora_v1_1 = PeftModel.from_pretrained(base_model_v1_1, lora_v1_1_path)
139
+ print("Merging LoRA v1.2 (Beta) weights...")
140
  merged_model_v1_1 = model_with_lora_v1_1.merge_and_unload()
141
+ print("LoRA v1.2 (Beta) weights merged!")
142
 
143
+ # Save merged model v1.2 to temporary directory
144
+ print("Saving merged model v1.2...")
145
  merged_model_v1_1_path = "/tmp/merged_mimo_audio_v1_1"
146
  os.makedirs(merged_model_v1_1_path, exist_ok=True)
147
  merged_model_v1_1.save_pretrained(merged_model_v1_1_path)
148
  tokenizer.save_pretrained(merged_model_v1_1_path)
149
+ print(f"Merged model v1.2 (Beta) saved to {merged_model_v1_1_path}")
150
 
151
  # Initialize both MimoAudio models
152
  print("Initializing MimoAudio wrappers...")
 
163
  # Dictionary to store models
164
  models = {
165
  "EmoAct-MiMo v1.0 (Stable)": model_v1,
166
+ "EmoAct-MiMo v1.2 (Beta - Experimental)": model_v1_1
167
  }
168
 
169
  @spaces.GPU
 
218
  with gr.Row():
219
  with gr.Column():
220
  model_selector = gr.Dropdown(
221
+ choices=["EmoAct-MiMo v1.0 (Stable)", "EmoAct-MiMo v1.2 (Beta - Experimental)"],
222
  value="EmoAct-MiMo v1.0 (Stable)",
223
  label="Model Selection",
224
+ info="v1.0 is the current stable model. v1.2 is a beta experimental version with potentially different characteristics."
225
  )
226
  emotion_input = gr.Textbox(
227
  label="Emotion",
 
269
  "YES! YES! I DID IT! (laughs breathlessly) I can't believe it actually worked! This is... this is everything I've ever dreamed of! I'm so happy I could cry!"
270
  ],
271
  [
272
+ "EmoAct-MiMo v1.2 (Beta - Experimental)",
273
  "crushing despair, hopelessness, depression, and deep emotional pain, speaking without any accent",
274
  "What's the point anymore? I've tried everything. Nothing changes. Nothing ever gets better. I'm so tired of pretending I'm okay when I'm falling apart inside."
275
  ],
276
  [
277
+ "EmoAct-MiMo v1.2 (Beta - Experimental)",
278
  "bitter jealousy, envy, resentment, and seething frustration, speaking without any accent",
279
  "Of course they chose you. They always choose you. <laugh> Must be nice, having everything handed to you while the rest of us break our backs. You don't even appreciate what you have."
280
  ]