compressed-tensors 0.9.2__tar.gz → 0.9.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (126) hide show
  1. compressed_tensors-0.9.4/.github/.gitkeep +0 -0
  2. compressed_tensors-0.9.4/.github/actions/test/action.yml +35 -0
  3. compressed_tensors-0.9.4/.github/scripts/step-status +14 -0
  4. compressed_tensors-0.9.4/.github/workflows/build-test.yml +80 -0
  5. compressed_tensors-0.9.4/.github/workflows/build.yml +134 -0
  6. compressed_tensors-0.9.4/.github/workflows/report.yml +128 -0
  7. compressed_tensors-0.9.4/.github/workflows/test-check.yaml +28 -0
  8. compressed_tensors-0.9.4/.github/workflows/test.yml +136 -0
  9. compressed_tensors-0.9.4/.github/workflows/trigger-all.yml +40 -0
  10. compressed_tensors-0.9.4/.github/workflows/upload.yml +158 -0
  11. compressed_tensors-0.9.4/.gitignore +163 -0
  12. compressed_tensors-0.9.4/Makefile +37 -0
  13. {compressed_tensors-0.9.2 → compressed_tensors-0.9.4}/PKG-INFO +4 -3
  14. {compressed_tensors-0.9.2 → compressed_tensors-0.9.4}/README.md +1 -1
  15. compressed_tensors-0.9.4/examples/bit_packing/ex_quantize_and_pack.py +94 -0
  16. compressed_tensors-0.9.4/examples/bit_packing/int4_config.json +16 -0
  17. compressed_tensors-0.9.4/examples/bitmask_compression.ipynb +252 -0
  18. compressed_tensors-0.9.4/examples/llama_1.1b/ex_config_quantization.py +131 -0
  19. compressed_tensors-0.9.4/examples/llama_1.1b/ex_llmcompressor_quantization.py +49 -0
  20. compressed_tensors-0.9.4/examples/llama_1.1b/example_quant_config.json +22 -0
  21. compressed_tensors-0.9.4/examples/llama_1.1b/example_quant_recipe.yaml +32 -0
  22. compressed_tensors-0.9.4/examples/quantize_and_pack_int4.ipynb +364 -0
  23. compressed_tensors-0.9.4/pyproject.toml +10 -0
  24. compressed_tensors-0.9.4/setup.py +116 -0
  25. compressed_tensors-0.9.4/src/compressed_tensors/README.md +163 -0
  26. {compressed_tensors-0.9.2 → compressed_tensors-0.9.4}/src/compressed_tensors/compressors/base.py +6 -1
  27. {compressed_tensors-0.9.2 → compressed_tensors-0.9.4}/src/compressed_tensors/compressors/model_compressors/model_compressor.py +102 -10
  28. {compressed_tensors-0.9.2 → compressed_tensors-0.9.4}/src/compressed_tensors/compressors/quantized_compressors/base.py +50 -6
  29. {compressed_tensors-0.9.2 → compressed_tensors-0.9.4}/src/compressed_tensors/compressors/quantized_compressors/pack_quantized.py +88 -21
  30. {compressed_tensors-0.9.2 → compressed_tensors-0.9.4}/src/compressed_tensors/compressors/sparse_compressors/base.py +21 -4
  31. compressed_tensors-0.9.4/src/compressed_tensors/linear/__init__.py +13 -0
  32. {compressed_tensors-0.9.2 → compressed_tensors-0.9.4}/src/compressed_tensors/linear/compressed_linear.py +25 -6
  33. {compressed_tensors-0.9.2 → compressed_tensors-0.9.4}/src/compressed_tensors/quantization/lifecycle/apply.py +65 -30
  34. {compressed_tensors-0.9.2 → compressed_tensors-0.9.4}/src/compressed_tensors/quantization/lifecycle/initialize.py +15 -5
  35. {compressed_tensors-0.9.2 → compressed_tensors-0.9.4}/src/compressed_tensors/quantization/quant_config.py +1 -5
  36. {compressed_tensors-0.9.2 → compressed_tensors-0.9.4}/src/compressed_tensors/quantization/quant_scheme.py +13 -0
  37. {compressed_tensors-0.9.2 → compressed_tensors-0.9.4}/src/compressed_tensors/quantization/utils/helpers.py +7 -1
  38. {compressed_tensors-0.9.2 → compressed_tensors-0.9.4}/src/compressed_tensors/utils/offload.py +20 -17
  39. {compressed_tensors-0.9.2 → compressed_tensors-0.9.4}/src/compressed_tensors/utils/safetensors_load.py +10 -8
  40. compressed_tensors-0.9.4/src/compressed_tensors/version.py +21 -0
  41. {compressed_tensors-0.9.2 → compressed_tensors-0.9.4}/src/compressed_tensors.egg-info/PKG-INFO +4 -3
  42. {compressed_tensors-0.9.2 → compressed_tensors-0.9.4}/src/compressed_tensors.egg-info/SOURCES.txt +64 -1
  43. compressed_tensors-0.9.4/tests/__init__.py +13 -0
  44. compressed_tensors-0.9.4/tests/conftest.py +134 -0
  45. compressed_tensors-0.9.4/tests/test_compressors/__init__.py +13 -0
  46. compressed_tensors-0.9.4/tests/test_compressors/model_compressors/__init__.py +13 -0
  47. compressed_tensors-0.9.4/tests/test_compressors/model_compressors/test_model_compressor.py +367 -0
  48. compressed_tensors-0.9.4/tests/test_compressors/quantized_compressors/__init__.py +13 -0
  49. compressed_tensors-0.9.4/tests/test_compressors/quantized_compressors/test_fp8_quant.py +165 -0
  50. compressed_tensors-0.9.4/tests/test_compressors/quantized_compressors/test_int_quant.py +162 -0
  51. compressed_tensors-0.9.4/tests/test_compressors/quantized_compressors/test_pack_quant.py +479 -0
  52. compressed_tensors-0.9.4/tests/test_compressors/sparse_compressors/__init__.py +13 -0
  53. compressed_tensors-0.9.4/tests/test_compressors/sparse_compressors/test_bitmask.py +120 -0
  54. compressed_tensors-0.9.4/tests/test_compressors/sparse_compressors/test_sparse_24_bitmask.py +201 -0
  55. compressed_tensors-0.9.4/tests/test_compressors/sparse_quantized_compressors/__init__.py +13 -0
  56. compressed_tensors-0.9.4/tests/test_compressors/sparse_quantized_compressors/test_marlin_24.py +116 -0
  57. compressed_tensors-0.9.4/tests/test_configs/__init__.py +13 -0
  58. compressed_tensors-0.9.4/tests/test_configs/test_base.py +57 -0
  59. compressed_tensors-0.9.4/tests/test_examples/test_bitmask_compression_ipynb.py +31 -0
  60. compressed_tensors-0.9.4/tests/test_linear/__init__.py +13 -0
  61. compressed_tensors-0.9.4/tests/test_linear/test_compressed_linear.py +98 -0
  62. compressed_tensors-0.9.4/tests/test_quantization/__init__.py +13 -0
  63. compressed_tensors-0.9.4/tests/test_quantization/lifecycle/__init__.py +13 -0
  64. compressed_tensors-0.9.4/tests/test_quantization/lifecycle/conftest.py +47 -0
  65. compressed_tensors-0.9.4/tests/test_quantization/lifecycle/test_apply.py +372 -0
  66. compressed_tensors-0.9.4/tests/test_quantization/lifecycle/test_dynamic_lifecycle.py +113 -0
  67. compressed_tensors-0.9.4/tests/test_quantization/lifecycle/test_enabled.py +57 -0
  68. compressed_tensors-0.9.4/tests/test_quantization/lifecycle/test_forward.py +205 -0
  69. compressed_tensors-0.9.4/tests/test_quantization/lifecycle/test_helpers.py +45 -0
  70. compressed_tensors-0.9.4/tests/test_quantization/lifecycle/test_initialize.py +202 -0
  71. compressed_tensors-0.9.4/tests/test_quantization/lifecycle/test_lifecycle.py +116 -0
  72. compressed_tensors-0.9.4/tests/test_quantization/test_configs/__init__.py +13 -0
  73. compressed_tensors-0.9.4/tests/test_quantization/test_configs/test_bit_depths.py +173 -0
  74. compressed_tensors-0.9.4/tests/test_quantization/test_configs/test_strategies.py +138 -0
  75. compressed_tensors-0.9.4/tests/test_quantization/test_quant_args.py +156 -0
  76. compressed_tensors-0.9.4/tests/test_quantization/test_quant_config.py +81 -0
  77. compressed_tensors-0.9.4/tests/test_quantization/test_quant_scheme.py +59 -0
  78. compressed_tensors-0.9.4/tests/test_quantization/test_utils/test_helpers.py +58 -0
  79. compressed_tensors-0.9.4/tests/test_utils/__init__.py +13 -0
  80. compressed_tensors-0.9.4/tests/test_utils/test_helpers.py +153 -0
  81. compressed_tensors-0.9.4/tests/test_utils/test_offload.py +306 -0
  82. compressed_tensors-0.9.4/tests/test_utils/test_safetensors_load.py +82 -0
  83. compressed_tensors-0.9.4/utils/copyright.py +346 -0
  84. compressed_tensors-0.9.2/pyproject.toml +0 -3
  85. compressed_tensors-0.9.2/setup.py +0 -97
  86. compressed_tensors-0.9.2/src/compressed_tensors/version.py +0 -53
  87. {compressed_tensors-0.9.2 → compressed_tensors-0.9.4}/LICENSE +0 -0
  88. {compressed_tensors-0.9.2 → compressed_tensors-0.9.4}/setup.cfg +0 -0
  89. {compressed_tensors-0.9.2/src/compressed_tensors/linear → compressed_tensors-0.9.4/src}/__init__.py +0 -0
  90. {compressed_tensors-0.9.2 → compressed_tensors-0.9.4}/src/compressed_tensors/__init__.py +0 -0
  91. {compressed_tensors-0.9.2 → compressed_tensors-0.9.4}/src/compressed_tensors/base.py +0 -0
  92. {compressed_tensors-0.9.2 → compressed_tensors-0.9.4}/src/compressed_tensors/compressors/__init__.py +0 -0
  93. {compressed_tensors-0.9.2 → compressed_tensors-0.9.4}/src/compressed_tensors/compressors/helpers.py +0 -0
  94. {compressed_tensors-0.9.2 → compressed_tensors-0.9.4}/src/compressed_tensors/compressors/model_compressors/__init__.py +0 -0
  95. {compressed_tensors-0.9.2 → compressed_tensors-0.9.4}/src/compressed_tensors/compressors/quantized_compressors/__init__.py +0 -0
  96. {compressed_tensors-0.9.2 → compressed_tensors-0.9.4}/src/compressed_tensors/compressors/quantized_compressors/naive_quantized.py +0 -0
  97. {compressed_tensors-0.9.2 → compressed_tensors-0.9.4}/src/compressed_tensors/compressors/sparse_compressors/__init__.py +0 -0
  98. {compressed_tensors-0.9.2 → compressed_tensors-0.9.4}/src/compressed_tensors/compressors/sparse_compressors/dense.py +0 -0
  99. {compressed_tensors-0.9.2 → compressed_tensors-0.9.4}/src/compressed_tensors/compressors/sparse_compressors/sparse_24_bitmask.py +0 -0
  100. {compressed_tensors-0.9.2 → compressed_tensors-0.9.4}/src/compressed_tensors/compressors/sparse_compressors/sparse_bitmask.py +0 -0
  101. {compressed_tensors-0.9.2 → compressed_tensors-0.9.4}/src/compressed_tensors/compressors/sparse_quantized_compressors/__init__.py +0 -0
  102. {compressed_tensors-0.9.2 → compressed_tensors-0.9.4}/src/compressed_tensors/compressors/sparse_quantized_compressors/marlin_24.py +0 -0
  103. {compressed_tensors-0.9.2 → compressed_tensors-0.9.4}/src/compressed_tensors/config/__init__.py +0 -0
  104. {compressed_tensors-0.9.2 → compressed_tensors-0.9.4}/src/compressed_tensors/config/base.py +0 -0
  105. {compressed_tensors-0.9.2 → compressed_tensors-0.9.4}/src/compressed_tensors/config/dense.py +0 -0
  106. {compressed_tensors-0.9.2 → compressed_tensors-0.9.4}/src/compressed_tensors/config/sparse_24_bitmask.py +0 -0
  107. {compressed_tensors-0.9.2 → compressed_tensors-0.9.4}/src/compressed_tensors/config/sparse_bitmask.py +0 -0
  108. {compressed_tensors-0.9.2 → compressed_tensors-0.9.4}/src/compressed_tensors/quantization/__init__.py +0 -0
  109. {compressed_tensors-0.9.2 → compressed_tensors-0.9.4}/src/compressed_tensors/quantization/lifecycle/__init__.py +0 -0
  110. {compressed_tensors-0.9.2 → compressed_tensors-0.9.4}/src/compressed_tensors/quantization/lifecycle/compressed.py +0 -0
  111. {compressed_tensors-0.9.2 → compressed_tensors-0.9.4}/src/compressed_tensors/quantization/lifecycle/forward.py +0 -0
  112. {compressed_tensors-0.9.2 → compressed_tensors-0.9.4}/src/compressed_tensors/quantization/lifecycle/helpers.py +0 -0
  113. {compressed_tensors-0.9.2 → compressed_tensors-0.9.4}/src/compressed_tensors/quantization/quant_args.py +0 -0
  114. {compressed_tensors-0.9.2 → compressed_tensors-0.9.4}/src/compressed_tensors/quantization/utils/__init__.py +0 -0
  115. {compressed_tensors-0.9.2 → compressed_tensors-0.9.4}/src/compressed_tensors/registry/__init__.py +0 -0
  116. {compressed_tensors-0.9.2 → compressed_tensors-0.9.4}/src/compressed_tensors/registry/registry.py +0 -0
  117. {compressed_tensors-0.9.2 → compressed_tensors-0.9.4}/src/compressed_tensors/utils/__init__.py +0 -0
  118. {compressed_tensors-0.9.2 → compressed_tensors-0.9.4}/src/compressed_tensors/utils/helpers.py +0 -0
  119. {compressed_tensors-0.9.2 → compressed_tensors-0.9.4}/src/compressed_tensors/utils/permutations_24.py +0 -0
  120. {compressed_tensors-0.9.2 → compressed_tensors-0.9.4}/src/compressed_tensors/utils/permute.py +0 -0
  121. {compressed_tensors-0.9.2 → compressed_tensors-0.9.4}/src/compressed_tensors/utils/semi_structured_conversions.py +0 -0
  122. {compressed_tensors-0.9.2 → compressed_tensors-0.9.4}/src/compressed_tensors.egg-info/dependency_links.txt +0 -0
  123. {compressed_tensors-0.9.2 → compressed_tensors-0.9.4}/src/compressed_tensors.egg-info/requires.txt +0 -0
  124. {compressed_tensors-0.9.2 → compressed_tensors-0.9.4}/src/compressed_tensors.egg-info/top_level.txt +0 -0
  125. {compressed_tensors-0.9.2 → compressed_tensors-0.9.4}/tests/test_registry.py +0 -0
  126. {compressed_tensors-0.9.2 → compressed_tensors-0.9.4}/tests/testing_utils.py +0 -0
