Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/scripts/export-ascend/generate_paraformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import json
from dataclasses import asdict, dataclass

from generate_zipformer_ctc_20250703 import get_image
from generate_zipformer_ctc_20250703 import get_cann_version, get_image, get_soc_version


@dataclass
Expand All @@ -26,8 +26,8 @@ def __post_init__(self):


def main():
cann_version = ["7.0", "8.0", "8.2"]
soc_version = ["910B", "910B2", "910B3", "310P3"]
cann_version = get_cann_version()
soc_version = get_soc_version()
framework_list = ["FunASR", "WSChuan-ASR"]

configs = [
Expand Down
6 changes: 3 additions & 3 deletions .github/scripts/export-ascend/generate_sense_voice.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import json
from dataclasses import asdict, dataclass

from generate_zipformer_ctc_20250703 import get_image
from generate_zipformer_ctc_20250703 import get_image, get_soc_version, get_cann_version


@dataclass
Expand All @@ -26,8 +26,8 @@ def __post_init__(self):


def main():
cann_version = ["7.0", "8.0", "8.2"]
soc_version = ["910B", "910B2", "910B3", "310P3"]
cann_version = get_cann_version()
soc_version = get_soc_version()
framework_list = ["FunASR", "WSYue-ASR"]

configs = [
Expand Down
14 changes: 12 additions & 2 deletions .github/scripts/export-ascend/generate_zipformer_ctc_20250703.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,16 @@ def get_image(cann: str, soc_version: str):
raise ValueError(f"Unsupported soc_version {soc_version}")


def get_soc_version():
soc_version = ["910B", "910B2", "910B3", "910B4", "310P3"]
return soc_version


def get_cann_version():
cann_version = ["7.0", "8.0", "8.2"]
return cann_version
Comment on lines +35 to +42

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For lists of values that are fixed and don't change at runtime, it's more idiomatic and clearer to define them as module-level constants rather than wrapping them in functions. This signals that these are static configuration values.

I suggest replacing these functions with constants. You would then need to update the call sites in this file, generate_paraformer.py, and generate_sense_voice.py to import and use these constants directly.

For example, in generate_paraformer.py:

from generate_zipformer_ctc_20250703 import get_image, SUPPORTED_CANN_VERSIONS, SUPPORTED_SOC_VERSIONS

def main():
    cann_version = SUPPORTED_CANN_VERSIONS
    soc_version = SUPPORTED_SOC_VERSIONS
    # ...
SUPPORTED_SOC_VERSIONS = ["910B", "910B2", "910B3", "910B4", "310P3"]
SUPPORTED_CANN_VERSIONS = ["7.0", "8.0", "8.2"]



@dataclass
class Config:
# 7.0, 8.0, 8.2
Expand All @@ -49,8 +59,8 @@ def __post_init__(self):


def main():
cann_version = ["7.0", "8.0", "8.2"]
soc_version = ["910B", "910B2", "910B3", "310P3"]
cann_version = get_cann_version()
soc_version = get_soc_version()
input_in_seconds = ["5", "8", "10", "13", "15", "18", "20", "23", "25", "28", "30"]

configs = [
Expand Down
15 changes: 12 additions & 3 deletions .github/workflows/export-paraformer-to-ascend-npu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: export-paraformer-to-ascend-npu
on:
push:
branches:
- refactor-ascend-export-script
- ascend-910b4-2
workflow_dispatch:

concurrency:
Expand All @@ -26,8 +26,8 @@ jobs:
id: set-matrix
run: |
# outputting for debugging purposes
python3 .github/scripts/export-ascend/generate_sense_voice.py
MATRIX=$(python3 .github/scripts/export-ascend/generate_sense_voice.py)
python3 .github/scripts/export-ascend/generate_paraformer.py
MATRIX=$(python3 .github/scripts/export-ascend/generate_paraformer.py)

# deprecated
# echo "::set-output name=matrix::${MATRIX}"
Expand Down Expand Up @@ -75,6 +75,9 @@ jobs:
source /usr/local/Ascend/ascend-toolkit/set_env.sh
export LD_LIBRARY_PATH=/usr/local/Ascend/ascend-toolkit/latest/x86_64-linux/devlib/linux/x86_64:$LD_LIBRARY_PATH

# for cann 7.0.0
export LD_LIBRARY_PATH=/usr/local/Ascend/ascend-toolkit/latest/x86_64-linux/devlib/x86_64:$LD_LIBRARY_PATH

echo "CANN environment:"
which atc || echo "atc not found"
atc --help
Expand Down Expand Up @@ -129,6 +132,9 @@ jobs:
source /usr/local/Ascend/ascend-toolkit/set_env.sh
export LD_LIBRARY_PATH=/usr/local/Ascend/ascend-toolkit/latest/x86_64-linux/devlib/linux/x86_64:$LD_LIBRARY_PATH

# for cann 7.0.0
export LD_LIBRARY_PATH=/usr/local/Ascend/ascend-toolkit/latest/x86_64-linux/devlib/x86_64:$LD_LIBRARY_PATH

soc_version=${{ matrix.soc_version }}
cann=${{ matrix.cann }}

Expand Down Expand Up @@ -222,6 +228,9 @@ jobs:
source /usr/local/Ascend/ascend-toolkit/set_env.sh
export LD_LIBRARY_PATH=/usr/local/Ascend/ascend-toolkit/latest/x86_64-linux/devlib/linux/x86_64:$LD_LIBRARY_PATH

# for cann 7.0.0
export LD_LIBRARY_PATH=/usr/local/Ascend/ascend-toolkit/latest/x86_64-linux/devlib/x86_64:$LD_LIBRARY_PATH

soc_version=${{ matrix.soc_version }}
cann=${{ matrix.cann }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/export-sense-voice-to-ascend-npu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: export-sense-voice-to-ascend-npu
on:
push:
branches:
- refactor-ascend-export-script
- ascend-910b4-2
workflow_dispatch:

concurrency:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: export-zipformer-ctc-to-ascend-npu-20250703
on:
push:
branches:
- export-zipformer-ctc-ascend
- ascend-910b4-2
workflow_dispatch:

concurrency:
Expand Down