opencode-skills-collection 4.0.69 → 4.0.70

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 (185) hide show
  1. package/bundled-skills/.antigravity-install-manifest.json +39 -1
  2. package/bundled-skills/api-integration-architect/SKILL.md +241 -0
  3. package/bundled-skills/apify-generate-output-schema/SKILL.md +438 -0
  4. package/bundled-skills/apify-integration-development/SKILL.md +168 -0
  5. package/bundled-skills/apify-integration-development/references/ai-framework-package.md +158 -0
  6. package/bundled-skills/apify-integration-development/references/ai-harness-plugin.md +192 -0
  7. package/bundled-skills/apify-integration-development/references/sdk-integration.md +236 -0
  8. package/bundled-skills/apify-integration-development/references/workflow-automation.md +163 -0
  9. package/bundled-skills/architecture-review/README.md +42 -0
  10. package/bundled-skills/architecture-review/SKILL.md +77 -0
  11. package/bundled-skills/architecture-review/examples.md +11 -0
  12. package/bundled-skills/architecture-review/reference/best-practices.md +7 -0
  13. package/bundled-skills/architecture-review/reference/capabilities.md +20 -0
  14. package/bundled-skills/architecture-review/reference/fallbacks.md +11 -0
  15. package/bundled-skills/architecture-review/reference/graph.md +15 -0
  16. package/bundled-skills/architecture-review/reference/mcp.md +14 -0
  17. package/bundled-skills/architecture-review/reference/workflow.md +15 -0
  18. package/bundled-skills/architecture-review/templates/architecture-review.md +21 -0
  19. package/bundled-skills/code-review-sensei/SKILL.md +177 -0
  20. package/bundled-skills/codebase-onboarding/README.md +42 -0
  21. package/bundled-skills/codebase-onboarding/SKILL.md +77 -0
  22. package/bundled-skills/codebase-onboarding/examples.md +11 -0
  23. package/bundled-skills/codebase-onboarding/reference/best-practices.md +7 -0
  24. package/bundled-skills/codebase-onboarding/reference/capabilities.md +20 -0
  25. package/bundled-skills/codebase-onboarding/reference/fallbacks.md +11 -0
  26. package/bundled-skills/codebase-onboarding/reference/graph.md +15 -0
  27. package/bundled-skills/codebase-onboarding/reference/mcp.md +14 -0
  28. package/bundled-skills/codebase-onboarding/reference/workflow.md +15 -0
  29. package/bundled-skills/codebase-onboarding/templates/repository-onboarding.md +21 -0
  30. package/bundled-skills/connection-auth-rules/SKILL.md +199 -0
  31. package/bundled-skills/connection-auth-rules/fetch_schema.py +320 -0
  32. package/bundled-skills/dependency-analysis/README.md +42 -0
  33. package/bundled-skills/dependency-analysis/SKILL.md +76 -0
  34. package/bundled-skills/dependency-analysis/examples.md +11 -0
  35. package/bundled-skills/dependency-analysis/reference/best-practices.md +7 -0
  36. package/bundled-skills/dependency-analysis/reference/capabilities.md +20 -0
  37. package/bundled-skills/dependency-analysis/reference/fallbacks.md +11 -0
  38. package/bundled-skills/dependency-analysis/reference/graph.md +15 -0
  39. package/bundled-skills/dependency-analysis/reference/mcp.md +14 -0
  40. package/bundled-skills/dependency-analysis/reference/workflow.md +15 -0
  41. package/bundled-skills/dependency-analysis/templates/dependency-review.md +21 -0
  42. package/bundled-skills/devops-pipeline-builder/SKILL.md +200 -0
  43. package/bundled-skills/eas-app-stores/SKILL.md +197 -0
  44. package/bundled-skills/eas-app-stores/agents/openai.yaml +4 -0
  45. package/bundled-skills/eas-app-stores/references/app-store-metadata.md +497 -0
  46. package/bundled-skills/eas-app-stores/references/ios-app-store.md +376 -0
  47. package/bundled-skills/eas-app-stores/references/native-ios.md +167 -0
  48. package/bundled-skills/eas-app-stores/references/play-store.md +244 -0
  49. package/bundled-skills/eas-app-stores/references/testflight.md +62 -0
  50. package/bundled-skills/eas-app-stores/references/workflows.md +120 -0
  51. package/bundled-skills/eas-hosting/SKILL.md +448 -0
  52. package/bundled-skills/eas-hosting/agents/openai.yaml +4 -0
  53. package/bundled-skills/eas-observe/SKILL.md +75 -0
  54. package/bundled-skills/eas-observe/agents/openai.yaml +4 -0
  55. package/bundled-skills/eas-observe/references/metrics.md +98 -0
  56. package/bundled-skills/eas-observe/references/queries.md +403 -0
  57. package/bundled-skills/eas-observe/references/setup.md +476 -0
  58. package/bundled-skills/eas-observe/references/third-party.md +136 -0
  59. package/bundled-skills/eas-simulator/SKILL.md +251 -0
  60. package/bundled-skills/eas-simulator/agents/openai.yaml +4 -0
  61. package/bundled-skills/eas-simulator/references/controllers.md +135 -0
  62. package/bundled-skills/eas-simulator/references/run-your-app.md +240 -0
  63. package/bundled-skills/eas-simulator/references/troubleshooting.md +47 -0
  64. package/bundled-skills/eas-workflows/SKILL.md +119 -0
  65. package/bundled-skills/eas-workflows/agents/openai.yaml +4 -0
  66. package/bundled-skills/eas-workflows/scripts/fetch.js +109 -0
  67. package/bundled-skills/expo-animation/LICENSE +21 -0
  68. package/bundled-skills/expo-animation/RECIPES.md +385 -0
  69. package/bundled-skills/expo-animation/SKILL.md +295 -0
  70. package/bundled-skills/expo-animation/agents/openai.yaml +4 -0
  71. package/bundled-skills/fact-check-x-unified/SKILL.md +178 -0
  72. package/bundled-skills/fact-check-x-unified/agents/openai.yaml +4 -0
  73. package/bundled-skills/fact-check-x-unified/references/acceptance-criteria.md +44 -0
  74. package/bundled-skills/fact-check-x-unified/references/contracts.md +39 -0
  75. package/bundled-skills/fact-check-x-unified/scripts/common.py +31 -0
  76. package/bundled-skills/fact-check-x-unified/scripts/fact_check_x.py +1832 -0
  77. package/bundled-skills/fact-check-x-unified/scripts/trusted_search_config.py +324 -0
  78. package/bundled-skills/fact-check-x-unified/tests/anchor_downgrade_test.py +90 -0
  79. package/bundled-skills/fact-check-x-unified/tests/multi_platform_test.py +369 -0
  80. package/bundled-skills/fact-check-x-unified/tests/smoke_test.py +740 -0
  81. package/bundled-skills/fact-check-x-unified/tests/stage_checkpoint_test.py +103 -0
  82. package/bundled-skills/fact-check-x-unified/tests/trusted_search_config_test.py +156 -0
  83. package/bundled-skills/gpt-taste/SKILL.md +8 -1
  84. package/bundled-skills/hf-cli/SKILL.md +263 -0
  85. package/bundled-skills/huggingface-community-evals/SKILL.md +228 -0
  86. package/bundled-skills/huggingface-community-evals/examples/.env.example +3 -0
  87. package/bundled-skills/huggingface-community-evals/examples/USAGE_EXAMPLES.md +101 -0
  88. package/bundled-skills/huggingface-community-evals/scripts/inspect_eval_uv.py +104 -0
  89. package/bundled-skills/huggingface-community-evals/scripts/inspect_vllm_uv.py +306 -0
  90. package/bundled-skills/huggingface-community-evals/scripts/lighteval_vllm_uv.py +297 -0
  91. package/bundled-skills/huggingface-datasets/SKILL.md +130 -0
  92. package/bundled-skills/jev-social/SKILL.md +182 -0
  93. package/bundled-skills/longbridge-derivatives/SKILL.md +117 -0
  94. package/bundled-skills/longbridge-derivatives/references/option.md +36 -0
  95. package/bundled-skills/longbridge-derivatives/references/options-advanced.md +101 -0
  96. package/bundled-skills/longbridge-derivatives/references/options-pnl.md +74 -0
  97. package/bundled-skills/longbridge-derivatives/references/options-strategy.md +82 -0
  98. package/bundled-skills/longbridge-derivatives/references/options-volatility.md +70 -0
  99. package/bundled-skills/longbridge-derivatives/references/warrant.md +12 -0
  100. package/bundled-skills/longbridge-quant/SKILL.md +151 -0
  101. package/bundled-skills/longbridge-quant/references/correlation.md +51 -0
  102. package/bundled-skills/longbridge-quant/references/execution-model.md +68 -0
  103. package/bundled-skills/longbridge-quant/references/factor-research.md +95 -0
  104. package/bundled-skills/longbridge-quant/references/factor-screen.md +101 -0
  105. package/bundled-skills/longbridge-quant/references/hedging.md +136 -0
  106. package/bundled-skills/longbridge-quant/references/ml-strategy.md +77 -0
  107. package/bundled-skills/longbridge-quant/references/multifactor.md +68 -0
  108. package/bundled-skills/longbridge-quant/references/pairs-trading.md +61 -0
  109. package/bundled-skills/longbridge-quant/references/quant-cli.md +133 -0
  110. package/bundled-skills/longbridge-quant/references/quant-stats.md +150 -0
  111. package/bundled-skills/longbridge-quant/references/seasonality.md +50 -0
  112. package/bundled-skills/longbridge-quant/references/strategy-optimizer.md +68 -0
  113. package/bundled-skills/longbridge-quant/references/volatility-strategy.md +52 -0
  114. package/bundled-skills/longbridge-research/SKILL.md +187 -0
  115. package/bundled-skills/longbridge-research/references/company-profile.md +96 -0
  116. package/bundled-skills/longbridge-research/references/company-tearsheet.md +82 -0
  117. package/bundled-skills/longbridge-research/references/competitive-analysis.md +81 -0
  118. package/bundled-skills/longbridge-research/references/consensus.md +92 -0
  119. package/bundled-skills/longbridge-research/references/coverage-initiation.md +76 -0
  120. package/bundled-skills/longbridge-research/references/defi-yield.md +60 -0
  121. package/bundled-skills/longbridge-research/references/finance-calendar.md +165 -0
  122. package/bundled-skills/longbridge-research/references/financial-planning.md +77 -0
  123. package/bundled-skills/longbridge-research/references/forecast-eps.md +39 -0
  124. package/bundled-skills/longbridge-research/references/fund-holder.md +44 -0
  125. package/bundled-skills/longbridge-research/references/hkipo-analysis.md +101 -0
  126. package/bundled-skills/longbridge-research/references/industry-peers.md +46 -0
  127. package/bundled-skills/longbridge-research/references/industry-rank.md +62 -0
  128. package/bundled-skills/longbridge-research/references/insider-trades.md +48 -0
  129. package/bundled-skills/longbridge-research/references/institution-rating.md +62 -0
  130. package/bundled-skills/longbridge-research/references/investment-ideas.md +69 -0
  131. package/bundled-skills/longbridge-research/references/investment-proposal.md +95 -0
  132. package/bundled-skills/longbridge-research/references/investors.md +87 -0
  133. package/bundled-skills/longbridge-research/references/onchain.md +70 -0
  134. package/bundled-skills/longbridge-research/references/post-investment.md +76 -0
  135. package/bundled-skills/longbridge-research/references/shareholder.md +72 -0
  136. package/bundled-skills/longbridge-research/references/short-positions.md +50 -0
  137. package/bundled-skills/longbridge-research/references/short-trades.md +50 -0
  138. package/bundled-skills/longbridge-research/references/stock-research.md +61 -0
  139. package/bundled-skills/longbridge-research/references/thesis-tracker.md +64 -0
  140. package/bundled-skills/makepad-2-0-animation/SKILL.md +318 -0
  141. package/bundled-skills/makepad-2-0-animation/references/animator-reference.md +433 -0
  142. package/bundled-skills/makepad-2-0-dsl/SKILL.md +492 -0
  143. package/bundled-skills/makepad-2-0-dsl/references/dsl-syntax-reference.md +511 -0
  144. package/bundled-skills/makepad-2-0-dsl/references/extended-guide.md +56 -0
  145. package/bundled-skills/makepad-2-0-dsl/references/property-system.md +757 -0
  146. package/bundled-skills/makepad-2-0-events/SKILL.md +497 -0
  147. package/bundled-skills/makepad-2-0-events/references/event-patterns.md +802 -0
  148. package/bundled-skills/makepad-2-0-events/references/extended-guide.md +590 -0
  149. package/bundled-skills/makepad-2-0-layout/SKILL.md +499 -0
  150. package/bundled-skills/makepad-2-0-layout/references/extended-guide.md +243 -0
  151. package/bundled-skills/makepad-2-0-layout/references/layout-patterns.md +881 -0
  152. package/bundled-skills/makepad-2-0-widgets/SKILL.md +261 -0
  153. package/bundled-skills/makepad-2-0-widgets/references/widget-advanced.md +648 -0
  154. package/bundled-skills/makepad-2-0-widgets/references/widget-catalog.md +547 -0
  155. package/bundled-skills/meeting-distiller-pro/SKILL.md +120 -0
  156. package/bundled-skills/monte-carlo-analyze-root-cause/SKILL.md +12 -1
  157. package/bundled-skills/monte-carlo-asset-health/SKILL.md +12 -1
  158. package/bundled-skills/monte-carlo-context-detection/SKILL.md +170 -0
  159. package/bundled-skills/monte-carlo-context-detection/references/signal-definitions.md +46 -0
  160. package/bundled-skills/remotion-captions/SKILL.md +57 -0
  161. package/bundled-skills/remotion-captions/agents/openai.yaml +7 -0
  162. package/bundled-skills/remotion-captions/assets/remotion-icon.svg +4 -0
  163. package/bundled-skills/remotion-captions/display-captions.md +190 -0
  164. package/bundled-skills/remotion-captions/import-srt-captions.md +73 -0
  165. package/bundled-skills/remotion-captions/transcribe-captions.md +70 -0
  166. package/bundled-skills/remotion-create/SKILL.md +106 -0
  167. package/bundled-skills/remotion-create/agents/openai.yaml +7 -0
  168. package/bundled-skills/remotion-create/assets/remotion-icon.svg +4 -0
  169. package/bundled-skills/remotion-create/tailwind.md +11 -0
  170. package/bundled-skills/remotion-create/video-layout.md +9 -0
  171. package/bundled-skills/remotion-docs/SKILL.md +67 -0
  172. package/bundled-skills/remotion-docs/agents/openai.yaml +7 -0
  173. package/bundled-skills/remotion-docs/assets/remotion-icon.svg +4 -0
  174. package/bundled-skills/remotion-interactivity/SKILL.md +270 -0
  175. package/bundled-skills/remotion-interactivity/agents/openai.yaml +7 -0
  176. package/bundled-skills/remotion-interactivity/assets/remotion-icon.svg +4 -0
  177. package/bundled-skills/remotion-render/SKILL.md +48 -0
  178. package/bundled-skills/remotion-render/agents/openai.yaml +7 -0
  179. package/bundled-skills/remotion-render/assets/remotion-icon.svg +4 -0
  180. package/bundled-skills/remotion-render/transparent-videos.md +106 -0
  181. package/bundled-skills/saas-pricing-strategist/SKILL.md +169 -0
  182. package/bundled-skills/score-eval/SKILL.md +35 -0
  183. package/bundled-skills/writing-guidelines/SKILL.md +60 -0
  184. package/package.json +1 -1
  185. package/skills_index.json +980 -3
