From 73f3f2f91b8549371d8a62ca41355a301d6fcc50 Mon Sep 17 00:00:00 2001
From: 游雁 <zhifu.gzf@alibaba-inc.com>
Date: 星期一, 20 五月 2024 15:32:40 +0800
Subject: [PATCH] Merge branch 'dev_gzf_deepspeed' of github.com:alibaba-damo-academy/FunASR into dev_gzf_deepspeed merge

---
 funasr/utils/misc.py |   28 ++++++++++++++++++++++------
 1 files changed, 22 insertions(+), 6 deletions(-)

diff --git a/funasr/utils/misc.py b/funasr/utils/misc.py
index 5eaa4f8..4613cb3 100644
--- a/funasr/utils/misc.py
+++ b/funasr/utils/misc.py
@@ -70,11 +70,27 @@
 
     yaml_file = os.path.join(kwargs.get("output_dir", "./"), "config.yaml")
     OmegaConf.save(config=kwargs, f=yaml_file)
-    print(kwargs)
+    logging.info(f"kwargs: {kwargs}")
     logging.info("config.yaml is saved to: %s", yaml_file)
 
-    # model_path = kwargs.get("model_path")
-    # if model_path is not None:
-    #     config_json = os.path.join(model_path, "configuration.json")
-    #     if os.path.exists(config_json):
-    #         shutil.copy(config_json, os.path.join(kwargs.get("output_dir", "./"), "configuration.json"))
+    model_path = kwargs.get("model_path", None)
+    if model_path is not None:
+        config_json = os.path.join(model_path, "configuration.json")
+        if os.path.exists(config_json):
+            shutil.copy(
+                config_json, os.path.join(kwargs.get("output_dir", "./"), "configuration.json")
+            )
+
+
+def extract_filename_without_extension(file_path):
+    """
+    浠庣粰瀹氱殑鏂囦欢璺緞涓彁鍙栨枃浠跺悕锛堜笉鍖呭惈璺緞鍜屾墿灞曞悕锛�
+    :param file_path: 瀹屾暣鐨勬枃浠惰矾寰�
+    :return: 鏂囦欢鍚嶏紙涓嶅惈璺緞鍜屾墿灞曞悕锛�
+    """
+    # 棣栧厛锛屼娇鐢╫s.path.basename鑾峰彇璺緞涓殑鏂囦欢鍚嶉儴鍒嗭紙鍚墿灞曞悕锛�
+    filename_with_extension = os.path.basename(file_path)
+    # 鐒跺悗锛屼娇鐢╫s.path.splitext鍒嗙鏂囦欢鍚嶅拰鎵╁睍鍚�
+    filename, extension = os.path.splitext(filename_with_extension)
+    # 杩斿洖涓嶅寘鍚墿灞曞悕鐨勬枃浠跺悕
+    return filename

--
Gitblit v1.9.1