Skip to content

Commit 4e69793

Browse files
committed
update.
1 parent 7bab189 commit 4e69793

4 files changed

Lines changed: 540 additions & 66 deletions

File tree

.github/workflows/test-inspect.yml

Lines changed: 127 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,141 @@ jobs:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- uses: actions/checkout@v4
13+
1314
- name: Test HF Model Inspector (public repo)
15+
id: public_test
1416
uses: ./
1517
with:
1618
repo_id: sshleifer/tiny-distilroberta-base
19+
1720
- name: Check output file exists
18-
run: test -f model_summary.md && echo "✅ model_summary.md generated"
19-
- name: Test HF Model Inspector (gated repo)
21+
run: |
22+
test -f model_inspection_report.md && echo "✅ model_inspection_report.md generated" || {
23+
echo "❌ model_inspection_report.md not found"
24+
ls -la
25+
exit 1
26+
}
27+
28+
- name: Validate report content
29+
run: |
30+
if grep -q "Model Inspector Report" model_inspection_report.md; then
31+
echo "✅ Report contains expected header"
32+
else
33+
echo "❌ Report missing expected header"
34+
cat model_inspection_report.md
35+
exit 1
36+
fi
37+
38+
- name: Check GitHub Actions outputs (public)
39+
run: |
40+
echo "Downloads: ${{ steps.public_test.outputs.downloads }}"
41+
echo "Likes: ${{ steps.public_test.outputs.likes }}"
42+
echo "Gated: ${{ steps.public_test.outputs.gated }}"
43+
44+
- name: Test HF Model Inspector (gated repo)
45+
id: gated_test
2046
uses: ./
2147
with:
2248
repo_id: meta-llama/Llama-2-7b-hf
2349
hf_token: ${{ secrets.HF_TOKEN }}
50+
continue-on-error: true # Don't fail if token not available
51+
52+
- name: Check gated repo handling
53+
run: |
54+
if [ "${{ steps.gated_test.outcome }}" = "success" ]; then
55+
echo "✅ Gated repo test passed"
56+
echo "Gated status: ${{ steps.gated_test.outputs.gated }}"
57+
else
58+
echo "⚠️ Gated repo test failed (expected if HF_TOKEN not available)"
59+
fi
60+
61+
- name: Test error handling (non-existent repo)
62+
id: error_test
63+
uses: ./
64+
with:
65+
repo_id: non-existent-user/non-existent-model
66+
continue-on-error: true
67+
68+
- name: Verify error handling
69+
run: |
70+
if [ "${{ steps.error_test.outcome }}" = "failure" ]; then
71+
echo "✅ Error handling works correctly"
72+
else
73+
echo "❌ Expected failure for non-existent repo"
74+
exit 1
75+
fi
2476
77+
# Test with different model types
78+
test-different-architectures:
79+
runs-on: ubuntu-latest
80+
strategy:
81+
fail-fast: false
82+
matrix:
83+
include:
84+
- repo: "microsoft/DialoGPT-small"
85+
description: "GPT-2 based model"
86+
- repo: "sentence-transformers/all-MiniLM-L6-v2"
87+
description: "BERT-based sentence transformer"
88+
- repo: "google/flan-t5-small"
89+
description: "T5 model"
90+
91+
steps:
92+
- uses: actions/checkout@v4
93+
94+
- name: Test ${{ matrix.description }}
95+
id: arch_test
96+
uses: ./
97+
with:
98+
repo_id: ${{ matrix.repo }}
99+
100+
- name: Validate architecture-specific report
101+
run: |
102+
echo "Testing ${{ matrix.description }}"
103+
if test -f model_inspection_report.md; then
104+
echo "✅ Report generated for ${{ matrix.repo }}"
105+
# Check for key sections
106+
if grep -q "Model Architecture" model_inspection_report.md; then
107+
echo "✅ Architecture section found"
108+
else
109+
echo "⚠️ Architecture section missing"
110+
fi
111+
112+
if grep -q "Repository Stats" model_inspection_report.md; then
113+
echo "✅ Stats section found"
114+
else
115+
echo "⚠️ Stats section missing"
116+
fi
117+
else
118+
echo "❌ Report not generated"
119+
exit 1
120+
fi
121+
122+
- name: Display stats
123+
run: |
124+
echo "Model: ${{ matrix.repo }}"
125+
echo "Downloads: ${{ steps.arch_test.outputs.downloads }}"
126+
echo "Likes: ${{ steps.arch_test.outputs.likes }}"
25127
26-
128+
# Test performance with larger models
129+
test-performance:
130+
runs-on: ubuntu-latest
131+
steps:
132+
- uses: actions/checkout@v4
133+
134+
- name: Test with larger model (performance check)
135+
id: perf_test
136+
uses: ./
137+
with:
138+
repo_id: "microsoft/DialoGPT-large"
139+
timeout-minutes: 5 # Ensure it completes within reasonable time
140+
141+
- name: Check performance
142+
run: |
143+
if [ "${{ steps.perf_test.outcome }}" = "success" ]; then
144+
echo "✅ Performance test passed within timeout"
145+
file_size=$(stat -c%s model_inspection_report.md)
146+
echo "Report size: $file_size bytes"
147+
else
148+
echo "❌ Performance test failed or timed out"
149+
exit 1
150+
fi

0 commit comments

Comments
 (0)