@@ -0,0 +1,306 @@
1
+ # /// script
2
+ # requires-python = ">=3.10"
3
+ # dependencies = [
4
+ # "inspect-ai>=0.3.0",
5
+ # "inspect-evals",
6
+ # "vllm>=0.4.0",
7
+ # "torch>=2.0.0",
8
+ # "transformers>=4.40.0",
9
+ # ]
10
+ # ///
11
+
12
+ """
13
+ Entry point script for running inspect-ai evaluations with vLLM or HuggingFace Transformers backend.
14
+
15
+ This script runs evaluations on custom HuggingFace models using local GPU inference,
16
+ separate from inference provider scripts (which use external APIs).
17
+
18
+ Usage (standalone):
19
+ uv run scripts/inspect_vllm_uv.py --model "meta-llama/Llama-3.2-1B" --task "mmlu"
20
+
21
+ Model backends:
22
+ - vllm: Fast inference with vLLM (recommended for large models)
23
+ - hf: HuggingFace Transformers backend (broader model compatibility)
24
+ """
25
+
26
+ from __future__ import annotations
27
+
28
+ import argparse
29
+ import os
30
+ import subprocess
31
+ import sys
32
+ from typing import Optional
33
+
34
+
35
+ def setup_environment() -> None:
36
+ """Configure environment variables for HuggingFace authentication."""
37
+ hf_token = os.getenv("HF_TOKEN")
38
+ if hf_token:
39
+ os.environ.setdefault("HUGGING_FACE_HUB_TOKEN", hf_token)
40
+ os.environ.setdefault("HF_HUB_TOKEN", hf_token)
41
+
42
+
43
+ def run_inspect_vllm(
44
+ model_id: str,
45
+ task: str,
46
+ limit: Optional[int] = None,
47
+ max_connections: int = 4,
48
+ temperature: float = 0.0,
49
+ tensor_parallel_size: int = 1,
50
+ gpu_memory_utilization: float = 0.8,
51
+ dtype: str = "auto",
52
+ trust_remote_code: bool = False,
53
+ log_level: str = "info",
54
+ ) -> None:
55
+ """
56
+ Run inspect-ai evaluation with vLLM backend.
57
+
58
+ Args:
59
+ model_id: HuggingFace model ID
60
+ task: inspect-ai task to execute (e.g., "mmlu", "gsm8k")
61
+ limit: Limit number of samples to evaluate
62
+ max_connections: Maximum concurrent connections
63
+ temperature: Sampling temperature
64
+ tensor_parallel_size: Number of GPUs for tensor parallelism
65
+ gpu_memory_utilization: GPU memory fraction
66
+ dtype: Data type (auto, float16, bfloat16)
67
+ trust_remote_code: Allow remote code execution
68
+ log_level: Logging level
69
+ """
70
+ setup_environment()
71
+
72
+ model_spec = f"vllm/{model_id}"
73
+ cmd = [
74
+ "inspect",
75
+ "eval",
76
+ task,
77
+ "--model",
78
+ model_spec,
79
+ "--log-level",
80
+ log_level,
81
+ "--max-connections",
82
+ str(max_connections),
83
+ ]
84
+
85
+ # vLLM supports temperature=0 unlike HF inference providers
86
+ cmd.extend(["--temperature", str(temperature)])
87
+
88
+ # Older inspect-ai CLI versions do not support --model-args; rely on defaults
89
+ # and let vLLM choose sensible settings for small models.
90
+ if tensor_parallel_size != 1:
91
+ cmd.extend(["--tensor-parallel-size", str(tensor_parallel_size)])
92
+ if gpu_memory_utilization != 0.8:
93
+ cmd.extend(["--gpu-memory-utilization", str(gpu_memory_utilization)])
94
+ if dtype != "auto":
95
+ cmd.extend(["--dtype", dtype])
96
+ if trust_remote_code:
97
+ cmd.append("--trust-remote-code")
98
+
99
+ if limit:
100
+ cmd.extend(["--limit", str(limit)])
101
+
102
+ print(f"Running: {' '.join(cmd)}")
103
+
104
+ try:
105
+ subprocess.run(cmd, check=True)
106
+ print("Evaluation complete.")
107
+ except subprocess.CalledProcessError as exc:
108
+ print(f"Evaluation failed with exit code {exc.returncode}", file=sys.stderr)
109
+ sys.exit(exc.returncode)
110
+
111
+
112
+ def run_inspect_hf(
113
+ model_id: str,
114
+ task: str,
115
+ limit: Optional[int] = None,
116
+ max_connections: int = 1,
117
+ temperature: float = 0.001,
118
+ device: str = "auto",
119
+ dtype: str = "auto",
120
+ trust_remote_code: bool = False,
121
+ log_level: str = "info",
122
+ ) -> None:
123
+ """
124
+ Run inspect-ai evaluation with HuggingFace Transformers backend.
125
+
126
+ Use this when vLLM doesn't support the model architecture.
127
+
128
+ Args:
129
+ model_id: HuggingFace model ID
130
+ task: inspect-ai task to execute
131
+ limit: Limit number of samples
132
+ max_connections: Maximum concurrent connections (keep low for memory)
133
+ temperature: Sampling temperature
134
+ device: Device to use (auto, cuda, cpu)
135
+ dtype: Data type
136
+ trust_remote_code: Allow remote code execution
137
+ log_level: Logging level
138
+ """
139
+ setup_environment()
140
+
141
+ model_spec = f"hf/{model_id}"
142
+
143
+ cmd = [
144
+ "inspect",
145
+ "eval",
146
+ task,
147
+ "--model",
148
+ model_spec,
149
+ "--log-level",
150
+ log_level,
151
+ "--max-connections",
152
+ str(max_connections),
153
+ "--temperature",
154
+ str(temperature),
155
+ ]
156
+
157
+ if device != "auto":
158
+ cmd.extend(["--device", device])
159
+ if dtype != "auto":
160
+ cmd.extend(["--dtype", dtype])
161
+ if trust_remote_code:
162
+ cmd.append("--trust-remote-code")
163
+
164
+ if limit:
165
+ cmd.extend(["--limit", str(limit)])
166
+
167
+ print(f"Running: {' '.join(cmd)}")
168
+
169
+ try:
170
+ subprocess.run(cmd, check=True)
171
+ print("Evaluation complete.")
172
+ except subprocess.CalledProcessError as exc:
173
+ print(f"Evaluation failed with exit code {exc.returncode}", file=sys.stderr)
174
+ sys.exit(exc.returncode)
175
+
176
+
177
+ def main() -> None:
178
+ parser = argparse.ArgumentParser(
179
+ description="Run inspect-ai evaluations with vLLM or HuggingFace Transformers on custom models",
180
+ formatter_class=argparse.RawDescriptionHelpFormatter,
181
+ epilog="""
182
+ Examples:
183
+ # Run MMLU with vLLM backend
184
+ uv run scripts/inspect_vllm_uv.py --model meta-llama/Llama-3.2-1B --task mmlu
185
+
186
+ # Run with HuggingFace Transformers backend
187
+ uv run scripts/inspect_vllm_uv.py --model meta-llama/Llama-3.2-1B --task mmlu --backend hf
188
+
189
+ # Run with limited samples for testing
190
+ uv run scripts/inspect_vllm_uv.py --model meta-llama/Llama-3.2-1B --task mmlu --limit 10
191
+
192
+ # Run on multiple GPUs with tensor parallelism
193
+ uv run scripts/inspect_vllm_uv.py --model meta-llama/Llama-3.2-70B --task mmlu --tensor-parallel-size 4
194
+
195
+ Available tasks (from inspect-evals):
196
+ - mmlu: Massive Multitask Language Understanding
197
+ - gsm8k: Grade School Math
198
+ - hellaswag: Common sense reasoning
199
+ - arc_challenge: AI2 Reasoning Challenge
200
+ - truthfulqa: TruthfulQA benchmark
201
+ - winogrande: Winograd Schema Challenge
202
+ - humaneval: Code generation (HumanEval)
203
+
204
+ """,
205
+ )
206
+
207
+ parser.add_argument(
208
+ "--model",
209
+ required=True,
210
+ help="HuggingFace model ID (e.g., meta-llama/Llama-3.2-1B)",
211
+ )
212
+ parser.add_argument(
213
+ "--task",
214
+ required=True,
215
+ help="inspect-ai task to execute (e.g., mmlu, gsm8k)",
216
+ )
217
+ parser.add_argument(
218
+ "--backend",
219
+ choices=["vllm", "hf"],
220
+ default="vllm",
221
+ help="Model backend (default: vllm)",
222
+ )
223
+ parser.add_argument(
224
+ "--limit",
225
+ type=int,
226
+ default=None,
227
+ help="Limit number of samples to evaluate",
228
+ )
229
+ parser.add_argument(
230
+ "--max-connections",
231
+ type=int,
232
+ default=None,
233
+ help="Maximum concurrent connections (default: 4 for vllm, 1 for hf)",
234
+ )
235
+ parser.add_argument(
236
+ "--temperature",
237
+ type=float,
238
+ default=None,
239
+ help="Sampling temperature (default: 0.0 for vllm, 0.001 for hf)",
240
+ )
241
+ parser.add_argument(
242
+ "--tensor-parallel-size",
243
+ type=int,
244
+ default=1,
245
+ help="Number of GPUs for tensor parallelism (vLLM only, default: 1)",
246
+ )
247
+ parser.add_argument(
248
+ "--gpu-memory-utilization",
249
+ type=float,
250
+ default=0.8,
251
+ help="GPU memory fraction to use (vLLM only, default: 0.8)",
252
+ )
253
+ parser.add_argument(
254
+ "--dtype",
255
+ default="auto",
256
+ choices=["auto", "float16", "bfloat16", "float32"],
257
+ help="Data type for model weights (default: auto)",
258
+ )
259
+ parser.add_argument(
260
+ "--device",
261
+ default="auto",
262
+ help="Device for HF backend (auto, cuda, cpu)",
263
+ )
264
+ parser.add_argument(
265
+ "--trust-remote-code",
266
+ action="store_true",
267
+ help="Allow executing remote code from model repository",
268
+ )
269
+ parser.add_argument(
270
+ "--log-level",
271
+ default="info",
272
+ choices=["debug", "info", "warning", "error"],
273
+ help="Logging level (default: info)",
274
+ )
275
+
276
+ args = parser.parse_args()
277
+
278
+ if args.backend == "vllm":
279
+ run_inspect_vllm(
280
+ model_id=args.model,
281
+ task=args.task,
282
+ limit=args.limit,
283
+ max_connections=args.max_connections or 4,
284
+ temperature=args.temperature if args.temperature is not None else 0.0,
285
+ tensor_parallel_size=args.tensor_parallel_size,
286
+ gpu_memory_utilization=args.gpu_memory_utilization,
287
+ dtype=args.dtype,
288
+ trust_remote_code=args.trust_remote_code,
289
+ log_level=args.log_level,
290
+ )
291
+ else:
292
+ run_inspect_hf(
293
+ model_id=args.model,
294
+ task=args.task,
295
+ limit=args.limit,
296
+ max_connections=args.max_connections or 1,
297
+ temperature=args.temperature if args.temperature is not None else 0.001,
298
+ device=args.device,
299
+ dtype=args.dtype,
300
+ trust_remote_code=args.trust_remote_code,
301
+ log_level=args.log_level,
302
+ )
303
+
304
+
305
+ if __name__ == "__main__":
306
+ main()
@@ -0,0 +1,297 @@
1
+ # /// script
2
+ # requires-python = ">=3.10"
3
+ # dependencies = [
4
+ # "lighteval[accelerate,vllm]>=0.6.0",
5
+ # "torch>=2.0.0",
6
+ # "transformers>=4.40.0",
7
+ # "accelerate>=0.30.0",
8
+ # "vllm>=0.4.0",
9
+ # ]
10
+ # ///
11
+
12
+ """
13
+ Entry point script for running lighteval evaluations with local GPU backends.
14
+
15
+ This script runs evaluations using vLLM or accelerate on custom HuggingFace models.
16
+ It is separate from inference provider scripts and evaluates models directly on local hardware.
17
+
18
+ Usage (standalone):
19
+ uv run scripts/lighteval_vllm_uv.py --model "meta-llama/Llama-3.2-1B" --tasks "leaderboard|mmlu|5"
20
+
21
+ """
22
+
23
+ from __future__ import annotations
24
+
25
+ import argparse
26
+ import os
27
+ import subprocess
28
+ import sys
29
+ from typing import Optional
30
+
31
+
32
+ def setup_environment() -> None:
33
+ """Configure environment variables for HuggingFace authentication."""
34
+ hf_token = os.getenv("HF_TOKEN")
35
+ if hf_token:
36
+ os.environ.setdefault("HUGGING_FACE_HUB_TOKEN", hf_token)
37
+ os.environ.setdefault("HF_HUB_TOKEN", hf_token)
38
+
39
+
40
+ def run_lighteval_vllm(
41
+ model_id: str,
42
+ tasks: str,
43
+ output_dir: Optional[str] = None,
44
+ max_samples: Optional[int] = None,
45
+ batch_size: int = 1,
46
+ tensor_parallel_size: int = 1,
47
+ gpu_memory_utilization: float = 0.8,
48
+ dtype: str = "auto",
49
+ trust_remote_code: bool = False,
50
+ use_chat_template: bool = False,
51
+ system_prompt: Optional[str] = None,
52
+ ) -> None:
53
+ """
54
+ Run lighteval with vLLM backend for efficient GPU inference.
55
+
56
+ Args:
57
+ model_id: HuggingFace model ID (e.g., "meta-llama/Llama-3.2-1B")
58
+ tasks: Task specification (e.g., "leaderboard|mmlu|5" or "lighteval|hellaswag|0")
59
+ output_dir: Directory for evaluation results
60
+ max_samples: Limit number of samples per task
61
+ batch_size: Batch size for evaluation
62
+ tensor_parallel_size: Number of GPUs for tensor parallelism
63
+ gpu_memory_utilization: GPU memory fraction to use (0.0-1.0)
64
+ dtype: Data type for model weights (auto, float16, bfloat16)
65
+ trust_remote_code: Allow executing remote code from model repo
66
+ use_chat_template: Apply chat template for conversational models
67
+ system_prompt: System prompt for chat models
68
+ """
69
+ setup_environment()
70
+
71
+ # Build lighteval vllm command
72
+ cmd = [
73
+ "lighteval",
74
+ "vllm",
75
+ model_id,
76
+ tasks,
77
+ "--batch-size", str(batch_size),
78
+ "--tensor-parallel-size", str(tensor_parallel_size),
79
+ "--gpu-memory-utilization", str(gpu_memory_utilization),
80
+ "--dtype", dtype,
81
+ ]
82
+
83
+ if output_dir:
84
+ cmd.extend(["--output-dir", output_dir])
85
+
86
+ if max_samples:
87
+ cmd.extend(["--max-samples", str(max_samples)])
88
+
89
+ if trust_remote_code:
90
+ cmd.append("--trust-remote-code")
91
+
92
+ if use_chat_template:
93
+ cmd.append("--use-chat-template")
94
+
95
+ if system_prompt:
96
+ cmd.extend(["--system-prompt", system_prompt])
97
+
98
+ print(f"Running: {' '.join(cmd)}")
99
+
100
+ try:
101
+ subprocess.run(cmd, check=True)
102
+ print("Evaluation complete.")
103
+ except subprocess.CalledProcessError as exc:
104
+ print(f"Evaluation failed with exit code {exc.returncode}", file=sys.stderr)
105
+ sys.exit(exc.returncode)
106
+
107
+
108
+ def run_lighteval_accelerate(
109
+ model_id: str,
110
+ tasks: str,
111
+ output_dir: Optional[str] = None,
112
+ max_samples: Optional[int] = None,
113
+ batch_size: int = 1,
114
+ dtype: str = "bfloat16",
115
+ trust_remote_code: bool = False,
116
+ use_chat_template: bool = False,
117
+ system_prompt: Optional[str] = None,
118
+ ) -> None:
119
+ """
120
+ Run lighteval with accelerate backend for multi-GPU distributed inference.
121
+
122
+ Use this backend when vLLM is not available or for models not supported by vLLM.
123
+
124
+ Args:
125
+ model_id: HuggingFace model ID
126
+ tasks: Task specification
127
+ output_dir: Directory for evaluation results
128
+ max_samples: Limit number of samples per task
129
+ batch_size: Batch size for evaluation
130
+ dtype: Data type for model weights
131
+ trust_remote_code: Allow executing remote code
132
+ use_chat_template: Apply chat template
133
+ system_prompt: System prompt for chat models
134
+ """
135
+ setup_environment()
136
+
137
+ # Build lighteval accelerate command
138
+ cmd = [
139
+ "lighteval",
140
+ "accelerate",
141
+ model_id,
142
+ tasks,
143
+ "--batch-size", str(batch_size),
144
+ "--dtype", dtype,
145
+ ]
146
+
147
+ if output_dir:
148
+ cmd.extend(["--output-dir", output_dir])
149
+
150
+ if max_samples:
151
+ cmd.extend(["--max-samples", str(max_samples)])
152
+
153
+ if trust_remote_code:
154
+ cmd.append("--trust-remote-code")
155
+
156
+ if use_chat_template:
157
+ cmd.append("--use-chat-template")
158
+
159
+ if system_prompt:
160
+ cmd.extend(["--system-prompt", system_prompt])
161
+
162
+ print(f"Running: {' '.join(cmd)}")
163
+
164
+ try:
165
+ subprocess.run(cmd, check=True)
166
+ print("Evaluation complete.")
167
+ except subprocess.CalledProcessError as exc:
168
+ print(f"Evaluation failed with exit code {exc.returncode}", file=sys.stderr)
169
+ sys.exit(exc.returncode)
170
+
171
+
172
+ def main() -> None:
173
+ parser = argparse.ArgumentParser(
174
+ description="Run lighteval evaluations with vLLM or accelerate backend on custom HuggingFace models",
175
+ formatter_class=argparse.RawDescriptionHelpFormatter,
176
+ epilog="""
177
+ Examples:
178
+ # Run MMLU evaluation with vLLM
179
+ uv run scripts/lighteval_vllm_uv.py --model meta-llama/Llama-3.2-1B --tasks "leaderboard|mmlu|5"
180
+
181
+ # Run with accelerate backend instead of vLLM
182
+ uv run scripts/lighteval_vllm_uv.py --model meta-llama/Llama-3.2-1B --tasks "leaderboard|mmlu|5" --backend accelerate
183
+
184
+ # Run with chat template for instruction-tuned models
185
+ uv run scripts/lighteval_vllm_uv.py --model meta-llama/Llama-3.2-1B-Instruct --tasks "leaderboard|mmlu|5" --use-chat-template
186
+
187
+ # Run with limited samples for testing
188
+ uv run scripts/lighteval_vllm_uv.py --model meta-llama/Llama-3.2-1B --tasks "leaderboard|mmlu|5" --max-samples 10
189
+
190
+ Task format:
191
+ Tasks use the format: "suite|task|num_fewshot"
192
+ - leaderboard|mmlu|5 (MMLU with 5-shot)
193
+ - lighteval|hellaswag|0 (HellaSwag zero-shot)
194
+ - leaderboard|gsm8k|5 (GSM8K with 5-shot)
195
+ - Multiple tasks: "leaderboard|mmlu|5,leaderboard|gsm8k|5"
196
+ """,
197
+ )
198
+
199
+ parser.add_argument(
200
+ "--model",
201
+ required=True,
202
+ help="HuggingFace model ID (e.g., meta-llama/Llama-3.2-1B)",
203
+ )
204
+ parser.add_argument(
205
+ "--tasks",
206
+ required=True,
207
+ help="Task specification (e.g., 'leaderboard|mmlu|5')",
208
+ )
209
+ parser.add_argument(
210
+ "--backend",
211
+ choices=["vllm", "accelerate"],
212
+ default="vllm",
213
+ help="Inference backend to use (default: vllm)",
214
+ )
215
+ parser.add_argument(
216
+ "--output-dir",
217
+ default=None,
218
+ help="Directory for evaluation results",
219
+ )
220
+ parser.add_argument(
221
+ "--max-samples",
222
+ type=int,
223
+ default=None,
224
+ help="Limit number of samples per task (useful for testing)",
225
+ )
226
+ parser.add_argument(
227
+ "--batch-size",
228
+ type=int,
229
+ default=1,
230
+ help="Batch size for evaluation (default: 1)",
231
+ )
232
+ parser.add_argument(
233
+ "--tensor-parallel-size",
234
+ type=int,
235
+ default=1,
236
+ help="Number of GPUs for tensor parallelism (vLLM only, default: 1)",
237
+ )
238
+ parser.add_argument(
239
+ "--gpu-memory-utilization",
240
+ type=float,
241
+ default=0.8,
242
+ help="GPU memory fraction to use (vLLM only, default: 0.8)",
243
+ )
244
+ parser.add_argument(
245
+ "--dtype",
246
+ default="auto",
247
+ choices=["auto", "float16", "bfloat16", "float32"],
248
+ help="Data type for model weights (default: auto)",
249
+ )
250
+ parser.add_argument(
251
+ "--trust-remote-code",
252
+ action="store_true",
253
+ help="Allow executing remote code from model repository",
254
+ )
255
+ parser.add_argument(
256
+ "--use-chat-template",
257
+ action="store_true",
258
+ help="Apply chat template for instruction-tuned/chat models",
259
+ )
260
+ parser.add_argument(
261
+ "--system-prompt",
262
+ default=None,
263
+ help="System prompt for chat models",
264
+ )
265
+
266
+ args = parser.parse_args()
267
+
268
+ if args.backend == "vllm":
269
+ run_lighteval_vllm(
270
+ model_id=args.model,
271
+ tasks=args.tasks,
272
+ output_dir=args.output_dir,
273
+ max_samples=args.max_samples,
274
+ batch_size=args.batch_size,
275
+ tensor_parallel_size=args.tensor_parallel_size,
276
+ gpu_memory_utilization=args.gpu_memory_utilization,
277
+ dtype=args.dtype,
278
+ trust_remote_code=args.trust_remote_code,
279
+ use_chat_template=args.use_chat_template,
280
+ system_prompt=args.system_prompt,
281
+ )
282
+ else:
283
+ run_lighteval_accelerate(
284
+ model_id=args.model,
285
+ tasks=args.tasks,
286
+ output_dir=args.output_dir,
287
+ max_samples=args.max_samples,
288
+ batch_size=args.batch_size,
289
+ dtype=args.dtype if args.dtype != "auto" else "bfloat16",
290
+ trust_remote_code=args.trust_remote_code,
291
+ use_chat_template=args.use_chat_template,
292
+ system_prompt=args.system_prompt,
293
+ )
294
+
295
+
296
+ if __name__ == "__main__":
297
+ main()