
Test Guide【免费下载链接】torchtitan-npuAscend Extension for torchtitan项目地址: https://gitcode.com/cann/torchtitan-npuCore CommandsUnit Tests# Run all unit tests and generate reports sh build.sh -u --generate-report # Run only local torchtitan-npu unit tests RUN_TORCHTITAN_UTfalse sh build.sh -u --generate-reportSmoke Tests# Run the default smoke suite (core extended) sh build.sh -s --generate-report # Run only core smoke ONLY_CORE_SMOKEtrue sh build.sh -s --generate-report # Run only extended smoke ONLY_EXTENDED_SMOKEtrue sh build.sh -s --generate-report # Run only upstream smoke ONLY_UPSTREAM_SMOKEtrue sh build.sh -s --generate-reportIntegration Testtests/smoke_tests/integration_test.pyis the entry point for end-to-end integration tests, used to validate:New model functionality supportFeature compatibilityParallelism strategy compatibilityRunning# Via build.sh (runs core extended smoke by default) ONLY_CORE_SMOKEtrue sh build.sh -s --generate-report # Run integration_test.py directly python tests/smoke_tests/integration_test.py output_dir \ --test_name all \ --ngpu 2Command-line ArgumentsArgumentDefaultDescriptionoutput_dirNone (required)Output directory for test results--config_path./tests/smoke_tests/base_test.tomlBase config file path--test_nameallSpecific test case name--ngpu2Maximum GPU countOverrideDefinitions UsageOverrideDefinitionsis the configuration class for defining integration test cases:OverrideDefinitions( override_args[[...]], # Required: command-line argument list test_descr..., # Required: test description test_name..., # Required: test name ngpu2, # Optional: required GPU count disabledFalse, # Optional: whether disabled )Steps to Add a New Test CaseOpentests/smoke_tests/integration_test.pyAdd a new configuration to thesmoke_caseslist ingenerate_smoke_tests():OverrideDefinitions( [ [ --model.name your_model, --model.flavor your_flavor, --parallelism.tensor_parallel_degree 2, ], ], Your Model TP Test, your_model_tp, ngpu2, )Run tests to verify:python tests/smoke_tests/integration_test.py ./outputs --test_name your_model_tpbase_test.toml Configurationtests/smoke_tests/base_test.tomlis the base configuration for integration tests. All tests run based on this configuration file, and parameters inoverride_argsoverride identically-named parameters in the base configuration.Model Parallel Commands# Basic model-parallel smoke python3 -m pytest -v tests/smoke_tests/model_parallel/ # Multi-rank model-parallel smoke RUN_MODEL_PARALLEL_MULTI_RANKtrue torchrun --nproc_per_node4 -m pytest -v tests/smoke_tests/model_parallel/When to Use Which CommandCommandUse It Whenbuild.sh -uYou changed hardware-independent logic such as converters, config, helpers, or patchesbuild.sh -sYou changed real NPU execution paths or wrapper behavior and want the default core extended smoke setONLY_CORE_SMOKEtrueYou changed the minimal training path (i.e., end-to-end integration tests defined in integration_test)ONLY_EXTENDED_SMOKEtrueYou changed local feature or model-parallel behaviorONLY_UPSTREAM_SMOKEtrueYou changed logic that depends on reused torchtitan upstream integration, or want to run the heavier upstream smoke path separatelyQuick Decision RuleChanged only hardware-independent logic: start withbuild.sh -uChanged NPU feature paths or wrappers: runbuild.sh -sChanged training-path wiring: at least runONLY_CORE_SMOKEtrue build.sh -sChanged model-parallel behavior: runONLY_EXTENDED_SMOKEtrue build.sh -sUpstream integration compatibility needs a separate check: runONLY_UPSTREAM_SMOKEtrue build.sh -sTest ReportsOutput directory:test_reports/Common artifacts:*.xml: JUnit results*.html: HTML reports when--generate-reportis enabledcoverage/: UT coverage reportsREADME.md: generated index of report artifactsQuick TipsStart with the smallest command that matches your change.Preferbuild.sh -uwhen NPU is not required.Use targeted smoke variants instead of full smoke when possible.Update docs when test layout or execution changes.【免费下载链接】torchtitan-npuAscend Extension for torchtitan项目地址: https://gitcode.com/cann/torchtitan-npu创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考