2vXpSwA7 commited on
Commit
9d89de8
·
verified ·
1 Parent(s): da8b3d7

Upload tt2ss_key_convert.py

Browse files
Files changed (1) hide show
  1. tt2ss_key_convert.py +2 -10
tt2ss_key_convert.py CHANGED
@@ -25,7 +25,7 @@ suffix_conversion = {
25
  }
26
 
27
  def _match_and_parse(key, regex_text):
28
- """指定された正規表現にキーがマッチするか確認し、結果をパースするヘルパー関数"""
29
  match_list = []
30
  regex = re_compiled.get(regex_text)
31
  if regex is None:
@@ -192,10 +192,6 @@ import torch
192
  from safetensors.torch import load_file, save_file
193
  from safetensors import safe_open
194
 
195
- # ----------------------------------------------------------------
196
- # キー変換ロジック (この部分は変更なし)
197
- # ----------------------------------------------------------------
198
-
199
  re_compiled = {}
200
  re_digits = re.compile(r"\d+")
201
 
@@ -212,7 +208,7 @@ suffix_conversion = {
212
  }
213
 
214
  def _match_and_parse(key, regex_text):
215
- """指定された正規表現にキーがマッチするか確認し、結果をパースするヘルパー関数"""
216
  match_list = []
217
  regex = re_compiled.get(regex_text)
218
  if regex is None:
@@ -327,10 +323,6 @@ def get_new_key(key, is_sd2, output_format):
327
 
328
  return final_stem + key_suffix
329
 
330
- # ----------------------------------------------------------------
331
- # メインの処理 (この部分は変更なし)
332
- # ----------------------------------------------------------------
333
-
334
  def convert_and_save_lora(input_path, output_path, is_sd2, device, output_format):
335
  """
336
  LoRAファイルを読み込み、指定された形式にキーを変換して保存する。
 
25
  }
26
 
27
  def _match_and_parse(key, regex_text):
28
+ """指定された正規表現にキーがマッチするか確認し、結果をパースする関数"""
29
  match_list = []
30
  regex = re_compiled.get(regex_text)
31
  if regex is None:
 
192
  from safetensors.torch import load_file, save_file
193
  from safetensors import safe_open
194
 
 
 
 
 
195
  re_compiled = {}
196
  re_digits = re.compile(r"\d+")
197
 
 
208
  }
209
 
210
  def _match_and_parse(key, regex_text):
211
+ """指定された正規表現にキーがマッチするか確認し、結果をパースする関数"""
212
  match_list = []
213
  regex = re_compiled.get(regex_text)
214
  if regex is None:
 
323
 
324
  return final_stem + key_suffix
325
 
 
 
 
 
326
  def convert_and_save_lora(input_path, output_path, is_sd2, device, output_format):
327
  """
328
  LoRAファイルを読み込み、指定された形式にキーを変換して保存する。