File without changes
@@ -0,0 +1,35 @@
1
+ name: test compressed-tensors
2
+ description: 'test compressed-tensors'
3
+ inputs:
4
+ venv:
5
+ description: "path of virtualenv"
6
+ required: true
7
+ suitename:
8
+ description: "test suite name"
9
+ required: true
10
+ outputs:
11
+ status:
12
+ description: "final status from test"
13
+ value: ${{ steps.test.outputs.status }}
14
+ runs:
15
+ using: composite
16
+ steps:
17
+
18
+ - name: install wheel
19
+ uses: neuralmagic/nm-actions/actions/install-whl@v1.2.0
20
+ with:
21
+ venv: ${{ inputs.venv }}
22
+ name: compressed
23
+ extra: "[dev,accelerate]"
24
+
25
+ - name: test
26
+ id: test
27
+ run: |
28
+ source ${{ inputs.venv }}/bin/activate
29
+ rm -rf src
30
+ SUCCESS=0
31
+ pytest tests --junitxml=test-results/report.xml -o junit_suite_name="${{ inputs.suitename }}" || SUCCESS=$?
32
+ echo "status=${SUCCESS}" >> "$GITHUB_OUTPUT"
33
+ deactivate
34
+ exit ${SUCCESS}
35
+ shell: bash
@@ -0,0 +1,14 @@
1
+ #!/bin/bash -e
2
+
3
+ # echo "green encased checkmark" if "${1} == 0"
4
+ # echo "red X" if "${1} != 0"
5
+
6
+ STEP_STATUS=${1}
7
+
8
+ if [ "$STEP_STATUS" -eq 0 ]; then
9
+ # green check
10
+ echo -e "\xE2\x9C\x85"
11
+ else
12
+ # red x
13
+ echo -e "\xE2\x9D\x8C"
14
+ fi
@@ -0,0 +1,80 @@
1
+ name: build-test
2
+ on:
3
+
4
+ # makes workflow reusable
5
+ workflow_call:
6
+ inputs:
7
+ wf_category:
8
+ description: "workflow category: NIGHTLY, RELEASE"
9
+ type: string
10
+ default: NIGHTLY
11
+ push_to_pypi:
12
+ description: "When set to true, built whl and tar.gz will be pushed to public pypi if all tests pass"
13
+ type: boolean
14
+ default: false
15
+ gitref:
16
+ description: "git commit hash or tag name"
17
+ type: string
18
+ default: main
19
+
20
+ # build related parameters
21
+ build_label:
22
+ description: "requested runner label for build (specifies instance)"
23
+ type: string
24
+ default: ubuntu-22.04
25
+
26
+ # test related parameters
27
+ test_configs:
28
+ description: "python, label, timeout"
29
+ type: string
30
+ required: true
31
+
32
+ jobs:
33
+
34
+ BUILD:
35
+ uses: ./.github/workflows/build.yml
36
+ with:
37
+ wf_category: ${{ inputs.wf_category }}
38
+ build_label: ${{ inputs.build_label }}
39
+ gitref: ${{ inputs.gitref }}
40
+ timeout: 20
41
+ secrets: inherit
42
+
43
+ TEST:
44
+ needs: [BUILD]
45
+ strategy:
46
+ fail-fast: false
47
+ matrix:
48
+ test_config: ${{ fromJson(inputs.test_configs) }}
49
+ uses: ./.github/workflows/test.yml
50
+ with:
51
+ gitref: ${{ inputs.gitref }}
52
+ test_label: ${{ matrix.test_config.label }}
53
+ python: ${{ matrix.test_config.python }}
54
+ timeout: ${{ matrix.test_config.timeout }}
55
+ whl: ${{ needs.BUILD.outputs.whl }}
56
+ secrets: inherit
57
+
58
+ UPLOAD:
59
+ needs: [TEST]
60
+ uses: ./.github/workflows/upload.yml
61
+ with:
62
+ label: k8s-util
63
+ timeout: 40
64
+ run_id: ${{ github.run_id }}
65
+ push_to_pypi: ${{ inputs.push_to_pypi }}
66
+ secrets: inherit
67
+
68
+ REPORT:
69
+ needs: [BUILD, TEST]
70
+ if: success() || failure()
71
+ uses: ./.github/workflows/report.yml
72
+ with:
73
+ label: rh-reporter
74
+ timeout: 40
75
+ run_id: ${{ github.run_id }}
76
+ run_name: compressed-tensors
77
+ wheel: ${{ needs.BUILD.outputs.whl }}
78
+ wf_category: ${{ inputs.wf_category }}
79
+ gitref: ${{ inputs.gitref }}
80
+ secrets: inherit
@@ -0,0 +1,134 @@
1
+ name: build
2
+ on:
3
+ # makes workflow reusable
4
+ workflow_call:
5
+ inputs:
6
+ wf_category:
7
+ description: "categories: NIGHTLY, RELEASE"
8
+ type: string
9
+ default: NIGHTLY
10
+ build_label:
11
+ description: "requested runner label (specifies instance)"
12
+ type: string
13
+ required: true
14
+ timeout:
15
+ description: "time limit for run in minutes "
16
+ type: string
17
+ default: 20
18
+ gitref:
19
+ description: "git commit hash or branch name"
20
+ type: string
21
+ default: main
22
+ outputs:
23
+ whl:
24
+ description: 'basename for generated whl'
25
+ value: ${{ jobs.BUILD.outputs.whl }}
26
+
27
+ # makes workflow manually callable
28
+ workflow_dispatch:
29
+ inputs:
30
+ wf_category:
31
+ description: "categories: NIGHTLY, RELEASE"
32
+ type: string
33
+ default: NIGHTLY
34
+ build_label:
35
+ description: "requested runner label (specifies instance)"
36
+ type: string
37
+ required: true
38
+ timeout:
39
+ description: "time limit for run in minutes "
40
+ type: string
41
+ default: 20
42
+ gitref:
43
+ description: "git commit hash or branch name"
44
+ type: string
45
+ default: main
46
+
47
+ jobs:
48
+
49
+ BUILD:
50
+
51
+ runs-on: ${{ inputs.build_label }}
52
+ timeout-minutes: ${{ fromJson(inputs.timeout) }}
53
+ permissions:
54
+ contents: 'read'
55
+ id-token: 'write'
56
+
57
+ outputs:
58
+ run_id: ${{ github.run_id }}
59
+ whl: ${{ steps.build.outputs.whlname }}
60
+ tarfile: ${{ steps.build.outputs.tarname }}
61
+
62
+ steps:
63
+
64
+ - name: set python
65
+ uses: actions/setup-python@v4
66
+ with:
67
+ python-version: '3.12'
68
+
69
+ - name: checkout code
70
+ id: checkout
71
+ uses: actions/checkout@v4
72
+ with:
73
+ fetch-depth: 0
74
+ fetch-tags: true
75
+ ref: ${{ inputs.gitref }}
76
+
77
+ - name: build
78
+ id: build
79
+ uses: neuralmagic/nm-actions/actions/build-ml-whl@v1.18.0
80
+ with:
81
+ dev: false
82
+ release: ${{ inputs.wf_category == 'RELEASE' }}
83
+
84
+ # GCP
85
+ - name: 'Authenticate to Google Cloud'
86
+ id: auth
87
+ uses: google-github-actions/auth@v2.1.3
88
+ with:
89
+ project_id: ${{ secrets.GCP_PROJECT }}
90
+ workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }}
91
+ service_account: ${{ secrets.GCP_GHA_SA }}
92
+
93
+ - name: 'Set up Cloud SDK'
94
+ uses: 'google-github-actions/setup-gcloud@v2'
95
+ with:
96
+ version: '>= 473.0.0'
97
+
98
+ - name: copy whl and source distribution
99
+ run: |
100
+ gcloud storage cp dist/${{ steps.build.outputs.whlname }} ${{ secrets.GCP_BUILD_ML_ASSETS2 }}/${{ github.run_id }}/${{ steps.build.outputs.whlname }}
101
+ gcloud storage cp dist/${{ steps.build.outputs.tarname }} ${{ secrets.GCP_BUILD_ML_ASSETS2 }}/${{ github.run_id }}/${{ steps.build.outputs.tarname }}
102
+
103
+ - name: upload whl
104
+ uses: actions/upload-artifact@v4
105
+ if: success() || failure()
106
+ with:
107
+ name: ${{ steps.build.outputs.whlname }}
108
+ path: dist/${{ steps.build.outputs.whlname }}
109
+ retention-days: 5
110
+
111
+ - name: upload tar.gz
112
+ uses: actions/upload-artifact@v4
113
+ if: success() || failure()
114
+ with:
115
+ name: ${{ steps.build.outputs.tarname }}
116
+ path: dist/${{ steps.build.outputs.tarname }}
117
+ retention-days: 5
118
+
119
+ - name: summary
120
+ uses: neuralmagic/nm-actions/actions/summary-build@v1.2.0
121
+ if: success() || failure()
122
+ with:
123
+ label: ${{ inputs.build_label }}
124
+ gitref: ${{ inputs.gitref }}
125
+ whl_status: ${{ steps.build.outputs.status }}
126
+
127
+ - name: run status
128
+ id: run_status
129
+ if: success() || failure()
130
+ env:
131
+ WHL_STATUS: ${{ steps.build.outputs.status }}
132
+ run: |
133
+ echo "build status: ${WHL_STATUS}"
134
+ if [ -z "${WHL_STATUS}" ] || [ "${WHL_STATUS}" -ne "0" ]; then exit 1; fi
@@ -0,0 +1,128 @@
1
+ name: report test results to reportportal
2
+ run-name: ${{ github.actor }} report results for run ${{ inputs.run_id }}
3
+ on:
4
+
5
+ workflow_call:
6
+ inputs:
7
+ label:
8
+ description: "requested runner label (specifies instance)"
9
+ type: string
10
+ required: true
11
+ timeout:
12
+ description: "time limit for run in minutes "
13
+ type: string
14
+ required: true
15
+ run_id:
16
+ description: "run_id of 'build.yml' run that generated the assets"
17
+ type: string
18
+ required: true
19
+ wheel:
20
+ description: wheel used for testing
21
+ type: string
22
+ required: true
23
+ run_name:
24
+ description: name of the test run
25
+ type: string
26
+ required: true
27
+ wf_category:
28
+ description: "categories: NIGHTLY, RELEASE"
29
+ type: string
30
+ default: NIGHTLY
31
+ gitref:
32
+ description: "git commit hash or branch name"
33
+ type: string
34
+ default: main
35
+
36
+ workflow_dispatch:
37
+ inputs:
38
+ label:
39
+ description: "requested runner label (specifies instance)"
40
+ type: string
41
+ required: true
42
+ timeout:
43
+ description: "time limit for run in minutes "
44
+ type: string
45
+ required: true
46
+ run_id:
47
+ description: "run_id of 'build.yml' run that generated the assets"
48
+ type: string
49
+ required: true
50
+ wheel:
51
+ description: wheel used for testing
52
+ type: string
53
+ required: true
54
+ run_name:
55
+ description: name of the test run
56
+ type: string
57
+ required: true
58
+ wf_category:
59
+ description: "categories: NIGHTLY, RELEASE"
60
+ type: string
61
+ default: NIGHTLY
62
+ gitref:
63
+ description: "git commit hash or branch name"
64
+ type: string
65
+ default: main
66
+
67
+ jobs:
68
+
69
+ REPORT:
70
+ runs-on: ${{ inputs.label }}
71
+ timeout-minutes: ${{ fromJson(inputs.timeout) }}
72
+
73
+ permissions:
74
+ contents: 'read'
75
+ id-token: 'write'
76
+
77
+ steps:
78
+
79
+ - name: checkout code
80
+ id: checkout
81
+ uses: actions/checkout@v4
82
+ with:
83
+ ref: ${{ inputs.gitref }}
84
+
85
+ - name: 'Authenticate to Google Cloud'
86
+ id: auth-gcp
87
+ uses: google-github-actions/auth@v2.1.3
88
+ with:
89
+ project_id: ${{ secrets.GCP_PROJECT }}
90
+ workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }}
91
+ service_account: ${{ secrets.GCP_GHA_SA }}
92
+
93
+ - name: 'Set up Cloud SDK'
94
+ uses: 'google-github-actions/setup-gcloud@v2'
95
+ with:
96
+ version: '>= 473.0.0'
97
+
98
+ - name: download assets
99
+ uses: neuralmagic/nm-actions/actions/gcp-download-assets@v1.1.0
100
+ with:
101
+ bucket_source: ${{ secrets.GCP_BUILD_ML_ASSETS2 }}
102
+ run_id: ${{ inputs.run_id }}
103
+
104
+ - name: generate metadata info
105
+ id: generate-metadata
106
+ run: |
107
+ jq --raw-output -n '{
108
+ "hostname": "${{ secrets.REPORTPORTAL_HOST }}",
109
+ "project": "compressed-tensors",
110
+ "name": "${{ inputs.run_name }}",
111
+ "description": "GitHub run: https://github.com/neuralmagic/compressed-tensors/actions/runs/${{ inputs.run_id }}",
112
+ "attributes": [
113
+ {"key": "wheel", "value": "${{ inputs.wheel }}"},
114
+ {"key": "gitref", "value": "${{ inputs.gitref }}"},
115
+ {"key": "workflow category", "value": "${{ inputs.wf_category }}"}
116
+ ]
117
+ }' > metadata.json
118
+ METADATA_FILEPATH=`realpath metadata.json`
119
+ echo "metadata_filepath=${METADATA_FILEPATH}" | tee -a $GITHUB_OUTPUT
120
+ shell: bash
121
+
122
+ - name: report to reportportal
123
+ uses: neuralmagic/nm-actions/actions/reportportal_submit_execution_results@v1.15.0
124
+ with:
125
+ droute_username: ${{ secrets.DROUTE_USERNAME }}
126
+ droute_password: ${{ secrets.DROUTE_PASSWORD }}
127
+ droute_url: ${{ secrets.DROUTE_URL}}
128
+ metadata_filepath: ${{ steps.generate-metadata.outputs.metadata_filepath }}
@@ -0,0 +1,28 @@
1
+ name: Run Tests
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ pull_request:
8
+ branches:
9
+ - main
10
+
11
+ jobs:
12
+ python-tests:
13
+ runs-on: ubuntu-24.04
14
+ steps:
15
+ - uses: actions/setup-python@v4
16
+ with:
17
+ python-version: '3.10'
18
+ - uses: actions/checkout@v3
19
+ - name: Set Env
20
+ run: |
21
+ pip3 install --upgrade pip && pip3 install --upgrade setuptools
22
+ pip3 install virtualenv
23
+ virtualenv venv
24
+ source venv/bin/activate
25
+ - name: "⚙️ Install dependencies"
26
+ run: pip3 install .[dev,accelerate]
27
+ - name: "🔬 Running tests"
28
+ run: make test
@@ -0,0 +1,136 @@
1
+ name: nightly test
2
+ on:
3
+ # makes workflow reusable
4
+ workflow_call:
5
+ inputs:
6
+ gitref:
7
+ description: "git commit hash or branch name"
8
+ type: string
9
+ required: true
10
+ test_label:
11
+ description: "requested runner label"
12
+ type: string
13
+ required: true
14
+ python:
15
+ description: "python version, e.g. 3.10.12"
16
+ type: string
17
+ required: true
18
+ timeout:
19
+ description: "time limit for run in minutes "
20
+ type: string
21
+ required: true
22
+ whl:
23
+ description: "whl to test (variable appears late binding so unusable outside 'download artifact')"
24
+ type: string
25
+ required: true
26
+
27
+ # makes workflow manually callable
28
+ workflow_dispatch:
29
+ inputs:
30
+ gitref:
31
+ description: "git commit hash or branch name"
32
+ type: string
33
+ required: true
34
+ test_label:
35
+ description: "requested runner label"
36
+ type: string
37
+ required: true
38
+ python:
39
+ description: "python version, e.g. 3.10.12"
40
+ type: string
41
+ required: true
42
+ timeout:
43
+ description: "time limit for run in minutes "
44
+ type: string
45
+ required: true
46
+ whl:
47
+ description: "whl to test (variable appears late binding so unusable outside 'download artifact')"
48
+ type: string
49
+ required: true
50
+
51
+ jobs:
52
+
53
+ TEST:
54
+
55
+ name: TEST (${{ inputs.python}}, ${{ inputs.test_label }})
56
+ runs-on: ${{ inputs.test_label }}
57
+ timeout-minutes: ${{ fromJson(inputs.timeout) }}
58
+ permissions:
59
+ contents: 'read'
60
+ id-token: 'write'
61
+
62
+ steps:
63
+
64
+ - name: set python
65
+ id: set_python
66
+ uses: actions/setup-python@v5
67
+ with:
68
+ python-version: ${{ inputs.python }}
69
+
70
+ - name: verify python
71
+ id: verify_python
72
+ uses: neuralmagic/nm-actions/actions/verify-python@v1.2.0
73
+ with:
74
+ python-version: ${{ inputs.python }}
75
+
76
+ - name: checkout code
77
+ id: checkout
78
+ uses: actions/checkout@v4
79
+ with:
80
+ ref: ${{ inputs.gitref }}
81
+
82
+ - name: create virtualenv
83
+ id: create_venv
84
+ uses: neuralmagic/nm-actions/actions/create-virtualenv@v1.2.0
85
+ with:
86
+ venv: TEST
87
+
88
+ - name: download whl
89
+ id: download
90
+ uses: actions/download-artifact@v4
91
+ with:
92
+ name: ${{ inputs.whl }}
93
+ path: ${{ inputs.whl }}
94
+
95
+ - name: run tests
96
+ id: test
97
+ uses: ./.github/actions/test/
98
+ with:
99
+ venv: ${{ steps.create_venv.outputs.penv }}
100
+ suitename: test-${{ inputs.python }}-${{ inputs.test_label }}
101
+
102
+ - name: summary
103
+ uses: neuralmagic/nm-actions/actions/summary-test@v1.13.0
104
+ if: success() || failure()
105
+ with:
106
+ test_label: ${{ inputs.test_label }}
107
+ gitref: ${{ inputs.gitref }}
108
+ python: ${{ inputs.python }}
109
+ whl: ${{ inputs.whl }}
110
+ test_status: ${{ steps.test.outputs.status }}
111
+
112
+ # GCP
113
+ - name: 'Authenticate to Google Cloud'
114
+ id: auth
115
+ uses: google-github-actions/auth@v2.1.3
116
+ with:
117
+ project_id: ${{ secrets.GCP_PROJECT }}
118
+ workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }}
119
+ service_account: ${{ secrets.GCP_GHA_SA }}
120
+
121
+ - name: 'Set up Cloud SDK'
122
+ uses: 'google-github-actions/setup-gcloud@v2'
123
+ with:
124
+ version: '>= 473.0.0'
125
+
126
+ - name: copy results to GCP
127
+ run: |
128
+ gcloud storage cp test-results/report.xml ${{ secrets.GCP_BUILD_ML_ASSETS2 }}/${{ github.run_id }}/test-results/report-${{ inputs.test_label }}.xml
129
+
130
+ - name: upload results
131
+ uses: actions/upload-artifact@v4
132
+ if: success() || failure()
133
+ with:
134
+ name: report-${{ inputs.test_label }}.xml
135
+ path: test-results/report.xml
136
+ retention-days: 5
@@ -0,0 +1,40 @@
1
+ name: build and test jobs for nightly and release
2
+ run-name: ${{ github.actor }} triggered nightly or release on ${{ github.ref }}
3
+ on:
4
+ schedule:
5
+ # * is a special character in YAML so you have to quote this string
6
+ - cron: '30 0 * * *' # nightly run
7
+
8
+ workflow_dispatch:
9
+ inputs:
10
+ wf_category:
11
+ description: "workflow category, default is NIGHTLY"
12
+ type: choice
13
+ options:
14
+ - NIGHTLY
15
+ - RELEASE
16
+ default: NIGHTLY
17
+ push_to_pypi:
18
+ description: "when set and tests pass, then '.whl' & '.tar.gz' will be pushed to public pypi"
19
+ type: boolean
20
+ default: false
21
+ gitref:
22
+ description: "git commit hash or tag name"
23
+ type: string
24
+ default: 'main'
25
+
26
+ jobs:
27
+
28
+ BUILD-TEST:
29
+ uses: ./.github/workflows/build-test.yml
30
+ name: ${{ inputs.wf_category || 'NIGHTLY' }}
31
+ with:
32
+ wf_category: ${{ inputs.wf_category || 'NIGHTLY' }}
33
+ gitref: ${{ inputs.gitref || 'main' }}
34
+ push_to_pypi: ${{ (github.event.schedule == '30 0 * * *') || inputs.push_to_pypi || false }}
35
+ test_configs: '[{"python":"3.11.4","label":"ubuntu-22.04","timeout":"40"},
36
+ {"python":"3.10.12","label":"ubuntu-24.04","timeout":"40"},
37
+ {"python":"3.9.17","label":"k8s-h100-solo","timeout":"40"},
38
+ {"python":"3.12.6","label":"k8s-a100-duo","timeout":"40"}]'
39
+
40
+ secrets: inherit