From e04489ce4c0fd0095d0c79ef8f504f425e0435a8 Mon Sep 17 00:00:00 2001
From: Shi Xian <40013335+R1ckShi@users.noreply.github.com>
Date: 星期三, 13 三月 2024 16:34:42 +0800
Subject: [PATCH] contextual&seaco ONNX export (#1481)
---
funasr/utils/misc.py | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/funasr/utils/misc.py b/funasr/utils/misc.py
index f27a63c..a08f263 100644
--- a/funasr/utils/misc.py
+++ b/funasr/utils/misc.py
@@ -12,7 +12,7 @@
return numel
-def int2vec(x, vec_dim=8, dtype=np.int):
+def int2vec(x, vec_dim=8, dtype=np.int32):
b = ('{:0' + str(vec_dim) + 'b}').format(x)
# little-endian order: lower bit first
return (np.array(list(b)[::-1]) == '1').astype(dtype)
@@ -46,3 +46,10 @@
value = value.split(' ')
ret_dict.append((key, value))
return ret_dict
+
+def deep_update(original, update):
+ for key, value in update.items():
+ if isinstance(value, dict) and key in original:
+ deep_update(original[key], value)
+ else:
+ original[key] = value
\ No newline at end of file
--
Gitblit v1.9.1