mirror of
https://github.com/xming521/WeClone.git
synced 2026-09-18 00:52:04 +08:00
🎈 auto fixes by pre-commit hooks
This commit is contained in:
@@ -184,7 +184,8 @@ class SparkTTS:
|
||||
|
||||
# Trim the output tokens to remove the input tokens
|
||||
generated_ids = [
|
||||
output_ids[len(input_ids) :] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
|
||||
output_ids[len(input_ids) :]
|
||||
for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
|
||||
]
|
||||
|
||||
# Decode the generated tokens into text
|
||||
@@ -192,7 +193,9 @@ class SparkTTS:
|
||||
|
||||
# Extract semantic token IDs from the generated text
|
||||
pred_semantic_ids = (
|
||||
torch.tensor([int(token) for token in re.findall(r"bicodec_semantic_(\d+)", predicts)]).long().unsqueeze(0)
|
||||
torch.tensor([int(token) for token in re.findall(r"bicodec_semantic_(\d+)", predicts)])
|
||||
.long()
|
||||
.unsqueeze(0)
|
||||
)
|
||||
|
||||
if gender is not None:
|
||||
|
||||
@@ -14,7 +14,9 @@ def main():
|
||||
default=os.path.join(os.path.dirname(__file__), "sample.wav"),
|
||||
help="Path to save the audio file (default: sample.wav in script directory)",
|
||||
)
|
||||
parser.add_argument("--rate", type=int, default=24000, help="Sample rate for audio conversion (default: 24000)")
|
||||
parser.add_argument(
|
||||
"--rate", type=int, default=24000, help="Sample rate for audio conversion (default: 24000)"
|
||||
)
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
|
||||
+3
-1
@@ -203,7 +203,9 @@ def _check_versions():
|
||||
logger.warning(
|
||||
f"警告:您的 settings.jsonc 文件版本 ({settings_version}) 与项目建议的配置版本 ({config_guide_version}) 不一致。"
|
||||
)
|
||||
logger.warning("这可能导致意外行为或错误。请从 settings.template.json 复制或更新您的 settings.jsonc 文件。")
|
||||
logger.warning(
|
||||
"这可能导致意外行为或错误。请从 settings.template.json 复制或更新您的 settings.jsonc 文件。"
|
||||
)
|
||||
# TODO 根据版本号打印更新日志
|
||||
logger.warning(f"配置文件更新日志:\n{config_changelog}")
|
||||
elif PYPROJECT_PATH.exists(): # 如果文件存在但未读到版本
|
||||
|
||||
@@ -24,7 +24,9 @@ def copy_wechat_image_dat(wechat_data_dir):
|
||||
|
||||
data_processor = DataProcessor()
|
||||
if not os.path.exists(data_processor.csv_folder) or not os.listdir(data_processor.csv_folder):
|
||||
print(f"错误:目录 '{data_processor.csv_folder}' 不存在或为空,请检查路径并确保其中包含 CSV 聊天数据文件。")
|
||||
print(
|
||||
f"错误:目录 '{data_processor.csv_folder}' 不存在或为空,请检查路径并确保其中包含 CSV 聊天数据文件。"
|
||||
)
|
||||
return
|
||||
|
||||
csv_files = data_processor.get_csv_files()
|
||||
|
||||
@@ -90,7 +90,9 @@ class DataProcessor:
|
||||
|
||||
def main(self):
|
||||
if not os.path.exists(self.csv_folder) or not os.listdir(self.csv_folder):
|
||||
logger.error(f"错误:目录 '{self.csv_folder}' 不存在或为空,请检查路径并确保其中包含 CSV 聊天数据文件。")
|
||||
logger.error(
|
||||
f"错误:目录 '{self.csv_folder}' 不存在或为空,请检查路径并确保其中包含 CSV 聊天数据文件。"
|
||||
)
|
||||
return
|
||||
|
||||
csv_files = self.get_csv_files()
|
||||
|
||||
@@ -13,7 +13,9 @@ def main():
|
||||
|
||||
chat_model = ChatModel()
|
||||
messages = []
|
||||
print("Welcome to the CLI application, use `clear` to remove the history, use `exit` to exit the application.")
|
||||
print(
|
||||
"Welcome to the CLI application, use `clear` to remove the history, use `exit` to exit the application."
|
||||
)
|
||||
|
||||
while True:
|
||||
try:
|
||||
|
||||
@@ -33,7 +33,9 @@ def load_config(arg_type: str):
|
||||
dataset_info_path = os.path.join(config["dataset_dir"], "dataset_info.json")
|
||||
dataset_info = commentjson.load(open(dataset_info_path, "r", encoding="utf-8"))[config["dataset"]]
|
||||
if dataset_info["columns"].get("history") is None:
|
||||
logger.warning(f"{config['dataset']}数据集不包history字段,尝试使用wechat-sft-with-history数据集")
|
||||
logger.warning(
|
||||
f"{config['dataset']}数据集不包history字段,尝试使用wechat-sft-with-history数据集"
|
||||
)
|
||||
config["dataset"] = "wechat-sft-with-history"
|
||||
if "image" in s_config["make_dataset_args"]["include_type"]:
|
||||
config["dataset"] = "wechat-mllm-sft"
|
||||
|
||||
@@ -57,7 +57,9 @@ def length_cdf(
|
||||
)
|
||||
tokenizer_module = load_tokenizer(model_args)
|
||||
template = get_template_and_fix_tokenizer(tokenizer_module["tokenizer"], data_args) # type: ignore
|
||||
trainset = get_dataset(template, model_args, data_args, training_args, "sft", **tokenizer_module)["train_dataset"] # type: ignore
|
||||
trainset = get_dataset(template, model_args, data_args, training_args, "sft", **tokenizer_module)[
|
||||
"train_dataset"
|
||||
] # type: ignore
|
||||
total_num = len(trainset) # type: ignore
|
||||
length_dict = defaultdict(int)
|
||||
for sample in tqdm(trainset["input_ids"], desc="Collecting lengths"): # type: ignore
|
||||
|
||||
Reference in New Issue
Block a user