programasweights 0.1.1__tar.gz → 0.2.1__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.
- programasweights-0.2.1/.cursor/rules/vllm-deployment.mdc +106 -0
- programasweights-0.2.1/.git +1 -0
- programasweights-0.2.1/.github/workflows/web-sdk.yml +51 -0
- programasweights-0.2.1/.gitignore +76 -0
- programasweights-0.2.1/.gitmodules +3 -0
- programasweights-0.2.1/.hatch_build.toml +28 -0
- programasweights-0.2.1/.readthedocs.yaml +13 -0
- programasweights-0.2.1/1apple.jpg +0 -0
- programasweights-0.2.1/1apple2.jpg +0 -0
- programasweights-0.2.1/2apples.jpg +0 -0
- programasweights-0.2.1/2apples2.jpg +0 -0
- programasweights-0.2.1/3apples.jpg +0 -0
- programasweights-0.2.1/3apples2.jpg +0 -0
- programasweights-0.2.1/479400.png +0 -0
- programasweights-0.2.1/4apples.jpg +0 -0
- programasweights-0.2.1/4apples2.jpg +0 -0
- programasweights-0.2.1/4apples3.jpg +0 -0
- programasweights-0.2.1/4apples4.jpg +0 -0
- programasweights-0.2.1/5apples.jpg +0 -0
- programasweights-0.2.1/6apples.jpg +0 -0
- programasweights-0.2.1/8apples.jpg +0 -0
- programasweights-0.2.1/9apples.jpg +0 -0
- programasweights-0.2.1/AGENTS.md +129 -0
- programasweights-0.2.1/CHANGELOG.md +13 -0
- programasweights-0.2.1/FLOW_SUMMARY.md +202 -0
- programasweights-0.2.1/LICENSE +21 -0
- {programasweights-0.1.1 → programasweights-0.2.1}/MANIFEST.in +1 -0
- programasweights-0.2.1/ONNX_MIGRATION_PLAN.md +84 -0
- programasweights-0.2.1/PKG-INFO +144 -0
- programasweights-0.2.1/PREFIX_TOKENS_DESIGN.md +176 -0
- programasweights-0.2.1/PYPI_README.md +114 -0
- {programasweights-0.1.1 → programasweights-0.2.1}/README.md +2 -2
- programasweights-0.2.1/TRUNCATION_CHANGES.md +185 -0
- programasweights-0.2.1/USE_CASES_AND_IDEAS.md +748 -0
- programasweights-0.2.1/VERIFICATION_USAGE.md +282 -0
- programasweights-0.2.1/analyze_dataset.py +372 -0
- programasweights-0.2.1/analyze_lengths.py +246 -0
- programasweights-0.2.1/baselines/code_prompt.md +21 -0
- programasweights-0.2.1/baselines/evaluate_openai_python_code_baseline.py +296 -0
- programasweights-0.2.1/baselines/openai_batch_request.py +218 -0
- programasweights-0.2.1/baselines/prepare_alchemist_data.py +194 -0
- programasweights-0.2.1/baselines/prepare_var_bench_data.py +53 -0
- programasweights-0.2.1/baselines/python_code_sandbox.py +302 -0
- programasweights-0.2.1/baselines/script_evaluation_var_bench.sh +3 -0
- programasweights-0.2.1/baselines/script_evalution_evaluation.sh +8 -0
- programasweights-0.2.1/baselines/script_evalution_request.sh +8 -0
- programasweights-0.2.1/baselines/script_evalution_statistics.sh +8 -0
- programasweights-0.2.1/benchmark_pytorch_vs_onnx.py +315 -0
- programasweights-0.2.1/benchmark_user_experience.py +375 -0
- programasweights-0.2.1/check_dataset.py +31 -0
- programasweights-0.2.1/combine_datasets.py +157 -0
- programasweights-0.2.1/compare_datasets.py +268 -0
- programasweights-0.2.1/compare_old_vs_regen.py +227 -0
- programasweights-0.2.1/convert_paw_to_svg.py +119 -0
- programasweights-0.2.1/create_favicon_sizes.py +86 -0
- programasweights-0.2.1/create_visualization_from_log.py +269 -0
- programasweights-0.2.1/create_vqa_dataset.py +217 -0
- programasweights-0.2.1/debug_cache.py +80 -0
- programasweights-0.2.1/debug_eos_example.sh +22 -0
- programasweights-0.2.1/docs/adr/001-llama-cpp-over-pytorch.md +21 -0
- programasweights-0.2.1/docs/adr/002-q4_0-adapter-format.md +32 -0
- programasweights-0.2.1/docs/adr/003-single-spec-field.md +26 -0
- programasweights-0.2.1/docs/adr/004-compiler-naming.md +32 -0
- programasweights-0.2.1/docs/adr/005-vllm-hidden-states.md +24 -0
- programasweights-0.2.1/docs/adr/006-email-api-key-auth.md +41 -0
- programasweights-0.2.1/docs/advanced/adrs.md +66 -0
- programasweights-0.2.1/docs/advanced/architecture.md +47 -0
- programasweights-0.2.1/docs/api-reference/cli.md +90 -0
- programasweights-0.2.1/docs/api-reference/python-sdk.md +107 -0
- programasweights-0.2.1/docs/api-reference/rest-api.md +158 -0
- programasweights-0.2.1/docs/architecture.md +38 -0
- programasweights-0.2.1/docs/getting-started/first-program.md +77 -0
- programasweights-0.2.1/docs/getting-started/installation.md +36 -0
- programasweights-0.2.1/docs/getting-started/naming-programs.md +78 -0
- programasweights-0.2.1/docs/guide/browser-inference.md +139 -0
- programasweights-0.2.1/docs/guide/how-it-works.md +47 -0
- programasweights-0.2.1/docs/guide/local-inference.md +40 -0
- programasweights-0.2.1/docs/guide/writing-good-specs.md +36 -0
- programasweights-0.2.1/docs/hub/browsing-programs.md +37 -0
- programasweights-0.2.1/docs/hub/feedback-cases.md +34 -0
- programasweights-0.2.1/docs/hub/publishing-programs.md +31 -0
- programasweights-0.2.1/docs/index.md +82 -0
- programasweights-0.2.1/docs/requirements.txt +2 -0
- programasweights-0.2.1/estimate_data_gen_cost.py +273 -0
- programasweights-0.2.1/eval.py +739 -0
- programasweights-0.2.1/examples/flask_app.py +52 -0
- programasweights-0.2.1/examples/jupyter_notebook.py +52 -0
- programasweights-0.2.1/examples/langchain_integration.py +52 -0
- programasweights-0.2.1/examples/replace_openai.py +44 -0
- programasweights-0.2.1/export_to_onnx.py +485 -0
- programasweights-0.2.1/extract_models.py +193 -0
- programasweights-0.2.1/inspect_data_dirs.py +384 -0
- programasweights-0.2.1/latest_export.csv +230 -0
- programasweights-0.2.1/log.train.81920.morecategories.extraprefix +14928 -0
- programasweights-0.2.1/main_no_spec_direct_ans_mix_continuous_sampleref_shorterprompt_vllm.py +1546 -0
- programasweights-0.2.1/merge_datasets.py +303 -0
- programasweights-0.2.1/mkdocs.yml +81 -0
- programasweights-0.2.1/paw.png +0 -0
- programasweights-0.2.1/paw.svg +34 -0
- programasweights-0.2.1/process_im2latex_dataset.py +207 -0
- programasweights-0.2.1/programasweights/__init__.py +185 -0
- programasweights-0.2.1/programasweights/cache.py +122 -0
- programasweights-0.2.1/programasweights/cli.py +215 -0
- programasweights-0.2.1/programasweights/client.py +151 -0
- programasweights-0.2.1/programasweights/compiler/__init__.py +263 -0
- {programasweights-0.1.1 → programasweights-0.2.1}/programasweights/compiler/dummy.py +6 -2
- programasweights-0.2.1/programasweights/config.py +62 -0
- programasweights-0.2.1/programasweights/convert_peft_to_paw.py +187 -0
- programasweights-0.2.1/programasweights/paw_format.py +330 -0
- programasweights-0.2.1/programasweights/runtime/__init__.py +22 -0
- programasweights-0.2.1/programasweights/runtime/interpreter.py +485 -0
- programasweights-0.2.1/programasweights/runtime/interpreter_onnx.py +534 -0
- programasweights-0.2.1/programasweights/runtime_llamacpp.py +199 -0
- programasweights-0.2.1/programasweights_lora/__init__.py +28 -0
- programasweights-0.2.1/programasweights_lora/compiler/__init__.py +112 -0
- programasweights-0.2.1/programasweights_lora/lora_format.py +193 -0
- programasweights-0.2.1/programasweights_lora/runtime/__init__.py +6 -0
- programasweights-0.2.1/programasweights_lora/runtime/interpreter_lora.py +267 -0
- programasweights-0.2.1/programasweights_lora/tests/test_compile_and_run.py +67 -0
- programasweights-0.2.1/programasweights_lora/tests/test_lora_format.py +91 -0
- programasweights-0.2.1/programasweights_lora/tests/test_training.py +153 -0
- programasweights-0.2.1/programasweights_lora/train_lora.py +101 -0
- programasweights-0.2.1/programasweights_lora/training/__init__.py +6 -0
- programasweights-0.2.1/programasweights_lora/training/loops/lora_tuning_sft.py +655 -0
- {programasweights-0.1.1 → programasweights-0.2.1}/pyproject.toml +20 -29
- programasweights-0.2.1/run_eval.sh +95 -0
- programasweights-0.2.1/run_training.sh +70 -0
- programasweights-0.2.1/scripts/filter_table_by_length.py +150 -0
- programasweights-0.2.1/server/.env.example +47 -0
- programasweights-0.2.1/server/alembic/env.py +48 -0
- programasweights-0.2.1/server/alembic/script.py.mako +24 -0
- programasweights-0.2.1/server/alembic/versions/001_initial_schema.py +127 -0
- programasweights-0.2.1/server/alembic/versions/002_namespaced_aliases_hf_url.py +37 -0
- programasweights-0.2.1/server/alembic/versions/003_fulltext_search_ranking.py +41 -0
- programasweights-0.2.1/server/alembic/versions/004_fix_alias_slug_constraint.py +49 -0
- programasweights-0.2.1/server/alembic.ini +36 -0
- programasweights-0.2.1/server/api/__init__.py +1 -0
- programasweights-0.2.1/server/api/config.py +76 -0
- programasweights-0.2.1/server/api/dependencies.py +63 -0
- programasweights-0.2.1/server/api/logging_config.py +74 -0
- programasweights-0.2.1/server/api/main.py +233 -0
- programasweights-0.2.1/server/api/middleware/__init__.py +0 -0
- programasweights-0.2.1/server/api/middleware/rate_limit.py +172 -0
- programasweights-0.2.1/server/api/models/__init__.py +1 -0
- programasweights-0.2.1/server/api/models/database.py +41 -0
- programasweights-0.2.1/server/api/models/orm.py +205 -0
- programasweights-0.2.1/server/api/models/schemas.py +224 -0
- programasweights-0.2.1/server/api/routes/__init__.py +1 -0
- programasweights-0.2.1/server/api/routes/auth.py +275 -0
- programasweights-0.2.1/server/api/routes/compile.py +276 -0
- programasweights-0.2.1/server/api/routes/feedback.py +45 -0
- programasweights-0.2.1/server/api/routes/health.py +24 -0
- programasweights-0.2.1/server/api/routes/infer.py +115 -0
- programasweights-0.2.1/server/api/routes/models_info.py +17 -0
- programasweights-0.2.1/server/api/routes/programs.py +728 -0
- programasweights-0.2.1/server/api/services/__init__.py +1 -0
- programasweights-0.2.1/server/api/services/auto_tag_service.py +103 -0
- programasweights-0.2.1/server/api/services/auto_title_service.py +100 -0
- programasweights-0.2.1/server/api/services/compile_provider.py +712 -0
- programasweights-0.2.1/server/api/services/compile_service.py +546 -0
- programasweights-0.2.1/server/api/services/infer_service.py +263 -0
- programasweights-0.2.1/server/api/services/search_service.py +152 -0
- programasweights-0.2.1/server/api/services/storage_service.py +239 -0
- programasweights-0.2.1/server/benchmarks/benchmark_api.py +301 -0
- programasweights-0.2.1/server/benchmarks/handcrafted_specs.json +130 -0
- programasweights-0.2.1/server/benchmarks/last_benchmark_results.json +266 -0
- programasweights-0.2.1/server/benchmarks/last_stress_results.json +250 -0
- programasweights-0.2.1/server/benchmarks/stress_test.py +695 -0
- programasweights-0.2.1/server/compiler_registry.json +26 -0
- programasweights-0.2.1/server/provider_configs/gpt2.json +17 -0
- programasweights-0.2.1/server/provider_configs/qwen3-0.6b.json +16 -0
- programasweights-0.2.1/server/requirements.txt +25 -0
- programasweights-0.2.1/server/scripts/ab_test_hf_vs_vllm.py +180 -0
- programasweights-0.2.1/server/scripts/ablation_search.py +221 -0
- programasweights-0.2.1/server/scripts/backfill_hf_browser_assets.py +226 -0
- programasweights-0.2.1/server/scripts/backfill_hf_safetensors.py +95 -0
- programasweights-0.2.1/server/scripts/backfill_interestingness.py +111 -0
- programasweights-0.2.1/server/scripts/backfill_tags.py +76 -0
- programasweights-0.2.1/server/scripts/backfill_titles.py +76 -0
- programasweights-0.2.1/server/scripts/benchmark_gpt2.py +89 -0
- programasweights-0.2.1/server/scripts/cleanup_storage.py +66 -0
- programasweights-0.2.1/server/scripts/eval_search.py +211 -0
- programasweights-0.2.1/server/scripts/evict_cold_programs.py +40 -0
- programasweights-0.2.1/server/scripts/generate_prefix_cache.py +117 -0
- programasweights-0.2.1/server/scripts/launch_gpt2_compiler.py +32 -0
- programasweights-0.2.1/server/scripts/launch_qwen3_compiler.py +32 -0
- programasweights-0.2.1/server/scripts/patch_vllm.sh +65 -0
- programasweights-0.2.1/server/scripts/restart.sh +23 -0
- programasweights-0.2.1/server/scripts/start_all.sh +193 -0
- programasweights-0.2.1/server/scripts/start_gpt2_services.sh +67 -0
- programasweights-0.2.1/server/scripts/start_provider.sh +27 -0
- programasweights-0.2.1/server/scripts/start_services.sh +86 -0
- programasweights-0.2.1/server/tests/__init__.py +1 -0
- programasweights-0.2.1/server/tests/conftest.py +86 -0
- programasweights-0.2.1/server/tests/test_auth.py +52 -0
- programasweights-0.2.1/server/tests/test_compile.py +97 -0
- programasweights-0.2.1/server/tests/test_errors.py +60 -0
- programasweights-0.2.1/server/tests/test_infer.py +72 -0
- programasweights-0.2.1/server/tests/test_integration_gpu.py +183 -0
- programasweights-0.2.1/server/tests/test_rate_limit.py +213 -0
- programasweights-0.2.1/server/tests/test_storage.py +134 -0
- programasweights-0.2.1/server/vllm_models/__init__.py +1 -0
- programasweights-0.2.1/server/vllm_models/gpt2_lora_patch.py +34 -0
- programasweights-0.2.1/server/vllm_models/paw_compiler.py +414 -0
- programasweights-0.2.1/server/vllm_models/prepare_checkpoint.py +143 -0
- programasweights-0.2.1/server/vllm_models/register.py +17 -0
- programasweights-0.2.1/stage2_firstpromptqwen_512_e1_generate_lora_e2grpo_overfit_one_debug.reward_plot.rollout_ppl.png +0 -0
- programasweights-0.2.1/stage2_firstpromptqwen_512_e1_generate_lora_e2grpo_overfit_one_debug.reward_plot.train_gt_logprob.em_es.png +0 -0
- programasweights-0.2.1/stage2_firstpromptqwen_512_e1_generate_lora_e2grpo_overfit_one_debug.reward_plot.train_gt_logprob.ppl.png +0 -0
- programasweights-0.2.1/stage2_firstpromptqwen_512_e1_generate_lora_e2grpo_overfit_one_debug.reward_plot.train_gt_logprob.reward.png +0 -0
- {programasweights-0.1.1 → programasweights-0.2.1}/test_1spec.py +1 -1
- programasweights-0.2.1/test_all_caching.py +167 -0
- programasweights-0.2.1/test_apple_count.py +84 -0
- programasweights-0.2.1/test_batch_pilot.py +593 -0
- programasweights-0.2.1/test_e2e.py +363 -0
- programasweights-0.2.1/test_nspecs.py +18 -0
- programasweights-0.2.1/test_one_vs_two_step.py +149 -0
- programasweights-0.2.1/test_onnx_correctness.py +430 -0
- programasweights-0.2.1/test_onnx_hf_model.py +39 -0
- programasweights-0.2.1/test_onnx_hf_with_images.py +158 -0
- programasweights-0.2.1/test_paw_format.py +144 -0
- programasweights-0.2.1/test_thinking_comparison.py +542 -0
- programasweights-0.2.1/tests/test_offline_cache.py +97 -0
- programasweights-0.2.1/tests/test_sdk.py +444 -0
- programasweights-0.2.1/tests/test_sdk.sh +89 -0
- {programasweights-0.1.1 → programasweights-0.2.1}/train.py +60 -12
- programasweights-0.2.1/train_no_spec_direct_ans_mix_continuous_sampleref_trainonly_shorterprompt_withregularizer_generate_lora.py +3581 -0
- programasweights-0.2.1/training/data_generation/DATASET_CHANGELOG.md +1791 -0
- programasweights-0.2.1/training/data_generation/VERIFICATION_PIPELINE.md +259 -0
- programasweights-0.2.1/training/data_generation/build_user_bench.py +487 -0
- programasweights-0.2.1/training/data_generation/dry_run_batch.py +248 -0
- programasweights-0.2.1/training/data_generation/filter_test_data.py +397 -0
- programasweights-0.2.1/training/data_generation/generate_specs.py +716 -0
- programasweights-0.2.1/training/data_generation/generate_specs_batch.py +368 -0
- programasweights-0.2.1/training/data_generation/incremental_merge.py +397 -0
- programasweights-0.2.1/training/data_generation/merge_and_upload.py +383 -0
- programasweights-0.2.1/training/data_generation/regenerate_outputs_batch.py +522 -0
- {programasweights-0.1.1 → programasweights-0.2.1}/training/data_generation/synthesize_data.py +91 -40
- programasweights-0.2.1/training/data_generation/synthesize_data_batch.py +389 -0
- programasweights-0.2.1/training/data_generation/templates/filter_system.txt +10 -0
- programasweights-0.2.1/training/data_generation/templates/filter_user.txt +9 -0
- programasweights-0.2.1/training/data_generation/templates/pairs_system.txt +3 -0
- programasweights-0.2.1/training/data_generation/templates/pairs_user.txt +14 -0
- programasweights-0.2.1/training/data_generation/templates/specs_system.txt +1 -0
- programasweights-0.2.1/training/data_generation/templates/specs_user.txt +11 -0
- programasweights-0.2.1/training/data_generation/templates/specs_user_freeform.txt +8 -0
- programasweights-0.2.1/training/data_generation/templates/specs_user_freeform_with_examples.txt +8 -0
- programasweights-0.2.1/training/data_generation/templates/specs_user_with_examples.txt +11 -0
- programasweights-0.2.1/training/data_generation/templates/verify_system.txt +10 -0
- programasweights-0.2.1/training/data_generation/templates/verify_user.txt +3 -0
- programasweights-0.2.1/training/data_generation/templates_old/filter_system.txt +10 -0
- programasweights-0.2.1/training/data_generation/templates_old/filter_user.txt +9 -0
- {programasweights-0.1.1/training/data_generation/templates → programasweights-0.2.1/training/data_generation/templates_old}/specs_user.txt +1 -1
- programasweights-0.2.1/training/data_generation/templates_old/specs_user_freeform.txt +8 -0
- programasweights-0.2.1/training/data_generation/templates_old/specs_user_freeform_with_examples.txt +8 -0
- programasweights-0.2.1/training/data_generation/templates_old/specs_user_with_examples.txt +10 -0
- programasweights-0.2.1/training/data_generation/templates_old/verify_system.txt +10 -0
- programasweights-0.2.1/training/data_generation/templates_old/verify_user.txt +3 -0
- programasweights-0.2.1/training/data_generation/verify_test_data.py +377 -0
- programasweights-0.2.1/training/datasets/jsonl_text_pairs.py +186 -0
- programasweights-0.2.1/training/loops/prefix_tuning_sft.py +1297 -0
- programasweights-0.2.1/ttt.py +11 -0
- programasweights-0.2.1/upload_onnx_to_huggingface.py +242 -0
- programasweights-0.2.1/upload_onnx_to_huggingface_with_token.py +264 -0
- programasweights-0.2.1/utils.py +100 -0
- programasweights-0.2.1/web-app/HANDOFF.md +237 -0
- {programasweights-0.1.1 → programasweights-0.2.1}/web-app/README.md +14 -2
- programasweights-0.2.1/web-app/backend/app/config.py +71 -0
- programasweights-0.2.1/web-app/backend/app/main.py +1463 -0
- programasweights-0.2.1/web-app/backend/app/middleware/__init__.py +1 -0
- programasweights-0.2.1/web-app/backend/app/middleware/rate_limit.py +58 -0
- {programasweights-0.1.1 → programasweights-0.2.1}/web-app/backend/app/models.py +23 -4
- programasweights-0.2.1/web-app/backend/app/services/__init__.py +13 -0
- programasweights-0.2.1/web-app/backend/app/services/auth_service.py +172 -0
- programasweights-0.2.1/web-app/backend/app/services/case_service.py +201 -0
- programasweights-0.2.1/web-app/backend/app/services/compiler_service.py +202 -0
- programasweights-0.2.1/web-app/backend/app/services/gpt_service.py +166 -0
- programasweights-0.2.1/web-app/backend/app/services/hub_service.py +291 -0
- programasweights-0.2.1/web-app/backend/app/services/image_service.py +127 -0
- programasweights-0.2.1/web-app/backend/app/services/interpreter_service.py +179 -0
- programasweights-0.2.1/web-app/backend/app/services/sql_manager.py +1324 -0
- programasweights-0.2.1/web-app/backend/app/templates/gpt_test_generation.txt +42 -0
- programasweights-0.2.1/web-app/backend/app/utils/__init__.py +1 -0
- programasweights-0.2.1/web-app/backend/app/utils/image_placeholders.py +147 -0
- programasweights-0.2.1/web-app/backend/app/utils/program_hash.py +211 -0
- programasweights-0.2.1/web-app/backend/clear_db.sh +62 -0
- programasweights-0.2.1/web-app/backend/clear_tables.sql +29 -0
- {programasweights-0.1.1 → programasweights-0.2.1}/web-app/backend/data/programs.db +0 -0
- programasweights-0.2.1/web-app/backend/env_example.txt +24 -0
- programasweights-0.2.1/web-app/backend/example_images/README.md +140 -0
- programasweights-0.2.1/web-app/backend/get_data_examples.py +55 -0
- {programasweights-0.1.1 → programasweights-0.2.1}/web-app/backend/requirements.txt +3 -0
- programasweights-0.2.1/web-app/backend/setup_analytics_tables.sql +16 -0
- programasweights-0.2.1/web-app/backend/setup_auth_tables.sql +30 -0
- programasweights-0.2.1/web-app/backend/setup_cache_tables.sql +73 -0
- programasweights-0.2.1/web-app/backend/setup_cases_tables.sql +36 -0
- programasweights-0.2.1/web-app/backend/setup_database.sql +248 -0
- programasweights-0.2.1/web-app/backend/setup_database_simple.sql +113 -0
- programasweights-0.2.1/web-app/backend/setup_db.sh +52 -0
- programasweights-0.2.1/web-app/backend/setup_example_images.py +166 -0
- programasweights-0.2.1/web-app/backend/setup_hub_tables.sql +74 -0
- programasweights-0.2.1/web-app/backend/test_compilation_cache.py +85 -0
- programasweights-0.2.1/web-app/frontend/e2e/full.spec.ts +798 -0
- programasweights-0.2.1/web-app/frontend/e2e/helpers.ts +14 -0
- programasweights-0.2.1/web-app/frontend/e2e/smoke.spec.ts +117 -0
- programasweights-0.2.1/web-app/frontend/index.html +39 -0
- {programasweights-0.1.1 → programasweights-0.2.1}/web-app/frontend/package-lock.json +100 -0
- {programasweights-0.1.1 → programasweights-0.2.1}/web-app/frontend/package.json +6 -1
- programasweights-0.2.1/web-app/frontend/playwright.config.ts +17 -0
- programasweights-0.2.1/web-app/frontend/public/apple-touch-icon.png +0 -0
- programasweights-0.2.1/web-app/frontend/public/browser-worker.html +142 -0
- programasweights-0.2.1/web-app/frontend/public/favicon-16x16.png +0 -0
- programasweights-0.2.1/web-app/frontend/public/favicon-32x32.png +0 -0
- programasweights-0.2.1/web-app/frontend/public/paw-192.png +0 -0
- programasweights-0.2.1/web-app/frontend/public/paw-512.png +0 -0
- programasweights-0.2.1/web-app/frontend/public/paw.svg +34 -0
- programasweights-0.2.1/web-app/frontend/scripts/deploy.sh +43 -0
- programasweights-0.2.1/web-app/frontend/src/App.tsx +77 -0
- programasweights-0.2.1/web-app/frontend/src/components/AboutPage.tsx +208 -0
- programasweights-0.2.1/web-app/frontend/src/components/AgentsPage.tsx +223 -0
- programasweights-0.2.1/web-app/frontend/src/components/AuthorPage.tsx +123 -0
- programasweights-0.2.1/web-app/frontend/src/components/BrowserPage.tsx +564 -0
- programasweights-0.2.1/web-app/frontend/src/components/CasesSection.tsx +192 -0
- programasweights-0.2.1/web-app/frontend/src/components/CompileButtonWithConfig.tsx +115 -0
- programasweights-0.2.1/web-app/frontend/src/components/DocsPage.tsx +496 -0
- {programasweights-0.1.1 → programasweights-0.2.1}/web-app/frontend/src/components/ExamplesInput.tsx +2 -2
- programasweights-0.2.1/web-app/frontend/src/components/Footer.tsx +86 -0
- programasweights-0.2.1/web-app/frontend/src/components/Header.tsx +173 -0
- programasweights-0.2.1/web-app/frontend/src/components/HubPage.tsx +351 -0
- programasweights-0.2.1/web-app/frontend/src/components/HubProgramPage.tsx +417 -0
- programasweights-0.2.1/web-app/frontend/src/components/HubUploadPage.tsx +14 -0
- programasweights-0.2.1/web-app/frontend/src/components/LandingPage.tsx +544 -0
- programasweights-0.2.1/web-app/frontend/src/components/MainInterface.tsx +624 -0
- programasweights-0.2.1/web-app/frontend/src/components/NavigationHelper.tsx +334 -0
- programasweights-0.2.1/web-app/frontend/src/components/PrivacyPage.tsx +101 -0
- programasweights-0.2.1/web-app/frontend/src/components/ProfilePage.tsx +274 -0
- programasweights-0.2.1/web-app/frontend/src/components/SettingsPage.tsx +219 -0
- programasweights-0.2.1/web-app/frontend/src/components/SpecSuggestions.tsx +49 -0
- programasweights-0.2.1/web-app/frontend/src/components/TermsPage.tsx +101 -0
- {programasweights-0.1.1 → programasweights-0.2.1}/web-app/frontend/src/index.css +9 -4
- {programasweights-0.1.1 → programasweights-0.2.1}/web-app/frontend/src/main.tsx +4 -1
- programasweights-0.2.1/web-app/frontend/src/types/index.ts +204 -0
- programasweights-0.2.1/web-app/frontend/src/utils/api.ts +225 -0
- {programasweights-0.1.1 → programasweights-0.2.1}/web-app/frontend/tailwind.config.js +18 -1
- programasweights-0.2.1/web-app/frontend/test-results/.last-run.json +4 -0
- {programasweights-0.1.1 → programasweights-0.2.1}/web-app/frontend/vite.config.ts +3 -0
- programasweights-0.2.1/web-app/nginx-paw.conf +56 -0
- programasweights-0.2.1/web-app/nginx.conf +111 -0
- programasweights-0.2.1/web-app/setup_mysql.sh +145 -0
- programasweights-0.2.1/web-app/ttt.py +26 -0
- programasweights-0.2.1/web-sdk/.gitignore +3 -0
- programasweights-0.2.1/web-sdk/LICENSE +21 -0
- programasweights-0.2.1/web-sdk/README.md +117 -0
- programasweights-0.2.1/web-sdk/__tests__/e2e/browser.spec.ts +223 -0
- programasweights-0.2.1/web-sdk/__tests__/e2e/server.ts +69 -0
- programasweights-0.2.1/web-sdk/__tests__/e2e/start-server.ts +2 -0
- programasweights-0.2.1/web-sdk/__tests__/e2e/test-page.html +122 -0
- programasweights-0.2.1/web-sdk/__tests__/loader.test.ts +244 -0
- programasweights-0.2.1/web-sdk/__tests__/prompt.test.ts +45 -0
- programasweights-0.2.1/web-sdk/examples/basic.html +121 -0
- programasweights-0.2.1/web-sdk/package-lock.json +3093 -0
- programasweights-0.2.1/web-sdk/package.json +58 -0
- programasweights-0.2.1/web-sdk/playwright.config.ts +19 -0
- programasweights-0.2.1/web-sdk/serve.py +12 -0
- programasweights-0.2.1/web-sdk/src/index.ts +55 -0
- programasweights-0.2.1/web-sdk/src/loader.ts +96 -0
- programasweights-0.2.1/web-sdk/src/runtime.ts +146 -0
- programasweights-0.2.1/web-sdk/src/types.ts +35 -0
- programasweights-0.2.1/web-sdk/test-standalone.html +188 -0
- programasweights-0.2.1/web-sdk/tsconfig.json +22 -0
- programasweights-0.2.1/web-sdk/vitest.config.ts +12 -0
- programasweights-0.2.1/web-sdk/wllama/.git +1 -0
- programasweights-0.2.1/web-sdk/wllama/.github/workflows/build-hf-space.yml +41 -0
- programasweights-0.2.1/web-sdk/wllama/.github/workflows/ci.yml +80 -0
- programasweights-0.2.1/web-sdk/wllama/.github/workflows/generate-docs.yml +63 -0
- programasweights-0.2.1/web-sdk/wllama/.github/workflows/verify-generated-code.yml +37 -0
- programasweights-0.2.1/web-sdk/wllama/.gitignore +16 -0
- programasweights-0.2.1/web-sdk/wllama/.gitmodules +3 -0
- programasweights-0.2.1/web-sdk/wllama/.npmignore +9 -0
- programasweights-0.2.1/web-sdk/wllama/.prettierignore +35 -0
- programasweights-0.2.1/web-sdk/wllama/CMakeLists.txt +23 -0
- programasweights-0.2.1/web-sdk/wllama/LICENCE +21 -0
- programasweights-0.2.1/web-sdk/wllama/README.md +210 -0
- programasweights-0.2.1/web-sdk/wllama/README_banner.png +0 -0
- programasweights-0.2.1/web-sdk/wllama/assets/screenshot_0.png +0 -0
- programasweights-0.2.1/web-sdk/wllama/cpp/actions.hpp +949 -0
- programasweights-0.2.1/web-sdk/wllama/cpp/generate_glue_prototype.js +115 -0
- programasweights-0.2.1/web-sdk/wllama/cpp/glue.hpp +874 -0
- programasweights-0.2.1/web-sdk/wllama/cpp/helpers/wcommon.cpp +580 -0
- programasweights-0.2.1/web-sdk/wllama/cpp/helpers/wcommon.h +561 -0
- programasweights-0.2.1/web-sdk/wllama/cpp/helpers/wlog.cpp +392 -0
- programasweights-0.2.1/web-sdk/wllama/cpp/helpers/wlog.h +102 -0
- programasweights-0.2.1/web-sdk/wllama/cpp/helpers/wsampling.cpp +526 -0
- programasweights-0.2.1/web-sdk/wllama/cpp/helpers/wsampling.h +107 -0
- programasweights-0.2.1/web-sdk/wllama/cpp/test_glue.cpp +80 -0
- programasweights-0.2.1/web-sdk/wllama/cpp/wllama.cpp +194 -0
- programasweights-0.2.1/web-sdk/wllama/examples/basic/index.html +176 -0
- programasweights-0.2.1/web-sdk/wllama/examples/embeddings/index.html +107 -0
- programasweights-0.2.1/web-sdk/wllama/examples/main/.eslintrc.cjs +18 -0
- programasweights-0.2.1/web-sdk/wllama/examples/main/.gitignore +24 -0
- programasweights-0.2.1/web-sdk/wllama/examples/main/README.md +6 -0
- {programasweights-0.1.1/web-app/frontend → programasweights-0.2.1/web-sdk/wllama/examples/main}/index.html +2 -2
- programasweights-0.2.1/web-sdk/wllama/examples/main/package-lock.json +5800 -0
- programasweights-0.2.1/web-sdk/wllama/examples/main/package.json +40 -0
- programasweights-0.2.1/web-sdk/wllama/examples/main/postcss.config.js +6 -0
- programasweights-0.2.1/web-sdk/wllama/examples/main/public/favicon.ico +0 -0
- programasweights-0.2.1/web-sdk/wllama/examples/main/public/wllama.png +0 -0
- programasweights-0.2.1/web-sdk/wllama/examples/main/src/App.tsx +40 -0
- programasweights-0.2.1/web-sdk/wllama/examples/main/src/components/ChatScreen.tsx +196 -0
- programasweights-0.2.1/web-sdk/wllama/examples/main/src/components/GuideScreen.tsx +91 -0
- programasweights-0.2.1/web-sdk/wllama/examples/main/src/components/LogScreen.tsx +26 -0
- programasweights-0.2.1/web-sdk/wllama/examples/main/src/components/MarkdownMessage.tsx +58 -0
- programasweights-0.2.1/web-sdk/wllama/examples/main/src/components/ModelScreen.tsx +444 -0
- programasweights-0.2.1/web-sdk/wllama/examples/main/src/components/Navbar.tsx +27 -0
- programasweights-0.2.1/web-sdk/wllama/examples/main/src/components/ScreenWrapper.tsx +17 -0
- programasweights-0.2.1/web-sdk/wllama/examples/main/src/components/Sidebar.tsx +119 -0
- programasweights-0.2.1/web-sdk/wllama/examples/main/src/config.ts +96 -0
- programasweights-0.2.1/web-sdk/wllama/examples/main/src/index.css +56 -0
- programasweights-0.2.1/web-sdk/wllama/examples/main/src/main.tsx +11 -0
- programasweights-0.2.1/web-sdk/wllama/examples/main/src/utils/benchmark.ts +116 -0
- programasweights-0.2.1/web-sdk/wllama/examples/main/src/utils/custom-models.tsx +97 -0
- programasweights-0.2.1/web-sdk/wllama/examples/main/src/utils/displayed-model.tsx +90 -0
- programasweights-0.2.1/web-sdk/wllama/examples/main/src/utils/messages.context.tsx +120 -0
- programasweights-0.2.1/web-sdk/wllama/examples/main/src/utils/nl2br.tsx +10 -0
- programasweights-0.2.1/web-sdk/wllama/examples/main/src/utils/types.ts +38 -0
- programasweights-0.2.1/web-sdk/wllama/examples/main/src/utils/use-interval-when.ts +48 -0
- programasweights-0.2.1/web-sdk/wllama/examples/main/src/utils/utils.ts +133 -0
- programasweights-0.2.1/web-sdk/wllama/examples/main/src/utils/wllama.context.tsx +293 -0
- programasweights-0.2.1/web-sdk/wllama/examples/main/src/vite-env.d.ts +1 -0
- programasweights-0.2.1/web-sdk/wllama/examples/main/tailwind.config.cjs +8 -0
- programasweights-0.2.1/web-sdk/wllama/examples/main/tsconfig.app.json +27 -0
- programasweights-0.2.1/web-sdk/wllama/examples/main/tsconfig.json +11 -0
- programasweights-0.2.1/web-sdk/wllama/examples/main/tsconfig.node.json +13 -0
- programasweights-0.2.1/web-sdk/wllama/examples/main/vite.config.ts +20 -0
- programasweights-0.2.1/web-sdk/wllama/guides/intro-v2.md +132 -0
- programasweights-0.2.1/web-sdk/wllama/index.ts +1 -0
- programasweights-0.2.1/web-sdk/wllama/package-lock.json +7396 -0
- programasweights-0.2.1/web-sdk/wllama/package.json +68 -0
- programasweights-0.2.1/web-sdk/wllama/scripts/build_hf_space.sh +26 -0
- programasweights-0.2.1/web-sdk/wllama/scripts/build_wasm.sh +19 -0
- programasweights-0.2.1/web-sdk/wllama/scripts/build_worker.sh +39 -0
- programasweights-0.2.1/web-sdk/wllama/scripts/docker-compose.yml +53 -0
- programasweights-0.2.1/web-sdk/wllama/scripts/generate_wasm_from_cdn.js +20 -0
- programasweights-0.2.1/web-sdk/wllama/scripts/http_server.js +33 -0
- programasweights-0.2.1/web-sdk/wllama/scripts/post_build.sh +26 -0
- programasweights-0.2.1/web-sdk/wllama/src/cache-manager.ts +392 -0
- programasweights-0.2.1/web-sdk/wllama/src/glue/glue.ts +291 -0
- programasweights-0.2.1/web-sdk/wllama/src/glue/messages.ts +1346 -0
- programasweights-0.2.1/web-sdk/wllama/src/index.ts +4 -0
- programasweights-0.2.1/web-sdk/wllama/src/mjs.test.ts +48 -0
- programasweights-0.2.1/web-sdk/wllama/src/model-manager.test.ts +200 -0
- programasweights-0.2.1/web-sdk/wllama/src/model-manager.ts +324 -0
- programasweights-0.2.1/web-sdk/wllama/src/multi-thread/wllama.js +1 -0
- programasweights-0.2.1/web-sdk/wllama/src/multi-thread/wllama.wasm +0 -0
- programasweights-0.2.1/web-sdk/wllama/src/single-thread/wllama.js +1 -0
- programasweights-0.2.1/web-sdk/wllama/src/single-thread/wllama.wasm +0 -0
- programasweights-0.2.1/web-sdk/wllama/src/utils.test.ts +231 -0
- programasweights-0.2.1/web-sdk/wllama/src/utils.ts +271 -0
- programasweights-0.2.1/web-sdk/wllama/src/wasm-from-cdn.ts +9 -0
- programasweights-0.2.1/web-sdk/wllama/src/wllama.test.ts +402 -0
- programasweights-0.2.1/web-sdk/wllama/src/wllama.ts +1396 -0
- programasweights-0.2.1/web-sdk/wllama/src/worker.ts +298 -0
- programasweights-0.2.1/web-sdk/wllama/src/workers-code/generated.ts +13 -0
- programasweights-0.2.1/web-sdk/wllama/src/workers-code/llama-cpp.js +383 -0
- programasweights-0.2.1/web-sdk/wllama/src/workers-code/opfs-utils.js +141 -0
- programasweights-0.2.1/web-sdk/wllama/tsconfig.build.json +34 -0
- programasweights-0.2.1/web-sdk/wllama/tsup.config.ts +23 -0
- programasweights-0.2.1/web-sdk/wllama/vitest.config.ts +44 -0
- programasweights-0.1.1/.gitignore +0 -34
- programasweights-0.1.1/.readthedocs.yaml +0 -13
- programasweights-0.1.1/PKG-INFO +0 -88
- programasweights-0.1.1/PYPI_README.md +0 -53
- programasweights-0.1.1/docs/Makefile +0 -20
- programasweights-0.1.1/docs/api-reference.rst +0 -194
- programasweights-0.1.1/docs/conf.py +0 -27
- programasweights-0.1.1/docs/index.rst +0 -84
- programasweights-0.1.1/docs/installation.rst +0 -95
- programasweights-0.1.1/docs/quickstart.rst +0 -165
- programasweights-0.1.1/docs/requirements.txt +0 -3
- programasweights-0.1.1/docs/using-pretrained.rst +0 -223
- programasweights-0.1.1/eval.py +0 -142
- programasweights-0.1.1/outputs_1spec/prefix_kv/LATEST +0 -1
- programasweights-0.1.1/outputs_1spec/prefix_kv/eval_program/kv_prefix.pt +0 -0
- programasweights-0.1.1/outputs_1spec/prefix_kv/eval_program/program.json +0 -5
- programasweights-0.1.1/programasweights/__init__.py +0 -6
- programasweights-0.1.1/programasweights/compiler/__init__.py +0 -67
- programasweights-0.1.1/programasweights/runtime/__init__.py +0 -1
- programasweights-0.1.1/programasweights/runtime/interpreter.py +0 -181
- programasweights-0.1.1/test_api.py +0 -53
- programasweights-0.1.1/tests/test_programasweights.py +0 -239
- programasweights-0.1.1/training/data_generation/generate_specs.py +0 -460
- programasweights-0.1.1/training/datasets/jsonl_text_pairs.py +0 -29
- programasweights-0.1.1/training/loops/prefix_tuning_sft.py +0 -580
- programasweights-0.1.1/web-app/backend/app/config.py +0 -59
- programasweights-0.1.1/web-app/backend/app/main.py +0 -344
- programasweights-0.1.1/web-app/backend/app/services/__init__.py +0 -1
- programasweights-0.1.1/web-app/backend/app/services/compiler_service.py +0 -137
- programasweights-0.1.1/web-app/backend/app/services/gpt_service.py +0 -129
- programasweights-0.1.1/web-app/backend/app/services/interpreter_service.py +0 -133
- programasweights-0.1.1/web-app/backend/app/services/program_service.py +0 -268
- programasweights-0.1.1/web-app/backend/env_example.txt +0 -11
- programasweights-0.1.1/web-app/frontend/src/App.tsx +0 -39
- programasweights-0.1.1/web-app/frontend/src/components/AboutPage.tsx +0 -203
- programasweights-0.1.1/web-app/frontend/src/components/Header.tsx +0 -64
- programasweights-0.1.1/web-app/frontend/src/components/LeaderboardPage.tsx +0 -354
- programasweights-0.1.1/web-app/frontend/src/components/MainInterface.tsx +0 -251
- programasweights-0.1.1/web-app/frontend/src/components/ProgramDetailPage.tsx +0 -449
- programasweights-0.1.1/web-app/frontend/src/components/PublishProgramPage.tsx +0 -495
- programasweights-0.1.1/web-app/frontend/src/components/SpecInput.tsx +0 -41
- programasweights-0.1.1/web-app/frontend/src/types/index.ts +0 -113
- programasweights-0.1.1/web-app/frontend/src/utils/api.ts +0 -87
- {programasweights-0.1.1 → programasweights-0.2.1}/programasweights/artifacts.py +0 -0
- {programasweights-0.1.1 → programasweights-0.2.1}/test_compile.py +0 -0
- {programasweights-0.1.1 → programasweights-0.2.1}/test_execute.py +0 -0
- {programasweights-0.1.1 → programasweights-0.2.1}/training/README.md +0 -0
- {programasweights-0.1.1 → programasweights-0.2.1}/training/__init__.py +0 -0
- {programasweights-0.1.1 → programasweights-0.2.1}/training/data_generation/README.md +0 -0
- {programasweights-0.1.1/training/data_generation/templates → programasweights-0.2.1/training/data_generation/templates_old}/pairs_system.txt +0 -0
- {programasweights-0.1.1/training/data_generation/templates → programasweights-0.2.1/training/data_generation/templates_old}/pairs_user.txt +0 -0
- {programasweights-0.1.1/training/data_generation/templates → programasweights-0.2.1/training/data_generation/templates_old}/specs_system.txt +0 -0
- {programasweights-0.1.1 → programasweights-0.2.1}/training/datasets/__init__.py +0 -0
- {programasweights-0.1.1 → programasweights-0.2.1}/training/loops/__init__.py +0 -0
- {programasweights-0.1.1 → programasweights-0.2.1}/upload_model.py +0 -0
- {programasweights-0.1.1 → programasweights-0.2.1}/web-app/backend/app/__init__.py +0 -0
- {programasweights-0.1.1 → programasweights-0.2.1}/web-app/backend/run_server.py +0 -0
- {programasweights-0.1.1 → programasweights-0.2.1}/web-app/frontend/README.md +0 -0
- {programasweights-0.1.1 → programasweights-0.2.1}/web-app/frontend/eslint.config.js +0 -0
- {programasweights-0.1.1 → programasweights-0.2.1}/web-app/frontend/postcss.config.js +0 -0
- {programasweights-0.1.1 → programasweights-0.2.1}/web-app/frontend/public/react-test.html +0 -0
- {programasweights-0.1.1 → programasweights-0.2.1}/web-app/frontend/public/test.html +0 -0
- {programasweights-0.1.1 → programasweights-0.2.1}/web-app/frontend/public/vite.svg +0 -0
- {programasweights-0.1.1 → programasweights-0.2.1}/web-app/frontend/src/App.css +0 -0
- {programasweights-0.1.1 → programasweights-0.2.1}/web-app/frontend/src/assets/react.svg +0 -0
- {programasweights-0.1.1 → programasweights-0.2.1}/web-app/frontend/src/components/CompileSection.tsx +0 -0
- {programasweights-0.1.1 → programasweights-0.2.1}/web-app/frontend/src/components/ModelSelector.tsx +0 -0
- {programasweights-0.1.1 → programasweights-0.2.1}/web-app/frontend/src/components/TestSection.tsx +0 -0
- {programasweights-0.1.1 → programasweights-0.2.1}/web-app/frontend/tsconfig.app.json +0 -0
- {programasweights-0.1.1 → programasweights-0.2.1}/web-app/frontend/tsconfig.json +0 -0
- {programasweights-0.1.1 → programasweights-0.2.1}/web-app/frontend/tsconfig.node.json +0 -0
- {programasweights-0.1.1 → programasweights-0.2.1}/web-app/start.sh +0 -0
- {programasweights-0.1.1 → programasweights-0.2.1}/web-app/test_setup.py +0 -0
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: vLLM deployment rules and known issues for PAW servers
|
|
3
|
+
alwaysApply: true
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# vLLM Deployment Rules
|
|
7
|
+
|
|
8
|
+
## Server: 31.22.104.226 (4x RTX PRO 6000 Blackwell, 98 GB each)
|
|
9
|
+
|
|
10
|
+
### Code Location
|
|
11
|
+
|
|
12
|
+
All server code lives at `/root/paw-website/` (git clone of `programasweights/website`).
|
|
13
|
+
|
|
14
|
+
**Deployment (the ONLY way to update code):**
|
|
15
|
+
```bash
|
|
16
|
+
# Local: push changes
|
|
17
|
+
git push origin main
|
|
18
|
+
|
|
19
|
+
# Server: pull and restart
|
|
20
|
+
cd /root/paw-website && git pull
|
|
21
|
+
cd server && bash scripts/start_all.sh
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
**NEVER use rsync or scp for code.** Model weights use scp between servers.
|
|
25
|
+
|
|
26
|
+
### GPU Layout
|
|
27
|
+
|
|
28
|
+
| GPU | Service | Port | VRAM |
|
|
29
|
+
|-----|---------|------|------|
|
|
30
|
+
| 0 | Pseudo-gen (Qwen3-4B) | 8001 | 90% |
|
|
31
|
+
| 1 | Qwen3 compiler pooling (4B) | 8002 | 85% |
|
|
32
|
+
| 2 | GPT-2 compiler pooling (4B) | 8012 | 85% |
|
|
33
|
+
| 3 | Qwen3 inference (0.6B) + GPT-2 inference (124M) | 8003 + 8013 | 50% + 40% |
|
|
34
|
+
|
|
35
|
+
GPU 3 services must start sequentially: GPT-2 first (smaller, faster), then Qwen3 after GPT-2 claims its VRAM.
|
|
36
|
+
|
|
37
|
+
### Services
|
|
38
|
+
|
|
39
|
+
| Service | Port | Working Dir |
|
|
40
|
+
|---------|------|-------------|
|
|
41
|
+
| vLLM pseudo-gen | 8001 | - |
|
|
42
|
+
| vLLM Qwen3 compiler | 8002 | /root/paw-website/server |
|
|
43
|
+
| vLLM GPT-2 compiler | 8012 | /root/paw-website/server |
|
|
44
|
+
| vLLM Qwen3 inference | 8003 | - |
|
|
45
|
+
| vLLM GPT-2 inference | 8013 | - |
|
|
46
|
+
| Qwen3 CompileProvider | 9000 | /root/paw-website/server |
|
|
47
|
+
| GPT-2 CompileProvider | 9001 | /root/paw-website/server |
|
|
48
|
+
| API gateway | 8000 | /root/paw-website/server |
|
|
49
|
+
|
|
50
|
+
### Startup
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
cd /root/paw-website/server
|
|
54
|
+
bash scripts/start_all.sh # starts everything, waits for models to load
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Or for full redeploy (git pull + patch + start):
|
|
58
|
+
```bash
|
|
59
|
+
cd /root/paw-website
|
|
60
|
+
bash server/scripts/restart.sh
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Key Files
|
|
64
|
+
|
|
65
|
+
- `.env`: `/root/paw-website/server/.env` (secrets, NOT in git)
|
|
66
|
+
- Provider configs: `server/provider_configs/qwen3-0.6b.json`, `server/provider_configs/gpt2.json`
|
|
67
|
+
- Compiler registry: `server/compiler_registry.json`
|
|
68
|
+
- vLLM launchers: `server/scripts/launch_qwen3_compiler.py`, `server/scripts/launch_gpt2_compiler.py`
|
|
69
|
+
- Patch script: `server/scripts/patch_vllm.sh` (run after every pip install vllm)
|
|
70
|
+
|
|
71
|
+
## Critical Environment Variables
|
|
72
|
+
|
|
73
|
+
### VLLM_ALLOW_RUNTIME_LORA_UPDATING=1
|
|
74
|
+
MUST be set for inference servers with --enable-lora.
|
|
75
|
+
|
|
76
|
+
### VLLM_TORCH_COMPILE_LEVEL=0
|
|
77
|
+
Set on servers without full CUDA dev toolchain.
|
|
78
|
+
|
|
79
|
+
## vLLM Compiler Pooling (PawCompilerForPooling)
|
|
80
|
+
|
|
81
|
+
- Must use `--enforce-eager` flag
|
|
82
|
+
- Must use `--runner pooling` flag
|
|
83
|
+
- Must run `scripts/patch_vllm.sh` after every vLLM install
|
|
84
|
+
- Endpoint: `POST /v1/embeddings`
|
|
85
|
+
- Launcher scripts use `if __name__ == '__main__'` guard for multiprocessing
|
|
86
|
+
|
|
87
|
+
## Post-Install Patch
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
cd /root/paw-website/server && bash scripts/patch_vllm.sh /root/paw-venv
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## GPT-2 Specifics
|
|
94
|
+
|
|
95
|
+
- Interpreter uses NO chat template (use_chat_template: false)
|
|
96
|
+
- Compiler port: 8012 (NOT 8002 which is Qwen3)
|
|
97
|
+
- Inference port: 8013 (NOT 8003 which is Qwen3)
|
|
98
|
+
|
|
99
|
+
## Testing
|
|
100
|
+
|
|
101
|
+
Full benchmark: 12 specs, 36 examples, expected 30/36 (83.3%) for Qwen3
|
|
102
|
+
```bash
|
|
103
|
+
cd /root/paw-website/server
|
|
104
|
+
python benchmarks/benchmark_api.py --server https://programasweights.com
|
|
105
|
+
python benchmarks/stress_test.py --server https://programasweights.com --scenario all
|
|
106
|
+
```
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
gitdir: ../.git/modules/programasweights
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
name: Web SDK CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
paths: ['web-sdk/**']
|
|
6
|
+
pull_request:
|
|
7
|
+
paths: ['web-sdk/**']
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
lint-and-test:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
defaults:
|
|
13
|
+
run:
|
|
14
|
+
working-directory: web-sdk
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v4
|
|
17
|
+
with:
|
|
18
|
+
submodules: recursive
|
|
19
|
+
- uses: actions/setup-node@v4
|
|
20
|
+
with:
|
|
21
|
+
node-version: 20
|
|
22
|
+
cache: npm
|
|
23
|
+
cache-dependency-path: web-sdk/package-lock.json
|
|
24
|
+
- run: npm ci
|
|
25
|
+
- run: npm run typecheck
|
|
26
|
+
- run: npm test
|
|
27
|
+
- run: npm run build
|
|
28
|
+
|
|
29
|
+
publish:
|
|
30
|
+
if: startsWith(github.ref, 'refs/tags/web-sdk-v')
|
|
31
|
+
needs: [lint-and-test]
|
|
32
|
+
runs-on: ubuntu-latest
|
|
33
|
+
defaults:
|
|
34
|
+
run:
|
|
35
|
+
working-directory: web-sdk
|
|
36
|
+
permissions:
|
|
37
|
+
contents: read
|
|
38
|
+
id-token: write
|
|
39
|
+
steps:
|
|
40
|
+
- uses: actions/checkout@v4
|
|
41
|
+
with:
|
|
42
|
+
submodules: recursive
|
|
43
|
+
- uses: actions/setup-node@v4
|
|
44
|
+
with:
|
|
45
|
+
node-version: 20
|
|
46
|
+
registry-url: https://registry.npmjs.org
|
|
47
|
+
- run: npm ci
|
|
48
|
+
- run: npm run build
|
|
49
|
+
- run: npm publish --access public --provenance
|
|
50
|
+
env:
|
|
51
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# Dependencies
|
|
2
|
+
node_modules/
|
|
3
|
+
npm-debug.log*
|
|
4
|
+
yarn-debug.log*
|
|
5
|
+
yarn-error.log*
|
|
6
|
+
|
|
7
|
+
# Build outputs
|
|
8
|
+
dist/
|
|
9
|
+
build/
|
|
10
|
+
|
|
11
|
+
# Cache directories
|
|
12
|
+
.vite/
|
|
13
|
+
.cache/
|
|
14
|
+
|
|
15
|
+
# Python
|
|
16
|
+
__pycache__/
|
|
17
|
+
*.pyc
|
|
18
|
+
*.pyo
|
|
19
|
+
.venv
|
|
20
|
+
.env
|
|
21
|
+
|
|
22
|
+
# System files
|
|
23
|
+
.DS_Store
|
|
24
|
+
Thumbs.db
|
|
25
|
+
|
|
26
|
+
# IDE
|
|
27
|
+
.vscode/
|
|
28
|
+
.idea/
|
|
29
|
+
*.swp
|
|
30
|
+
*.swo
|
|
31
|
+
*.swm
|
|
32
|
+
*.swn
|
|
33
|
+
|
|
34
|
+
# Compiled models and temp files
|
|
35
|
+
web-app/backend/compiled_models/
|
|
36
|
+
web-app/backend/temp/
|
|
37
|
+
web-app/backend/uploads/
|
|
38
|
+
outputs/
|
|
39
|
+
outputs_onnx/
|
|
40
|
+
|
|
41
|
+
# SQLite caches
|
|
42
|
+
cache.sqlite3
|
|
43
|
+
verify_cache.sqlite3
|
|
44
|
+
filter_cache.sqlite3
|
|
45
|
+
|
|
46
|
+
# Training data (large generated files)
|
|
47
|
+
data/batch_gpt52*/
|
|
48
|
+
data/merged_gpt52*/
|
|
49
|
+
data/regen_fuzzy_bench/
|
|
50
|
+
data/dry_run_gpt52/
|
|
51
|
+
data/pilot_test/
|
|
52
|
+
data/vqa_images/
|
|
53
|
+
data/ocr_data/
|
|
54
|
+
*.jsonl
|
|
55
|
+
|
|
56
|
+
# ONNX models
|
|
57
|
+
*.onnx
|
|
58
|
+
*.onnx_data
|
|
59
|
+
|
|
60
|
+
# Compiled neural programs
|
|
61
|
+
*.paw
|
|
62
|
+
|
|
63
|
+
# Log files
|
|
64
|
+
*.log
|
|
65
|
+
|
|
66
|
+
# Handwriting/OCR data
|
|
67
|
+
*.inkml
|
|
68
|
+
|
|
69
|
+
# Private config
|
|
70
|
+
init_private.sh
|
|
71
|
+
|
|
72
|
+
# Playground scratch space
|
|
73
|
+
playground/
|
|
74
|
+
|
|
75
|
+
# Large inspection logs (generated on server)
|
|
76
|
+
inspect_*.txt
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
[targets.sdist]
|
|
2
|
+
# Explicitly include only the source package folder
|
|
3
|
+
include = ["programasweights"]
|
|
4
|
+
|
|
5
|
+
# Exclude large or non-source folders
|
|
6
|
+
exclude = [
|
|
7
|
+
"outputs",
|
|
8
|
+
"outputs_1spec",
|
|
9
|
+
"outputs_1spec_bak",
|
|
10
|
+
"demo_weights.safetensors",
|
|
11
|
+
"dist",
|
|
12
|
+
"training",
|
|
13
|
+
"web-app",
|
|
14
|
+
"tests",
|
|
15
|
+
"data",
|
|
16
|
+
"__pycache__",
|
|
17
|
+
"*.egg-info",
|
|
18
|
+
"*.pt",
|
|
19
|
+
"*.safetensors",
|
|
20
|
+
"*.sqlite3",
|
|
21
|
+
"eval.py",
|
|
22
|
+
"train.py",
|
|
23
|
+
"upload_model.py",
|
|
24
|
+
"test_*.py",
|
|
25
|
+
".git",
|
|
26
|
+
".gitignore",
|
|
27
|
+
".DS_Store"
|
|
28
|
+
]
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
# ProgramAsWeights (PAW)
|
|
2
|
+
|
|
3
|
+
PAW compiles natural language specifications into tiny neural functions that run locally. Use it when you need fuzzy text processing — classification, extraction, format repair, search, triage — that regex can't handle but a full LLM is overkill for.
|
|
4
|
+
|
|
5
|
+
Website: https://programasweights.com
|
|
6
|
+
Docs: https://programasweights.readthedocs.io
|
|
7
|
+
|
|
8
|
+
## Install
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
pip install programasweights --extra-index-url https://pypi.programasweights.com/simple/
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Usage
|
|
15
|
+
|
|
16
|
+
```python
|
|
17
|
+
import programasweights as paw
|
|
18
|
+
|
|
19
|
+
# Use a pre-compiled function (downloads once, runs locally forever)
|
|
20
|
+
fn = paw.function("email-triage")
|
|
21
|
+
fn("Urgent: server is down!") # "immediate"
|
|
22
|
+
fn("Newsletter: spring picnic") # "wait"
|
|
23
|
+
|
|
24
|
+
# Compile your own from a description
|
|
25
|
+
program = paw.compile(
|
|
26
|
+
"Fix malformed JSON: repair missing quotes and trailing commas",
|
|
27
|
+
compiler="paw-4b-qwen3-0.6b" # or "paw-4b-gpt2" for smaller/faster
|
|
28
|
+
)
|
|
29
|
+
fn = paw.function(program.id)
|
|
30
|
+
fn("{name: 'Alice',}") # '{"name": "Alice"}'
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Two Compilers
|
|
34
|
+
|
|
35
|
+
| | Standard (Qwen3 0.6B) | Compact (GPT-2 124M) |
|
|
36
|
+
|---|---|---|
|
|
37
|
+
| Compiler name | `paw-4b-qwen3-0.6b` | `paw-4b-gpt2` |
|
|
38
|
+
| Accuracy | Higher | Lower |
|
|
39
|
+
| Base model size | 594 MB | 105 MB |
|
|
40
|
+
| Program size | ~22 MB | ~5 MB |
|
|
41
|
+
| Inference speed | ~90ms (server) | ~50ms (server) |
|
|
42
|
+
| Runs in browser | No | Yes |
|
|
43
|
+
|
|
44
|
+
Default is Standard (Qwen3 0.6B). Use Compact (GPT-2) when you need smaller files or browser deployment.
|
|
45
|
+
|
|
46
|
+
## Browser / JavaScript SDK
|
|
47
|
+
|
|
48
|
+
Programs compiled with GPT-2 also run entirely in the browser via WebAssembly — no server needed. Users' data never leaves their device.
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
npm install @programasweights/web
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
```javascript
|
|
55
|
+
import paw from '@programasweights/web';
|
|
56
|
+
|
|
57
|
+
const fn = await paw.function('programasweights/email-triage');
|
|
58
|
+
const result = await fn('Urgent: server is down!');
|
|
59
|
+
// result: "immediate"
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Use this when you want to offload all computation to the user's browser: zero server costs, zero API keys, full data privacy. The 105 MB base model downloads once and is cached.
|
|
63
|
+
|
|
64
|
+
## When to Use PAW
|
|
65
|
+
|
|
66
|
+
- **Fuzzy search** — typo-tolerant matching, semantic search, near-duplicate detection
|
|
67
|
+
- **Format repair** — fix broken JSON, normalize dates, repair malformed inputs
|
|
68
|
+
- **Classification** — sentiment, urgency, categories defined in your own words
|
|
69
|
+
- **Extraction** — emails, names, dates from messy unstructured text
|
|
70
|
+
- **Log triage** — extract errors from verbose output, filter noise
|
|
71
|
+
- **Intent routing** — map user descriptions to the closest URL, menu item, or setting
|
|
72
|
+
- **Agent preprocessing** — parse tool calls, validate outputs, route tasks
|
|
73
|
+
|
|
74
|
+
## Authentication (optional)
|
|
75
|
+
|
|
76
|
+
Everything works without authentication. Sign in for higher rate limits and program naming.
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
export PAW_API_KEY=paw_sk_...
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Generate API keys at https://programasweights.com/settings. The SDK reads `PAW_API_KEY` from the environment automatically.
|
|
83
|
+
|
|
84
|
+
| | Anonymous | Authenticated |
|
|
85
|
+
|---|---|---|
|
|
86
|
+
| Compile rate limit | 20/hr | 60/hr |
|
|
87
|
+
| Name programs (slugs) | No | Yes |
|
|
88
|
+
|
|
89
|
+
## Program Naming
|
|
90
|
+
|
|
91
|
+
Every compiled program gets an immutable hash ID (e.g. `a6b454023d41ac9ca845`). Authenticated users can also assign a human-readable slug:
|
|
92
|
+
|
|
93
|
+
```python
|
|
94
|
+
program = paw.compile("Classify sentiment", slug="my-classifier")
|
|
95
|
+
# program.id -> "a6b454023d41ac9ca845"
|
|
96
|
+
# program.slug -> "da03/my-classifier"
|
|
97
|
+
|
|
98
|
+
fn = paw.function("da03/my-classifier") # by slug (requires auth to create)
|
|
99
|
+
fn = paw.function("a6b454023d41ac9ca845") # by hash (always works)
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## CLI
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
paw compile --spec "Classify sentiment" --json
|
|
106
|
+
paw run --program <program_id> --input "I love this!" --json
|
|
107
|
+
paw info <program_id> # show program metadata
|
|
108
|
+
paw rename <program_id> my-slug # name a program (requires auth)
|
|
109
|
+
paw login # save API key
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
`--json` gives structured output for programmatic use.
|
|
113
|
+
|
|
114
|
+
## API
|
|
115
|
+
|
|
116
|
+
```python
|
|
117
|
+
paw.compile(spec) # compile (returns Program with .id)
|
|
118
|
+
paw.function(program_id_or_slug) # load for local inference
|
|
119
|
+
paw.login() # save API key
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## Browse Programs
|
|
123
|
+
|
|
124
|
+
https://programasweights.com/hub
|
|
125
|
+
|
|
126
|
+
## Add PAW to Your Project
|
|
127
|
+
|
|
128
|
+
Copy this file into your project as AGENTS.md:
|
|
129
|
+
https://programasweights.com/agents
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.2.0 (2026-04-01)
|
|
4
|
+
|
|
5
|
+
First public release.
|
|
6
|
+
|
|
7
|
+
- Compile natural language specs into neural programs via `paw.compile()`
|
|
8
|
+
- Load and run programs locally via `paw.function()` (llama.cpp backend)
|
|
9
|
+
- HuggingFace-style slug naming: `paw.function("da03/my-classifier")`
|
|
10
|
+
- Offline support: slug cache + program cache, no internet after first use
|
|
11
|
+
- CLI: `paw compile`, `paw run`, `paw info`, `paw rename`, `paw login`
|
|
12
|
+
- Pre-built wheels via pypi.programasweights.com for fast install
|
|
13
|
+
- Privacy enforcement: private programs only accessible by owner
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
# ProgramAsWeights Data Flow Summary
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
This document explains how prefix tokens flow through training, compilation, and inference.
|
|
6
|
+
|
|
7
|
+
## Three Stages
|
|
8
|
+
|
|
9
|
+
### 1. Training (`train.py` → `training/loops/prefix_tuning_sft.py`)
|
|
10
|
+
|
|
11
|
+
**Purpose**: Learn to map specs to KV caches via prefix tokens
|
|
12
|
+
|
|
13
|
+
```python
|
|
14
|
+
# Stage: TRAINING
|
|
15
|
+
spec = "Parse (A) (B) (C) into JSON list"
|
|
16
|
+
input = "(A) cat (B) dog"
|
|
17
|
+
output = '["cat", "dog"]'
|
|
18
|
+
|
|
19
|
+
# Flow:
|
|
20
|
+
1. Add prefix tokens to spec:
|
|
21
|
+
spec_tokens = tokenize(spec) # [tok1, tok2, ..., tokN]
|
|
22
|
+
spec_with_prefix = spec_tokens + [<PREFIX_0>, <PREFIX_1>, ..., <PREFIX_4>]
|
|
23
|
+
|
|
24
|
+
2. Run through compiler:
|
|
25
|
+
hidden = compiler(spec_with_prefix) # [batch, seq_len, hidden_dim]
|
|
26
|
+
|
|
27
|
+
3. Extract prefix token hidden states:
|
|
28
|
+
prefix_hiddens = hidden[:, -5:, :] # Last 5 positions
|
|
29
|
+
|
|
30
|
+
4. Map to KV cache:
|
|
31
|
+
kv_cache = mapper(prefix_hiddens) # [batch, layers, 2, heads, prefix_steps, head_dim]
|
|
32
|
+
|
|
33
|
+
5. Use KV cache in interpreter:
|
|
34
|
+
logits = interpreter(input_tokens, past_key_values=kv_cache)
|
|
35
|
+
|
|
36
|
+
6. Compute loss against output:
|
|
37
|
+
loss = cross_entropy(logits, output_tokens)
|
|
38
|
+
|
|
39
|
+
7. Backprop through entire chain:
|
|
40
|
+
loss.backward() # Updates: compiler embeddings, mapper, (optionally) models
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
**Saves**:
|
|
44
|
+
- `checkpoint/compiler/` - Compiler model with prefix token embeddings
|
|
45
|
+
- `checkpoint/interpreter/` - Interpreter model
|
|
46
|
+
- `checkpoint/compiler/mapper.pt` - Mapper weights + metadata
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
### 2. Compilation (`eval.py` or `paw.compile()`)
|
|
51
|
+
|
|
52
|
+
**Purpose**: Convert a new spec into a standalone `.paw` file
|
|
53
|
+
|
|
54
|
+
```python
|
|
55
|
+
# Stage: COMPILATION
|
|
56
|
+
spec = "Extract numbers from text" # New, unseen spec
|
|
57
|
+
|
|
58
|
+
# Flow:
|
|
59
|
+
1. Load trained model:
|
|
60
|
+
model = JointCompilerInterpreter(
|
|
61
|
+
compiler_model_name="checkpoint/compiler", # Has prefix tokens!
|
|
62
|
+
interpreter_model_name="checkpoint/interpreter",
|
|
63
|
+
prefix_steps=5
|
|
64
|
+
)
|
|
65
|
+
# Note: Tokenizer loaded from checkpoint already has prefix tokens
|
|
66
|
+
|
|
67
|
+
2. Add prefix tokens to new spec:
|
|
68
|
+
spec_tokens = tokenize(spec)
|
|
69
|
+
spec_with_prefix = spec_tokens + model.prefix_token_ids
|
|
70
|
+
|
|
71
|
+
3. Run through trained compiler:
|
|
72
|
+
hidden = model.compiler(spec_with_prefix)
|
|
73
|
+
|
|
74
|
+
4. Extract prefix token hidden states:
|
|
75
|
+
prefix_hiddens = hidden[:, -5:, :]
|
|
76
|
+
|
|
77
|
+
5. Map to KV cache using trained mapper:
|
|
78
|
+
kv_cache = model.mapper(prefix_hiddens)
|
|
79
|
+
|
|
80
|
+
6. Save KV cache to .paw file:
|
|
81
|
+
save_paw_program(
|
|
82
|
+
filepath="program.paw",
|
|
83
|
+
kv_layers=kv_cache,
|
|
84
|
+
spec=spec, # For reference only
|
|
85
|
+
base_model="interpreter_model_name",
|
|
86
|
+
prefix_steps=5
|
|
87
|
+
)
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
**Saves**:
|
|
91
|
+
- `program.paw` - Contains only the KV cache (not the spec with prefix tokens!)
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
### 3. Inference (`paw.function()`)
|
|
96
|
+
|
|
97
|
+
**Purpose**: Run a compiled program on new inputs
|
|
98
|
+
|
|
99
|
+
```python
|
|
100
|
+
# Stage: INFERENCE
|
|
101
|
+
f = paw.function("program.paw")
|
|
102
|
+
output = f("Extract from: 123 and 456")
|
|
103
|
+
|
|
104
|
+
# Flow:
|
|
105
|
+
1. Load .paw file:
|
|
106
|
+
kv_cache = load_paw_program("program.paw")
|
|
107
|
+
# kv_cache = precomputed KV prefix from compilation
|
|
108
|
+
# NO spec, NO prefix tokens - just the cache!
|
|
109
|
+
|
|
110
|
+
2. Tokenize input and add separator:
|
|
111
|
+
input_tokens = tokenize(input) + [<BOS>] # Separator for generation
|
|
112
|
+
|
|
113
|
+
3. Run through interpreter with KV cache:
|
|
114
|
+
logits = interpreter(input_tokens, past_key_values=kv_cache)
|
|
115
|
+
|
|
116
|
+
4. Generate output:
|
|
117
|
+
output_tokens = generate(logits, max_new_tokens=128)
|
|
118
|
+
output = detokenize(output_tokens)
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
**No compilation needed** - the KV cache is already computed and saved!
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
## Key Points
|
|
126
|
+
|
|
127
|
+
### Prefix Tokens:
|
|
128
|
+
- ✅ **Training**: Added to every spec, embeddings learned
|
|
129
|
+
- ✅ **Compilation**: Added to new spec, uses learned embeddings
|
|
130
|
+
- ❌ **Inference**: NOT used - we use precomputed KV cache
|
|
131
|
+
|
|
132
|
+
### What Gets Saved:
|
|
133
|
+
- **Training checkpoint**: Compiler (with prefix tokens) + Interpreter + Mapper
|
|
134
|
+
- **.paw file**: Only KV cache (no spec, no prefix tokens)
|
|
135
|
+
|
|
136
|
+
### Why This Works:
|
|
137
|
+
```
|
|
138
|
+
Training: spec + prefix_tokens → compiler → hidden → mapper → KV cache
|
|
139
|
+
↓
|
|
140
|
+
Compilation: new_spec + prefix_tokens → trained_compiler → hidden → trained_mapper → KV cache → save to .paw
|
|
141
|
+
↓
|
|
142
|
+
Inference: input → interpreter(past_kv=loaded_from_.paw) → output
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
The prefix tokens are a **compilation-time mechanism** to create good KV caches. Once compiled, the KV cache is all you need!
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
## Checkpoint Loading
|
|
150
|
+
|
|
151
|
+
When loading from checkpoint during compilation:
|
|
152
|
+
|
|
153
|
+
```python
|
|
154
|
+
# 1. Create model (loads tokenizer from checkpoint directory)
|
|
155
|
+
model = JointCompilerInterpreter(
|
|
156
|
+
compiler_model_name="checkpoint/compiler", # Directory path
|
|
157
|
+
...
|
|
158
|
+
)
|
|
159
|
+
|
|
160
|
+
# 2. Tokenizer already has prefix tokens (saved during training)
|
|
161
|
+
# 3. Model detects this and skips adding them again:
|
|
162
|
+
if tokens_already_exist:
|
|
163
|
+
print("Prefix tokens already exist in tokenizer (loaded from checkpoint)")
|
|
164
|
+
num_added = 0
|
|
165
|
+
else:
|
|
166
|
+
# Only happens during initial training
|
|
167
|
+
num_added = tokenizer.add_special_tokens(...)
|
|
168
|
+
compiler.resize_token_embeddings(len(tokenizer))
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
## Summary Table
|
|
174
|
+
|
|
175
|
+
| Stage | Uses Prefix Tokens? | Uses Compiler? | Uses Interpreter? | Input | Output |
|
|
176
|
+
|-------------|---------------------|----------------|-------------------|----------------------|---------------------|
|
|
177
|
+
| Training | ✅ Yes | ✅ Yes | ✅ Yes | spec, input, output | Updated models |
|
|
178
|
+
| Compilation | ✅ Yes | ✅ Yes | ❌ No | spec | .paw file (KV cache)|
|
|
179
|
+
| Inference | ❌ No | ❌ No | ✅ Yes | input | output |
|
|
180
|
+
|
|
181
|
+
---
|
|
182
|
+
|
|
183
|
+
## Example End-to-End
|
|
184
|
+
|
|
185
|
+
```python
|
|
186
|
+
# 1. TRAINING (once)
|
|
187
|
+
python train.py --train-jsonl data/samples_train.jsonl
|
|
188
|
+
# → Creates checkpoint/ with compiler+interpreter+mapper
|
|
189
|
+
|
|
190
|
+
# 2. COMPILATION (per program)
|
|
191
|
+
import programasweights as paw
|
|
192
|
+
paw.compile("my_parser.paw", spec="Parse (A)(B)(C) format", checkpoint_dir="checkpoint/")
|
|
193
|
+
# → Creates my_parser.paw with KV cache
|
|
194
|
+
|
|
195
|
+
# 3. INFERENCE (many times)
|
|
196
|
+
f = paw.function("my_parser.paw")
|
|
197
|
+
result = f("(A) apple (B) banana (C) cherry")
|
|
198
|
+
print(result) # ["apple", "banana", "cherry"]
|
|
199
|
+
# → Fast! No compilation, just interpreter + cached KV
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
The magic: **Train once, compile many programs, run them infinitely fast!**
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 ProgramAsWeights
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|