try the latest version

This commit is contained in:
samiabat 2025-07-28 20:48:12 +03:00
parent 70855923ec
commit 07801e0831

View File

@ -1,27 +1,5 @@
# Download moda ASR related models # Download moda ASR related models
from modelscope import snapshot_download from modelscope import snapshot_download
import shutil model_dir = snapshot_download('damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch',revision="v2.0.5")
import os model_dir = snapshot_download('damo/speech_fsmn_vad_zh-cn-16k-common-pytorch',revision="v2.0.5")
import time model_dir = snapshot_download('damo/punc_ct-transformer_zh-cn-common-vocab272727-pytorch',revision="v2.0.5")
from modelscope.hub.snapshot_download import snapshot_download
def safe_download(model_id, revision='v2.0.4', max_retries=3):
cache_base = os.path.expanduser(f'~/.cache/modelscope/hub/{model_id.replace("/", "/")}')
if os.path.exists(cache_base):
shutil.rmtree(cache_base) # Remove possibly corrupted model cache
for attempt in range(max_retries):
try:
print(f"Attempting download for: {model_id} (Attempt {attempt + 1})")
model_dir = snapshot_download(model_id, revision=revision)
print(f"✅ Downloaded {model_id} to {model_dir}")
return model_dir
except Exception as e:
print(f"❌ Failed on attempt {attempt + 1} for {model_id}: {e}")
time.sleep(5)
raise RuntimeError(f"❌ All attempts failed for {model_id}")
# Model downloads
safe_download('damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch')
safe_download('damo/speech_fsmn_vad_zh-cn-16k-common-pytorch')
safe_download('damo/punc_ct-transformer_zh-cn-common-vocab272727-pytorch')