@synsci/cli-darwin-x64 1.1.70 → 1.1.72
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.
- package/bin/skills/citation-management/SKILL.md +1109 -0
- package/bin/skills/citation-management/assets/bibtex_template.bib +264 -0
- package/bin/skills/citation-management/assets/citation_checklist.md +386 -0
- package/bin/skills/citation-management/references/bibtex_formatting.md +908 -0
- package/bin/skills/citation-management/references/citation_validation.md +794 -0
- package/bin/skills/citation-management/references/google_scholar_search.md +725 -0
- package/bin/skills/citation-management/references/metadata_extraction.md +870 -0
- package/bin/skills/citation-management/references/pubmed_search.md +839 -0
- package/bin/skills/citation-management/scripts/doi_to_bibtex.py +182 -0
- package/bin/skills/citation-management/scripts/extract_metadata.py +570 -0
- package/bin/skills/citation-management/scripts/format_bibtex.py +349 -0
- package/bin/skills/citation-management/scripts/search_google_scholar.py +251 -0
- package/bin/skills/citation-management/scripts/search_pubmed.py +348 -0
- package/bin/skills/citation-management/scripts/validate_citations.py +494 -0
- package/bin/skills/clinical-decision-support/README.md +129 -0
- package/bin/skills/clinical-decision-support/SKILL.md +506 -0
- package/bin/skills/clinical-decision-support/assets/biomarker_report_template.tex +380 -0
- package/bin/skills/clinical-decision-support/assets/clinical_pathway_template.tex +222 -0
- package/bin/skills/clinical-decision-support/assets/cohort_analysis_template.tex +359 -0
- package/bin/skills/clinical-decision-support/assets/color_schemes.tex +149 -0
- package/bin/skills/clinical-decision-support/assets/example_gbm_cohort.md +208 -0
- package/bin/skills/clinical-decision-support/assets/recommendation_strength_guide.md +328 -0
- package/bin/skills/clinical-decision-support/assets/treatment_recommendation_template.tex +529 -0
- package/bin/skills/clinical-decision-support/references/biomarker_classification.md +719 -0
- package/bin/skills/clinical-decision-support/references/clinical_decision_algorithms.md +604 -0
- package/bin/skills/clinical-decision-support/references/evidence_synthesis.md +840 -0
- package/bin/skills/clinical-decision-support/references/outcome_analysis.md +640 -0
- package/bin/skills/clinical-decision-support/references/patient_cohort_analysis.md +427 -0
- package/bin/skills/clinical-decision-support/references/treatment_recommendations.md +521 -0
- package/bin/skills/clinical-decision-support/scripts/biomarker_classifier.py +383 -0
- package/bin/skills/clinical-decision-support/scripts/build_decision_tree.py +417 -0
- package/bin/skills/clinical-decision-support/scripts/create_cohort_tables.py +509 -0
- package/bin/skills/clinical-decision-support/scripts/generate_survival_analysis.py +441 -0
- package/bin/skills/clinical-decision-support/scripts/validate_cds_document.py +326 -0
- package/bin/skills/clinical-reports/IMPLEMENTATION_SUMMARY.md +641 -0
- package/bin/skills/clinical-reports/README.md +236 -0
- package/bin/skills/clinical-reports/SKILL.md +1127 -0
- package/bin/skills/clinical-reports/assets/case_report_template.md +352 -0
- package/bin/skills/clinical-reports/assets/clinical_trial_csr_template.md +353 -0
- package/bin/skills/clinical-reports/assets/clinical_trial_sae_template.md +359 -0
- package/bin/skills/clinical-reports/assets/consult_note_template.md +305 -0
- package/bin/skills/clinical-reports/assets/discharge_summary_template.md +453 -0
- package/bin/skills/clinical-reports/assets/hipaa_compliance_checklist.md +395 -0
- package/bin/skills/clinical-reports/assets/history_physical_template.md +305 -0
- package/bin/skills/clinical-reports/assets/lab_report_template.md +309 -0
- package/bin/skills/clinical-reports/assets/pathology_report_template.md +249 -0
- package/bin/skills/clinical-reports/assets/quality_checklist.md +338 -0
- package/bin/skills/clinical-reports/assets/radiology_report_template.md +318 -0
- package/bin/skills/clinical-reports/assets/soap_note_template.md +253 -0
- package/bin/skills/clinical-reports/references/case_report_guidelines.md +570 -0
- package/bin/skills/clinical-reports/references/clinical_trial_reporting.md +693 -0
- package/bin/skills/clinical-reports/references/data_presentation.md +530 -0
- package/bin/skills/clinical-reports/references/diagnostic_reports_standards.md +629 -0
- package/bin/skills/clinical-reports/references/medical_terminology.md +588 -0
- package/bin/skills/clinical-reports/references/patient_documentation.md +744 -0
- package/bin/skills/clinical-reports/references/peer_review_standards.md +585 -0
- package/bin/skills/clinical-reports/references/regulatory_compliance.md +577 -0
- package/bin/skills/clinical-reports/scripts/check_deidentification.py +332 -0
- package/bin/skills/clinical-reports/scripts/compliance_checker.py +78 -0
- package/bin/skills/clinical-reports/scripts/extract_clinical_data.py +97 -0
- package/bin/skills/clinical-reports/scripts/format_adverse_events.py +97 -0
- package/bin/skills/clinical-reports/scripts/generate_report_template.py +149 -0
- package/bin/skills/clinical-reports/scripts/terminology_validator.py +126 -0
- package/bin/skills/clinical-reports/scripts/validate_case_report.py +323 -0
- package/bin/skills/clinical-reports/scripts/validate_trial_report.py +88 -0
- package/bin/skills/fireworks-ai/SKILL.md +665 -0
- package/bin/skills/generate-image/SKILL.md +178 -0
- package/bin/skills/generate-image/scripts/generate_image.py +254 -0
- package/bin/skills/groq/SKILL.md +347 -0
- package/bin/skills/hypothesis-generation/SKILL.md +293 -0
- package/bin/skills/hypothesis-generation/assets/FORMATTING_GUIDE.md +672 -0
- package/bin/skills/hypothesis-generation/assets/hypothesis_generation.sty +307 -0
- package/bin/skills/hypothesis-generation/assets/hypothesis_report_template.tex +572 -0
- package/bin/skills/hypothesis-generation/references/experimental_design_patterns.md +329 -0
- package/bin/skills/hypothesis-generation/references/hypothesis_quality_criteria.md +198 -0
- package/bin/skills/hypothesis-generation/references/literature_search_strategies.md +622 -0
- package/bin/skills/latex-posters/README.md +417 -0
- package/bin/skills/latex-posters/SKILL.md +1602 -0
- package/bin/skills/latex-posters/assets/baposter_template.tex +257 -0
- package/bin/skills/latex-posters/assets/beamerposter_template.tex +244 -0
- package/bin/skills/latex-posters/assets/poster_quality_checklist.md +358 -0
- package/bin/skills/latex-posters/assets/tikzposter_template.tex +251 -0
- package/bin/skills/latex-posters/references/latex_poster_packages.md +745 -0
- package/bin/skills/latex-posters/references/poster_content_guide.md +748 -0
- package/bin/skills/latex-posters/references/poster_design_principles.md +806 -0
- package/bin/skills/latex-posters/references/poster_layout_design.md +900 -0
- package/bin/skills/latex-posters/scripts/review_poster.sh +214 -0
- package/bin/skills/literature-review/SKILL.md +641 -0
- package/bin/skills/literature-review/assets/review_template.md +412 -0
- package/bin/skills/literature-review/references/citation_styles.md +166 -0
- package/bin/skills/literature-review/references/database_strategies.md +455 -0
- package/bin/skills/literature-review/scripts/generate_pdf.py +184 -0
- package/bin/skills/literature-review/scripts/search_databases.py +310 -0
- package/bin/skills/literature-review/scripts/verify_citations.py +218 -0
- package/bin/skills/market-research-reports/SKILL.md +904 -0
- package/bin/skills/market-research-reports/assets/FORMATTING_GUIDE.md +428 -0
- package/bin/skills/market-research-reports/assets/market_report_template.tex +1380 -0
- package/bin/skills/market-research-reports/assets/market_research.sty +564 -0
- package/bin/skills/market-research-reports/references/data_analysis_patterns.md +548 -0
- package/bin/skills/market-research-reports/references/report_structure_guide.md +999 -0
- package/bin/skills/market-research-reports/references/visual_generation_guide.md +1077 -0
- package/bin/skills/market-research-reports/scripts/generate_market_visuals.py +472 -0
- package/bin/skills/markitdown/INSTALLATION_GUIDE.md +318 -0
- package/bin/skills/markitdown/LICENSE.txt +22 -0
- package/bin/skills/markitdown/OPENROUTER_INTEGRATION.md +359 -0
- package/bin/skills/markitdown/QUICK_REFERENCE.md +309 -0
- package/bin/skills/markitdown/README.md +184 -0
- package/bin/skills/markitdown/SKILL.md +486 -0
- package/bin/skills/markitdown/SKILL_SUMMARY.md +307 -0
- package/bin/skills/markitdown/assets/example_usage.md +463 -0
- package/bin/skills/markitdown/references/api_reference.md +399 -0
- package/bin/skills/markitdown/references/file_formats.md +542 -0
- package/bin/skills/markitdown/scripts/batch_convert.py +195 -0
- package/bin/skills/markitdown/scripts/convert_literature.py +262 -0
- package/bin/skills/markitdown/scripts/convert_with_ai.py +224 -0
- package/bin/skills/ml-paper-writing/SKILL.md +937 -0
- package/bin/skills/ml-paper-writing/references/checklists.md +361 -0
- package/bin/skills/ml-paper-writing/references/citation-workflow.md +562 -0
- package/bin/skills/ml-paper-writing/references/reviewer-guidelines.md +367 -0
- package/bin/skills/ml-paper-writing/references/sources.md +159 -0
- package/bin/skills/ml-paper-writing/references/writing-guide.md +476 -0
- package/bin/skills/ml-paper-writing/templates/README.md +251 -0
- package/bin/skills/ml-paper-writing/templates/aaai2026/README.md +534 -0
- package/bin/skills/ml-paper-writing/templates/aaai2026/aaai2026-unified-supp.tex +144 -0
- package/bin/skills/ml-paper-writing/templates/aaai2026/aaai2026-unified-template.tex +952 -0
- package/bin/skills/ml-paper-writing/templates/aaai2026/aaai2026.bib +111 -0
- package/bin/skills/ml-paper-writing/templates/aaai2026/aaai2026.bst +1493 -0
- package/bin/skills/ml-paper-writing/templates/aaai2026/aaai2026.sty +315 -0
- package/bin/skills/ml-paper-writing/templates/acl/README.md +50 -0
- package/bin/skills/ml-paper-writing/templates/acl/acl.sty +312 -0
- package/bin/skills/ml-paper-writing/templates/acl/acl_latex.tex +377 -0
- package/bin/skills/ml-paper-writing/templates/acl/acl_lualatex.tex +101 -0
- package/bin/skills/ml-paper-writing/templates/acl/acl_natbib.bst +1940 -0
- package/bin/skills/ml-paper-writing/templates/acl/anthology.bib.txt +26 -0
- package/bin/skills/ml-paper-writing/templates/acl/custom.bib +70 -0
- package/bin/skills/ml-paper-writing/templates/acl/formatting.md +326 -0
- package/bin/skills/ml-paper-writing/templates/colm2025/README.md +3 -0
- package/bin/skills/ml-paper-writing/templates/colm2025/colm2025_conference.bib +11 -0
- package/bin/skills/ml-paper-writing/templates/colm2025/colm2025_conference.bst +1440 -0
- package/bin/skills/ml-paper-writing/templates/colm2025/colm2025_conference.pdf +0 -0
- package/bin/skills/ml-paper-writing/templates/colm2025/colm2025_conference.sty +218 -0
- package/bin/skills/ml-paper-writing/templates/colm2025/colm2025_conference.tex +305 -0
- package/bin/skills/ml-paper-writing/templates/colm2025/fancyhdr.sty +485 -0
- package/bin/skills/ml-paper-writing/templates/colm2025/math_commands.tex +508 -0
- package/bin/skills/ml-paper-writing/templates/colm2025/natbib.sty +1246 -0
- package/bin/skills/ml-paper-writing/templates/iclr2026/fancyhdr.sty +485 -0
- package/bin/skills/ml-paper-writing/templates/iclr2026/iclr2026_conference.bib +24 -0
- package/bin/skills/ml-paper-writing/templates/iclr2026/iclr2026_conference.bst +1440 -0
- package/bin/skills/ml-paper-writing/templates/iclr2026/iclr2026_conference.pdf +0 -0
- package/bin/skills/ml-paper-writing/templates/iclr2026/iclr2026_conference.sty +246 -0
- package/bin/skills/ml-paper-writing/templates/iclr2026/iclr2026_conference.tex +414 -0
- package/bin/skills/ml-paper-writing/templates/iclr2026/math_commands.tex +508 -0
- package/bin/skills/ml-paper-writing/templates/iclr2026/natbib.sty +1246 -0
- package/bin/skills/ml-paper-writing/templates/icml2026/algorithm.sty +79 -0
- package/bin/skills/ml-paper-writing/templates/icml2026/algorithmic.sty +201 -0
- package/bin/skills/ml-paper-writing/templates/icml2026/example_paper.bib +75 -0
- package/bin/skills/ml-paper-writing/templates/icml2026/example_paper.pdf +0 -0
- package/bin/skills/ml-paper-writing/templates/icml2026/example_paper.tex +662 -0
- package/bin/skills/ml-paper-writing/templates/icml2026/fancyhdr.sty +864 -0
- package/bin/skills/ml-paper-writing/templates/icml2026/icml2026.bst +1443 -0
- package/bin/skills/ml-paper-writing/templates/icml2026/icml2026.sty +767 -0
- package/bin/skills/ml-paper-writing/templates/icml2026/icml_numpapers.pdf +0 -0
- package/bin/skills/ml-paper-writing/templates/neurips2025/Makefile +36 -0
- package/bin/skills/ml-paper-writing/templates/neurips2025/extra_pkgs.tex +53 -0
- package/bin/skills/ml-paper-writing/templates/neurips2025/main.tex +38 -0
- package/bin/skills/ml-paper-writing/templates/neurips2025/neurips.sty +382 -0
- package/bin/skills/paper-2-web/SKILL.md +491 -0
- package/bin/skills/paper-2-web/references/installation.md +141 -0
- package/bin/skills/paper-2-web/references/paper2poster.md +346 -0
- package/bin/skills/paper-2-web/references/paper2video.md +305 -0
- package/bin/skills/paper-2-web/references/paper2web.md +187 -0
- package/bin/skills/paper-2-web/references/usage_examples.md +436 -0
- package/bin/skills/peer-review/SKILL.md +702 -0
- package/bin/skills/peer-review/references/calibration_guidelines.md +196 -0
- package/bin/skills/peer-review/references/common_issues.md +552 -0
- package/bin/skills/peer-review/references/paper_mechanics.md +269 -0
- package/bin/skills/peer-review/references/reporting_standards.md +290 -0
- package/bin/skills/peer-review/references/scoring_rubric.md +239 -0
- package/bin/skills/pptx-posters/SKILL.md +410 -0
- package/bin/skills/pptx-posters/assets/poster_html_template.html +257 -0
- package/bin/skills/pptx-posters/assets/poster_quality_checklist.md +358 -0
- package/bin/skills/pptx-posters/references/poster_content_guide.md +748 -0
- package/bin/skills/pptx-posters/references/poster_design_principles.md +806 -0
- package/bin/skills/pptx-posters/references/poster_layout_design.md +900 -0
- package/bin/skills/research-grants/README.md +285 -0
- package/bin/skills/research-grants/SKILL.md +938 -0
- package/bin/skills/research-grants/assets/budget_justification_template.md +453 -0
- package/bin/skills/research-grants/assets/nih_specific_aims_template.md +166 -0
- package/bin/skills/research-grants/assets/nsf_project_summary_template.md +92 -0
- package/bin/skills/research-grants/references/broader_impacts.md +392 -0
- package/bin/skills/research-grants/references/darpa_guidelines.md +636 -0
- package/bin/skills/research-grants/references/doe_guidelines.md +586 -0
- package/bin/skills/research-grants/references/nih_guidelines.md +851 -0
- package/bin/skills/research-grants/references/nsf_guidelines.md +570 -0
- package/bin/skills/research-grants/references/specific_aims_guide.md +458 -0
- package/bin/skills/research-lookup/README.md +156 -0
- package/bin/skills/research-lookup/SKILL.md +606 -0
- package/bin/skills/research-lookup/examples.py +174 -0
- package/bin/skills/research-lookup/lookup.py +187 -0
- package/bin/skills/research-lookup/research_lookup.py +483 -0
- package/bin/skills/research-lookup/scripts/research_lookup.py +483 -0
- package/bin/skills/scholar-evaluation/SKILL.md +289 -0
- package/bin/skills/scholar-evaluation/references/evaluation_framework.md +663 -0
- package/bin/skills/scholar-evaluation/scripts/calculate_scores.py +366 -0
- package/bin/skills/scientific-critical-thinking/SKILL.md +566 -0
- package/bin/skills/scientific-critical-thinking/references/common_biases.md +364 -0
- package/bin/skills/scientific-critical-thinking/references/evidence_hierarchy.md +484 -0
- package/bin/skills/scientific-critical-thinking/references/experimental_design.md +496 -0
- package/bin/skills/scientific-critical-thinking/references/logical_fallacies.md +478 -0
- package/bin/skills/scientific-critical-thinking/references/scientific_method.md +169 -0
- package/bin/skills/scientific-critical-thinking/references/statistical_pitfalls.md +506 -0
- package/bin/skills/scientific-schematics/QUICK_REFERENCE.md +207 -0
- package/bin/skills/scientific-schematics/README.md +327 -0
- package/bin/skills/scientific-schematics/SKILL.md +615 -0
- package/bin/skills/scientific-schematics/example_usage.sh +89 -0
- package/bin/skills/scientific-schematics/references/best_practices.md +559 -0
- package/bin/skills/scientific-schematics/scripts/generate_schematic.py +135 -0
- package/bin/skills/scientific-schematics/scripts/generate_schematic_ai.py +807 -0
- package/bin/skills/scientific-schematics/test_ai_generation.py +243 -0
- package/bin/skills/scientific-slides/SKILL.md +942 -0
- package/bin/skills/scientific-slides/assets/timing_guidelines.md +597 -0
- package/bin/skills/scientific-slides/references/data_visualization_slides.md +708 -0
- package/bin/skills/scientific-slides/references/presentation_structure.md +642 -0
- package/bin/skills/scientific-slides/references/slide_design_principles.md +849 -0
- package/bin/skills/scientific-slides/references/talk_types_guide.md +687 -0
- package/bin/skills/scientific-slides/references/visual_review_workflow.md +775 -0
- package/bin/skills/scientific-slides/scripts/generate_slide_image.py +143 -0
- package/bin/skills/scientific-slides/scripts/generate_slide_image_ai.py +748 -0
- package/bin/skills/scientific-slides/scripts/pdf_to_images.py +201 -0
- package/bin/skills/scientific-slides/scripts/slides_to_pdf.py +220 -0
- package/bin/skills/scientific-slides/scripts/validate_presentation.py +367 -0
- package/bin/skills/scientific-writing/SKILL.md +714 -0
- package/bin/skills/scientific-writing/assets/REPORT_FORMATTING_GUIDE.md +574 -0
- package/bin/skills/scientific-writing/assets/scientific_report.sty +606 -0
- package/bin/skills/scientific-writing/assets/scientific_report_template.tex +449 -0
- package/bin/skills/scientific-writing/references/citation_styles.md +720 -0
- package/bin/skills/scientific-writing/references/figures_tables.md +806 -0
- package/bin/skills/scientific-writing/references/imrad_structure.md +686 -0
- package/bin/skills/scientific-writing/references/professional_report_formatting.md +664 -0
- package/bin/skills/scientific-writing/references/reporting_guidelines.md +748 -0
- package/bin/skills/scientific-writing/references/writing_principles.md +824 -0
- package/bin/skills/tinker/SKILL.md +2 -3
- package/bin/skills/together-ai/SKILL.md +722 -0
- package/bin/skills/treatment-plans/README.md +488 -0
- package/bin/skills/treatment-plans/SKILL.md +1579 -0
- package/bin/skills/treatment-plans/assets/STYLING_QUICK_REFERENCE.md +185 -0
- package/bin/skills/treatment-plans/assets/chronic_disease_management_plan.tex +665 -0
- package/bin/skills/treatment-plans/assets/general_medical_treatment_plan.tex +547 -0
- package/bin/skills/treatment-plans/assets/medical_treatment_plan.sty +222 -0
- package/bin/skills/treatment-plans/assets/mental_health_treatment_plan.tex +774 -0
- package/bin/skills/treatment-plans/assets/one_page_treatment_plan.tex +193 -0
- package/bin/skills/treatment-plans/assets/pain_management_plan.tex +799 -0
- package/bin/skills/treatment-plans/assets/perioperative_care_plan.tex +753 -0
- package/bin/skills/treatment-plans/assets/quality_checklist.md +471 -0
- package/bin/skills/treatment-plans/assets/rehabilitation_treatment_plan.tex +756 -0
- package/bin/skills/treatment-plans/references/goal_setting_frameworks.md +411 -0
- package/bin/skills/treatment-plans/references/intervention_guidelines.md +507 -0
- package/bin/skills/treatment-plans/references/regulatory_compliance.md +476 -0
- package/bin/skills/treatment-plans/references/specialty_specific_guidelines.md +655 -0
- package/bin/skills/treatment-plans/references/treatment_plan_standards.md +485 -0
- package/bin/skills/treatment-plans/scripts/check_completeness.py +322 -0
- package/bin/skills/treatment-plans/scripts/generate_template.py +233 -0
- package/bin/skills/treatment-plans/scripts/timeline_generator.py +385 -0
- package/bin/skills/treatment-plans/scripts/validate_treatment_plan.py +369 -0
- package/bin/skills/unsloth/SKILL.md +565 -47
- package/bin/skills/unsloth/docs/advanced-rl.md +222 -0
- package/bin/skills/unsloth/docs/chat-templates.md +141 -0
- package/bin/skills/unsloth/docs/datasets.md +489 -0
- package/bin/skills/unsloth/docs/docker-extended.md +99 -0
- package/bin/skills/unsloth/docs/dynamic-ggufs-2.0.md +116 -0
- package/bin/skills/unsloth/docs/dynamic-ggufs-aider.md +118 -0
- package/bin/skills/unsloth/docs/faq.md +91 -0
- package/bin/skills/unsloth/docs/fp16-vs-bf16.md +61 -0
- package/bin/skills/unsloth/docs/fp8-rl.md +224 -0
- package/bin/skills/unsloth/docs/glm-4.7-flash.md +997 -0
- package/bin/skills/unsloth/docs/inference-deployment-overview.md +17 -0
- package/bin/skills/unsloth/docs/inference.md +27 -0
- package/bin/skills/unsloth/docs/installation-docker.md +155 -0
- package/bin/skills/unsloth/docs/installation-pip.md +148 -0
- package/bin/skills/unsloth/docs/kernels-packing.md +190 -0
- package/bin/skills/unsloth/docs/kimi-k2.5.md +634 -0
- package/bin/skills/unsloth/docs/lm-studio.md +235 -0
- package/bin/skills/unsloth/docs/lora-hot-swapping.md +75 -0
- package/bin/skills/unsloth/docs/lora-hyperparameters.md +363 -0
- package/bin/skills/unsloth/docs/memory-efficient-rl.md +267 -0
- package/bin/skills/unsloth/docs/model-selection.md +70 -0
- package/bin/skills/unsloth/docs/models.md +532 -0
- package/bin/skills/unsloth/docs/multi-gpu-ddp.md +90 -0
- package/bin/skills/unsloth/docs/notebooks.md +223 -0
- package/bin/skills/unsloth/docs/overview.md +110 -0
- package/bin/skills/unsloth/docs/qwen3-coder-next-extended.md +900 -0
- package/bin/skills/unsloth/docs/qwen3-coder-next.md +900 -0
- package/bin/skills/unsloth/docs/requirements.md +45 -0
- package/bin/skills/unsloth/docs/reward-hacking.md +25 -0
- package/bin/skills/unsloth/docs/saving-to-gguf.md +138 -0
- package/bin/skills/unsloth/docs/saving-to-ollama.md +46 -0
- package/bin/skills/unsloth/docs/sglang-guide.md +278 -0
- package/bin/skills/unsloth/docs/speculative-decoding.md +70 -0
- package/bin/skills/unsloth/docs/tool-calling.md +334 -0
- package/bin/skills/unsloth/docs/troubleshooting-faq.md +204 -0
- package/bin/skills/unsloth/docs/troubleshooting-inference.md +26 -0
- package/bin/skills/unsloth/docs/tts-fine-tuning.md +149 -0
- package/bin/skills/unsloth/docs/tutorial-grpo.md +273 -0
- package/bin/skills/unsloth/docs/tutorial-llama3-ollama.md +356 -0
- package/bin/skills/unsloth/docs/vision-fine-tuning.md +135 -0
- package/bin/skills/unsloth/docs/vision-rl.md +170 -0
- package/bin/skills/unsloth/docs/vllm-engine-arguments.md +43 -0
- package/bin/skills/unsloth/docs/vllm-guide.md +98 -0
- package/bin/skills/venue-templates/SKILL.md +686 -0
- package/bin/skills/venue-templates/assets/examples/cell_summary_example.md +247 -0
- package/bin/skills/venue-templates/assets/examples/medical_structured_abstract.md +313 -0
- package/bin/skills/venue-templates/assets/examples/nature_abstract_examples.md +213 -0
- package/bin/skills/venue-templates/assets/examples/neurips_introduction_example.md +245 -0
- package/bin/skills/venue-templates/assets/grants/nih_specific_aims.tex +235 -0
- package/bin/skills/venue-templates/assets/grants/nsf_proposal_template.tex +375 -0
- package/bin/skills/venue-templates/assets/journals/nature_article.tex +171 -0
- package/bin/skills/venue-templates/assets/journals/neurips_article.tex +283 -0
- package/bin/skills/venue-templates/assets/journals/plos_one.tex +317 -0
- package/bin/skills/venue-templates/assets/posters/beamerposter_academic.tex +311 -0
- package/bin/skills/venue-templates/references/cell_press_style.md +483 -0
- package/bin/skills/venue-templates/references/conferences_formatting.md +564 -0
- package/bin/skills/venue-templates/references/cs_conference_style.md +463 -0
- package/bin/skills/venue-templates/references/grants_requirements.md +787 -0
- package/bin/skills/venue-templates/references/journals_formatting.md +486 -0
- package/bin/skills/venue-templates/references/medical_journal_styles.md +535 -0
- package/bin/skills/venue-templates/references/ml_conference_style.md +556 -0
- package/bin/skills/venue-templates/references/nature_science_style.md +405 -0
- package/bin/skills/venue-templates/references/posters_guidelines.md +628 -0
- package/bin/skills/venue-templates/references/reviewer_expectations.md +417 -0
- package/bin/skills/venue-templates/references/venue_writing_styles.md +321 -0
- package/bin/skills/venue-templates/scripts/customize_template.py +195 -0
- package/bin/skills/venue-templates/scripts/query_template.py +266 -0
- package/bin/skills/venue-templates/scripts/validate_format.py +250 -0
- package/bin/synsc +0 -0
- package/package.json +1 -1
- package/bin/skills/unsloth/references/index.md +0 -7
- package/bin/skills/unsloth/references/llms-full.md +0 -16799
- package/bin/skills/unsloth/references/llms-txt.md +0 -12044
- package/bin/skills/unsloth/references/llms.md +0 -82
|
@@ -1,80 +1,598 @@
|
|
|
1
1
|
---
|
|
2
|
-
name: unsloth
|
|
3
|
-
description:
|
|
2
|
+
name: unsloth-fine-tuning
|
|
3
|
+
description: Fast LLM fine-tuning with Unsloth - 2-5x faster training, 50-80% less VRAM. Use for single-GPU LoRA/QLoRA SFT, GRPO/RL reasoning training, vision/TTS fine-tuning, and GGUF export to Ollama/vLLM/llama.cpp. Supports 300+ models including Llama, Qwen, Gemma, DeepSeek, Mistral, Phi, and gpt-oss.
|
|
4
4
|
version: 1.0.0
|
|
5
5
|
author: Synthetic Sciences
|
|
6
6
|
license: MIT
|
|
7
|
-
tags: [Fine-Tuning, Unsloth,
|
|
8
|
-
dependencies: [unsloth, torch, transformers, trl, datasets, peft]
|
|
7
|
+
tags: [Fine-Tuning, Unsloth, LoRA, QLoRA, GRPO, RL, Vision, TTS, GGUF, Ollama, vLLM, Fast Training, Memory-Efficient]
|
|
8
|
+
dependencies: [unsloth, torch>=2.1.0, transformers>=4.45.0, trl>=0.15.0, datasets, peft, xformers]
|
|
9
9
|
---
|
|
10
10
|
|
|
11
|
-
# Unsloth
|
|
11
|
+
# Unsloth - Fast LLM Fine-Tuning
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
Fine-tune LLMs 2-5x faster with 50-80% less VRAM. Supports SFT, RL (GRPO), vision, TTS, and 300+ models with zero accuracy loss.
|
|
14
14
|
|
|
15
|
-
## When to Use
|
|
15
|
+
## When to Use Unsloth
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
-
|
|
19
|
-
-
|
|
20
|
-
-
|
|
21
|
-
-
|
|
22
|
-
-
|
|
17
|
+
**Use Unsloth when:**
|
|
18
|
+
- Fine-tuning on a single GPU with LoRA/QLoRA (consumer or datacenter)
|
|
19
|
+
- Training reasoning models with GRPO, Dr. GRPO, DAPO, BNPO, or GSPO
|
|
20
|
+
- Fine-tuning vision models (Qwen3-VL, Gemma 3, Llama 3.2 Vision)
|
|
21
|
+
- Fine-tuning TTS models (Orpheus, Sesame-CSM, Whisper)
|
|
22
|
+
- Exporting to GGUF for Ollama, llama.cpp, or LM Studio
|
|
23
|
+
- Need padding-free training and uncontaminated packing (automatic)
|
|
24
|
+
- Using FP8 precision for additional memory savings on Ampere+ GPUs
|
|
25
|
+
|
|
26
|
+
**Don't use Unsloth when:**
|
|
27
|
+
- Multi-node distributed training at scale (Unsloth DDP works but is single-node)
|
|
28
|
+
- Apple Silicon / MLX (not yet supported)
|
|
29
|
+
- Full fine-tuning of 70B+ models (use DeepSpeed + Transformers)
|
|
30
|
+
- Custom architectures not supported by `transformers`
|
|
31
|
+
- Cloud-managed training without GPU access (use Tinker instead)
|
|
32
|
+
|
|
33
|
+
**Unsloth vs Alternatives:**
|
|
34
|
+
|
|
35
|
+
| Need | Use |
|
|
36
|
+
|------|-----|
|
|
37
|
+
| Fast single-GPU LoRA/QLoRA | **Unsloth** |
|
|
38
|
+
| Managed cloud LoRA training | Tinker |
|
|
39
|
+
| Parameter-efficient methods (IA3, Prefix, etc.) | PEFT |
|
|
40
|
+
| Multi-node distributed training | DeepSpeed + Transformers |
|
|
41
|
+
| YAML-config-driven training | Axolotl |
|
|
42
|
+
| Full fine-tuning with FSDP | Transformers + Accelerate |
|
|
23
43
|
|
|
24
44
|
## Quick Reference
|
|
25
45
|
|
|
26
|
-
|
|
46
|
+
| Topic | Documentation |
|
|
47
|
+
|-------|---------------|
|
|
48
|
+
| Overview & Features | [docs/overview.md](docs/overview.md) |
|
|
49
|
+
| Installation (pip) | [docs/installation-pip.md](docs/installation-pip.md) |
|
|
50
|
+
| Installation (Docker) | [docs/installation-docker.md](docs/installation-docker.md) |
|
|
51
|
+
| Model Selection Guide | [docs/model-selection.md](docs/model-selection.md) |
|
|
52
|
+
| VRAM Requirements | [docs/requirements.md](docs/requirements.md) |
|
|
53
|
+
| Model Catalog (300+) | [docs/models.md](docs/models.md) |
|
|
54
|
+
| Datasets & Formatting | [docs/datasets.md](docs/datasets.md) |
|
|
55
|
+
| Chat Templates | [docs/chat-templates.md](docs/chat-templates.md) |
|
|
56
|
+
| LoRA Hyperparameters | [docs/lora-hyperparameters.md](docs/lora-hyperparameters.md) |
|
|
57
|
+
| GRPO RL Tutorial | [docs/tutorial-grpo.md](docs/tutorial-grpo.md) |
|
|
58
|
+
| Advanced RL Parameters | [docs/advanced-rl.md](docs/advanced-rl.md) |
|
|
59
|
+
| Memory-Efficient RL | [docs/memory-efficient-rl.md](docs/memory-efficient-rl.md) |
|
|
60
|
+
| Vision Fine-Tuning | [docs/vision-fine-tuning.md](docs/vision-fine-tuning.md) |
|
|
61
|
+
| Vision RL (VLM GRPO) | [docs/vision-rl.md](docs/vision-rl.md) |
|
|
62
|
+
| TTS Fine-Tuning | [docs/tts-fine-tuning.md](docs/tts-fine-tuning.md) |
|
|
63
|
+
| Saving to GGUF | [docs/saving-to-gguf.md](docs/saving-to-gguf.md) |
|
|
64
|
+
| Saving to Ollama | [docs/saving-to-ollama.md](docs/saving-to-ollama.md) |
|
|
65
|
+
| vLLM Deployment | [docs/vllm-guide.md](docs/vllm-guide.md) |
|
|
66
|
+
| FP8 Training | [docs/fp8-rl.md](docs/fp8-rl.md) |
|
|
67
|
+
| FP16 vs BF16 for RL | [docs/fp16-vs-bf16.md](docs/fp16-vs-bf16.md) |
|
|
68
|
+
| Multi-GPU DDP | [docs/multi-gpu-ddp.md](docs/multi-gpu-ddp.md) |
|
|
69
|
+
| Kernels & Packing | [docs/kernels-packing.md](docs/kernels-packing.md) |
|
|
70
|
+
| Inference | [docs/inference.md](docs/inference.md) |
|
|
71
|
+
| Troubleshooting | [docs/troubleshooting-faq.md](docs/troubleshooting-faq.md) |
|
|
72
|
+
| Troubleshooting Inference | [docs/troubleshooting-inference.md](docs/troubleshooting-inference.md) |
|
|
27
73
|
|
|
28
|
-
|
|
74
|
+
## Installation
|
|
29
75
|
|
|
30
|
-
|
|
76
|
+
```bash
|
|
77
|
+
# Recommended (pip)
|
|
78
|
+
pip install unsloth
|
|
31
79
|
|
|
32
|
-
|
|
80
|
+
# With vLLM (for GRPO fast inference)
|
|
81
|
+
pip install uv && uv pip install unsloth vllm
|
|
33
82
|
|
|
34
|
-
|
|
83
|
+
# Docker (all dependencies pre-installed)
|
|
84
|
+
docker run -d -e JUPYTER_PASSWORD="mypassword" \
|
|
85
|
+
-p 8888:8888 --gpus all -v $(pwd)/work:/workspace/work \
|
|
86
|
+
unsloth/unsloth
|
|
87
|
+
```
|
|
35
88
|
|
|
36
|
-
|
|
89
|
+
**Requirements:** Linux or Windows (WSL), NVIDIA GPU with CUDA Capability 7.0+ (V100, T4, RTX 20-50, A100, H100, L40). AMD and Intel GPUs also supported. Python 3.10-3.13.
|
|
37
90
|
|
|
38
|
-
|
|
91
|
+
---
|
|
39
92
|
|
|
40
|
-
|
|
41
|
-
Start with the getting_started or tutorials reference files for foundational concepts.
|
|
93
|
+
## Workflow 1: SFT (Supervised Fine-Tuning)
|
|
42
94
|
|
|
43
|
-
|
|
44
|
-
Use the appropriate category reference file (api, guides, etc.) for detailed information.
|
|
95
|
+
Use this for standard instruction tuning, chat fine-tuning, or domain adaptation.
|
|
45
96
|
|
|
46
|
-
###
|
|
47
|
-
|
|
97
|
+
### Checklist
|
|
98
|
+
- [ ] Prepare dataset in ShareGPT, ChatML, or Alpaca format
|
|
99
|
+
- [ ] Choose base vs instruct model (see Model Selection below)
|
|
100
|
+
- [ ] Select QLoRA (4-bit) or LoRA (16-bit) based on VRAM
|
|
101
|
+
- [ ] Set hyperparameters (rank, alpha, LR, epochs)
|
|
102
|
+
- [ ] Run training with SFTTrainer
|
|
103
|
+
- [ ] Save and deploy (LoRA adapter, merged 16-bit, or GGUF)
|
|
48
104
|
|
|
49
|
-
|
|
105
|
+
### Implementation
|
|
106
|
+
|
|
107
|
+
```python
|
|
108
|
+
from unsloth import FastLanguageModel
|
|
109
|
+
from trl import SFTTrainer, SFTConfig
|
|
110
|
+
from datasets import load_dataset
|
|
111
|
+
|
|
112
|
+
# Step 1: Load model (QLoRA 4-bit)
|
|
113
|
+
model, tokenizer = FastLanguageModel.from_pretrained(
|
|
114
|
+
model_name="unsloth/Qwen3-8B-bnb-4bit", # or any HF model
|
|
115
|
+
max_seq_length=2048,
|
|
116
|
+
load_in_4bit=True, # False for LoRA 16-bit
|
|
117
|
+
)
|
|
118
|
+
|
|
119
|
+
# Step 2: Add LoRA adapters
|
|
120
|
+
model = FastLanguageModel.get_peft_model(
|
|
121
|
+
model,
|
|
122
|
+
r=16, # Rank: 8-128 (16-32 recommended)
|
|
123
|
+
lora_alpha=16, # Alpha: equal to r or 2*r
|
|
124
|
+
lora_dropout=0, # 0 is default, use 0.05-0.1 for regularization
|
|
125
|
+
target_modules=["q_proj", "k_proj", "v_proj", "o_proj",
|
|
126
|
+
"gate_proj", "up_proj", "down_proj"],
|
|
127
|
+
use_gradient_checkpointing="unsloth", # 30% less VRAM
|
|
128
|
+
use_rslora=False, # True for rank-stabilized LoRA
|
|
129
|
+
)
|
|
130
|
+
|
|
131
|
+
# Step 3: Prepare dataset
|
|
132
|
+
dataset = load_dataset("philschmid/dolly-15k-oai-style", split="train")
|
|
133
|
+
|
|
134
|
+
# Step 4: Train
|
|
135
|
+
trainer = SFTTrainer(
|
|
136
|
+
model=model,
|
|
137
|
+
tokenizer=tokenizer,
|
|
138
|
+
train_dataset=dataset,
|
|
139
|
+
args=SFTConfig(
|
|
140
|
+
output_dir="./sft-output",
|
|
141
|
+
per_device_train_batch_size=2,
|
|
142
|
+
gradient_accumulation_steps=4, # Effective batch = 2*4 = 8
|
|
143
|
+
num_train_epochs=3,
|
|
144
|
+
learning_rate=2e-4,
|
|
145
|
+
fp16=True, # or bf16=True
|
|
146
|
+
logging_steps=10,
|
|
147
|
+
optim="adamw_8bit",
|
|
148
|
+
max_seq_length=2048,
|
|
149
|
+
packing=True, # Uncontaminated packing (2-5x faster)
|
|
150
|
+
),
|
|
151
|
+
)
|
|
152
|
+
trainer.train()
|
|
153
|
+
|
|
154
|
+
# Step 5: Save
|
|
155
|
+
model.save_pretrained("lora_adapter") # LoRA only (~6MB)
|
|
156
|
+
tokenizer.save_pretrained("lora_adapter")
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### Data Formats
|
|
160
|
+
|
|
161
|
+
| Format | Template | Use Case |
|
|
162
|
+
|--------|----------|----------|
|
|
163
|
+
| ShareGPT | `{"conversations": [{"from": "human", ...}]}` | Multi-turn chat, instruct models |
|
|
164
|
+
| ChatML / OpenAI | `{"messages": [{"role": "user", ...}]}` | OpenAI-compatible, instruct models |
|
|
165
|
+
| Alpaca | `{"instruction": ..., "input": ..., "output": ...}` | Single-turn tasks, base models |
|
|
166
|
+
| Raw text | Plain text corpus | Continued pretraining |
|
|
167
|
+
|
|
168
|
+
Use `get_chat_template(tokenizer, chat_template="chatml")` to apply templates. Use `standardize_sharegpt(dataset)` for ShareGPT-formatted data with non-standard keys.
|
|
169
|
+
|
|
170
|
+
### Training on Completions Only
|
|
171
|
+
|
|
172
|
+
Mask user inputs so loss is only computed on assistant responses:
|
|
173
|
+
|
|
174
|
+
```python
|
|
175
|
+
from unsloth.chat_templates import train_on_responses_only
|
|
176
|
+
trainer = train_on_responses_only(
|
|
177
|
+
trainer,
|
|
178
|
+
instruction_part="<|start_header_id|>user<|end_header_id|>\n\n", # Llama 3.x
|
|
179
|
+
response_part="<|start_header_id|>assistant<|end_header_id|>\n\n",
|
|
180
|
+
)
|
|
181
|
+
# For Gemma: instruction_part="<start_of_turn>user\n", response_part="<start_of_turn>model\n"
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
**Sources:** [docs/datasets.md](docs/datasets.md), [docs/chat-templates.md](docs/chat-templates.md), [docs/lora-hyperparameters.md](docs/lora-hyperparameters.md)
|
|
185
|
+
|
|
186
|
+
---
|
|
187
|
+
|
|
188
|
+
## Workflow 2: RL Training (GRPO)
|
|
189
|
+
|
|
190
|
+
Use this for training reasoning models with reward functions — math, code, format compliance, verifiable tasks.
|
|
191
|
+
|
|
192
|
+
### Checklist
|
|
193
|
+
- [ ] Define reward function(s) returning float scores
|
|
194
|
+
- [ ] Choose model and enable vLLM fast inference
|
|
195
|
+
- [ ] Enable Unsloth Standby for memory-efficient RL
|
|
196
|
+
- [ ] Configure GRPOConfig with num_generations, epsilon, loss_type
|
|
197
|
+
- [ ] Monitor reward curves and KL divergence
|
|
198
|
+
- [ ] Save and export model
|
|
199
|
+
|
|
200
|
+
### Implementation
|
|
201
|
+
|
|
202
|
+
```python
|
|
203
|
+
import os
|
|
204
|
+
os.environ["UNSLOTH_VLLM_STANDBY"] = "1" # Memory-efficient RL
|
|
205
|
+
|
|
206
|
+
from unsloth import FastLanguageModel
|
|
207
|
+
import torch
|
|
208
|
+
import re
|
|
209
|
+
|
|
210
|
+
model, tokenizer = FastLanguageModel.from_pretrained(
|
|
211
|
+
model_name="unsloth/Qwen3-8B",
|
|
212
|
+
max_seq_length=2048,
|
|
213
|
+
load_in_4bit=True, # False for LoRA 16-bit
|
|
214
|
+
fast_inference=True, # Enable vLLM for fast generation
|
|
215
|
+
max_lora_rank=32,
|
|
216
|
+
gpu_memory_utilization=0.9, # Reduce if OOM
|
|
217
|
+
)
|
|
218
|
+
|
|
219
|
+
model = FastLanguageModel.get_peft_model(
|
|
220
|
+
model, r=32, lora_alpha=64,
|
|
221
|
+
target_modules=["q_proj", "k_proj", "v_proj", "o_proj",
|
|
222
|
+
"gate_proj", "up_proj", "down_proj"],
|
|
223
|
+
use_gradient_checkpointing="unsloth",
|
|
224
|
+
)
|
|
225
|
+
|
|
226
|
+
# Define reward functions
|
|
227
|
+
def correctness_reward(completions, answer, **kwargs):
|
|
228
|
+
scores = []
|
|
229
|
+
for completion in completions:
|
|
230
|
+
match = re.search(r"<answer>(.*?)</answer>", completion, re.DOTALL)
|
|
231
|
+
extracted = match.group(1).strip() if match else ""
|
|
232
|
+
scores.append(1.0 if extracted == answer else 0.0)
|
|
233
|
+
return scores
|
|
234
|
+
|
|
235
|
+
def format_reward(completions, **kwargs):
|
|
236
|
+
pattern = r"<reasoning>.*?</reasoning>\s*<answer>.*?</answer>"
|
|
237
|
+
return [1.0 if re.search(pattern, c, re.DOTALL) else 0.0 for c in completions]
|
|
238
|
+
|
|
239
|
+
# Train
|
|
240
|
+
from trl import GRPOConfig, GRPOTrainer
|
|
241
|
+
|
|
242
|
+
training_args = GRPOConfig(
|
|
243
|
+
output_dir="./grpo-output",
|
|
244
|
+
per_device_train_batch_size=2,
|
|
245
|
+
gradient_accumulation_steps=4,
|
|
246
|
+
learning_rate=5e-6,
|
|
247
|
+
num_generations=8, # Rollouts per prompt
|
|
248
|
+
max_completion_length=512,
|
|
249
|
+
max_prompt_length=512,
|
|
250
|
+
max_steps=250,
|
|
251
|
+
temperature=1.0,
|
|
252
|
+
# RL algorithm variants
|
|
253
|
+
loss_type="dapo", # "grpo", "dr_grpo", "dapo", "bnpo"
|
|
254
|
+
epsilon=0.2,
|
|
255
|
+
epsilon_high=0.28, # DAPO upper clipping
|
|
256
|
+
scale_rewards="none", # Dr. GRPO: no reward scaling
|
|
257
|
+
optim="adamw_8bit",
|
|
258
|
+
report_to="none",
|
|
259
|
+
)
|
|
260
|
+
|
|
261
|
+
trainer = GRPOTrainer(
|
|
262
|
+
model=model,
|
|
263
|
+
processing_class=tokenizer,
|
|
264
|
+
args=training_args,
|
|
265
|
+
train_dataset=dataset,
|
|
266
|
+
reward_funcs=[correctness_reward, format_reward],
|
|
267
|
+
)
|
|
268
|
+
trainer.train()
|
|
269
|
+
|
|
270
|
+
# Save
|
|
271
|
+
model.save_lora("grpo_saved_lora")
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
### RL Algorithm Variants
|
|
275
|
+
|
|
276
|
+
| Algorithm | `loss_type` | Key Setting | Notes |
|
|
277
|
+
|-----------|-------------|-------------|-------|
|
|
278
|
+
| GRPO | `"grpo"` | Default | Standard group relative policy optimization |
|
|
279
|
+
| Dr. GRPO | `"dr_grpo"` | `scale_rewards="none"` | No reward normalization, more stable |
|
|
280
|
+
| DAPO | `"dapo"` | `epsilon_high=0.28` | Two-sided clipping, recommended default |
|
|
281
|
+
| BNPO | `"bnpo"` | — | Bounded negative policy optimization |
|
|
282
|
+
| GSPO | any | `importance_sampling_level="sequence"` | Sequence-level importance weighting (Qwen team) |
|
|
283
|
+
|
|
284
|
+
### Unsloth Standby (Memory-Efficient RL)
|
|
285
|
+
|
|
286
|
+
Set `os.environ["UNSLOTH_VLLM_STANDBY"] = "1"` before imports. This shares vLLM's weight space with training and repurposes KV cache memory during training — saving up to 60% VRAM. On H100 80GB: 16GB shared weights + 64GB multi-purpose space.
|
|
287
|
+
|
|
288
|
+
**Sources:** [docs/tutorial-grpo.md](docs/tutorial-grpo.md), [docs/advanced-rl.md](docs/advanced-rl.md), [docs/memory-efficient-rl.md](docs/memory-efficient-rl.md)
|
|
289
|
+
|
|
290
|
+
---
|
|
291
|
+
|
|
292
|
+
## Workflow 3: Vision Fine-Tuning
|
|
293
|
+
|
|
294
|
+
Use this for training vision-language models on image+text tasks.
|
|
295
|
+
|
|
296
|
+
### Implementation
|
|
297
|
+
|
|
298
|
+
```python
|
|
299
|
+
from unsloth import FastVisionModel
|
|
300
|
+
from trl import SFTTrainer, SFTConfig
|
|
301
|
+
from unsloth.trainer import UnslothVisionDataCollator
|
|
302
|
+
|
|
303
|
+
model, tokenizer = FastVisionModel.from_pretrained(
|
|
304
|
+
"unsloth/Qwen2.5-VL-7B-Instruct-bnb-4bit",
|
|
305
|
+
max_seq_length=2048,
|
|
306
|
+
load_in_4bit=True,
|
|
307
|
+
)
|
|
308
|
+
|
|
309
|
+
model = FastVisionModel.get_peft_model(
|
|
310
|
+
model,
|
|
311
|
+
finetune_vision_layers=True, # Toggle vision encoder training
|
|
312
|
+
finetune_language_layers=True,
|
|
313
|
+
finetune_attention_modules=True,
|
|
314
|
+
finetune_mlp_modules=True,
|
|
315
|
+
r=16, lora_alpha=16,
|
|
316
|
+
target_modules="all-linear",
|
|
317
|
+
use_gradient_checkpointing="unsloth",
|
|
318
|
+
)
|
|
319
|
+
|
|
320
|
+
# Dataset format: user content has text + image
|
|
321
|
+
def convert_to_conversation(sample):
|
|
322
|
+
return {"messages": [
|
|
323
|
+
{"role": "user", "content": [
|
|
324
|
+
{"type": "text", "text": "Describe this image."},
|
|
325
|
+
{"type": "image", "image": sample["image"]}]},
|
|
326
|
+
{"role": "assistant", "content": [
|
|
327
|
+
{"type": "text", "text": sample["caption"]}]},
|
|
328
|
+
]}
|
|
329
|
+
|
|
330
|
+
dataset = [convert_to_conversation(s) for s in raw_dataset] # Use list, not .map()
|
|
331
|
+
|
|
332
|
+
trainer = SFTTrainer(
|
|
333
|
+
model=model, tokenizer=tokenizer,
|
|
334
|
+
data_collator=UnslothVisionDataCollator(model, tokenizer),
|
|
335
|
+
train_dataset=dataset,
|
|
336
|
+
args=SFTConfig(output_dir="./vision-output", max_seq_length=2048,
|
|
337
|
+
per_device_train_batch_size=1, gradient_accumulation_steps=4),
|
|
338
|
+
)
|
|
339
|
+
trainer.train()
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
### Vision RL (GRPO with Images)
|
|
343
|
+
|
|
344
|
+
For VLM RL with vLLM, set `fast_inference=True` but `finetune_vision_layers=False` (vLLM limitation). Enable Standby for memory savings.
|
|
345
|
+
|
|
346
|
+
### Supported Vision Models
|
|
347
|
+
|
|
348
|
+
| Model | Sizes | Notes |
|
|
349
|
+
|-------|-------|-------|
|
|
350
|
+
| Qwen3-VL | 2B-235B | Best vLLM VLM support |
|
|
351
|
+
| Qwen2.5-VL | 3B-72B | Stable, well-tested |
|
|
352
|
+
| Gemma 3 | 4B-27B | Requires L4+ GPU (BF16 only in vLLM) |
|
|
353
|
+
| Llama 3.2 Vision | 11B, 90B | No vLLM LoRA support; use Unsloth inference |
|
|
354
|
+
| Pixtral | 12B | Mistral vision model |
|
|
50
355
|
|
|
51
|
-
|
|
52
|
-
Organized documentation extracted from official sources. These files contain:
|
|
53
|
-
- Detailed explanations
|
|
54
|
-
- Code examples with language annotations
|
|
55
|
-
- Links to original documentation
|
|
56
|
-
- Table of contents for quick navigation
|
|
356
|
+
**Sources:** [docs/vision-fine-tuning.md](docs/vision-fine-tuning.md), [docs/vision-rl.md](docs/vision-rl.md)
|
|
57
357
|
|
|
58
|
-
|
|
59
|
-
|
|
358
|
+
---
|
|
359
|
+
|
|
360
|
+
## Workflow 4: TTS Fine-Tuning
|
|
361
|
+
|
|
362
|
+
Use this for voice cloning, style adaptation, or speech-to-text fine-tuning.
|
|
363
|
+
|
|
364
|
+
```python
|
|
365
|
+
from unsloth import FastModel
|
|
366
|
+
from datasets import load_dataset, Audio
|
|
367
|
+
|
|
368
|
+
model, tokenizer = FastModel.from_pretrained(
|
|
369
|
+
"unsloth/orpheus-3b-0.1-ft",
|
|
370
|
+
max_seq_length=2048,
|
|
371
|
+
load_in_4bit=False, # 16-bit recommended for TTS
|
|
372
|
+
)
|
|
373
|
+
|
|
374
|
+
dataset = load_dataset("MrDragonFox/Elise", split="train")
|
|
375
|
+
dataset = dataset.cast_column("audio", Audio(sampling_rate=24000)) # 24kHz required
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
Orpheus supports emotional tags: `<laugh>`, `<sigh>`, `<cough>`, `<gasp>`, `<yawn>`, etc.
|
|
379
|
+
|
|
380
|
+
### TTS Models
|
|
381
|
+
|
|
382
|
+
| Model | Size | Type | Notes |
|
|
383
|
+
|-------|------|------|-------|
|
|
384
|
+
| Orpheus-TTS | 3B | Speech generation | Emotional cues, llama.cpp compatible |
|
|
385
|
+
| Sesame-CSM | 1B | Speech generation | Requires audio context per speaker |
|
|
386
|
+
| Spark-TTS | 0.5B | Speech generation | Smallest, fastest inference |
|
|
387
|
+
| Whisper Large V3 | ~1.5B | Speech-to-text | STT fine-tuning |
|
|
388
|
+
| Llasa-TTS | 1B | Speech generation | — |
|
|
389
|
+
| Oute-TTS | 1B | Speech generation | — |
|
|
390
|
+
|
|
391
|
+
**Sources:** [docs/tts-fine-tuning.md](docs/tts-fine-tuning.md)
|
|
392
|
+
|
|
393
|
+
---
|
|
394
|
+
|
|
395
|
+
## Model Selection
|
|
396
|
+
|
|
397
|
+
### Instruct vs Base Model
|
|
398
|
+
|
|
399
|
+
| Dataset Size | Recommendation |
|
|
400
|
+
|-------------|----------------|
|
|
401
|
+
| 1,000+ rows | Base model (more customizable) |
|
|
402
|
+
| 300-1,000 rows | Either base or instruct |
|
|
403
|
+
| < 300 rows | Instruct model (preserves built-in capabilities) |
|
|
404
|
+
|
|
405
|
+
### Model Name Conventions
|
|
406
|
+
|
|
407
|
+
| Suffix | Meaning |
|
|
408
|
+
|--------|---------|
|
|
409
|
+
| `unsloth-bnb-4bit` | Unsloth dynamic 4-bit quants (higher accuracy, slightly more VRAM) |
|
|
410
|
+
| `bnb-4bit` | Standard BitsAndBytes 4-bit quantization |
|
|
411
|
+
| No suffix | Original 16-bit or 8-bit format |
|
|
412
|
+
|
|
413
|
+
### VRAM Requirements
|
|
414
|
+
|
|
415
|
+
| Parameters | QLoRA (4-bit) | LoRA (16-bit) |
|
|
416
|
+
|-----------|---------------|---------------|
|
|
417
|
+
| 3B | 3.5 GB | 8 GB |
|
|
418
|
+
| 7-8B | 5-6 GB | 19-22 GB |
|
|
419
|
+
| 14B | 8.5 GB | 33 GB |
|
|
420
|
+
| 27B | 22 GB | 64 GB |
|
|
421
|
+
| 32B | 26 GB | 76 GB |
|
|
422
|
+
| 70B | 41 GB | 164 GB |
|
|
423
|
+
| 90B | 53 GB | 212 GB |
|
|
424
|
+
|
|
425
|
+
Common OOM fix: reduce `per_device_train_batch_size` to 1 or 2.
|
|
426
|
+
|
|
427
|
+
**Sources:** [docs/model-selection.md](docs/model-selection.md), [docs/requirements.md](docs/requirements.md)
|
|
428
|
+
|
|
429
|
+
---
|
|
430
|
+
|
|
431
|
+
## Key Hyperparameters
|
|
432
|
+
|
|
433
|
+
| Parameter | Default | Range | Notes |
|
|
434
|
+
|-----------|---------|-------|-------|
|
|
435
|
+
| `r` (rank) | 16 | 8-128 | Higher = more capacity, more VRAM. Start with 16-32 |
|
|
436
|
+
| `lora_alpha` | r | r to 2*r | Scaling factor. `W_hat = W + (alpha/r) * AB` |
|
|
437
|
+
| `lora_dropout` | 0 | 0-0.1 | Regularization. 0 is recommended default |
|
|
438
|
+
| `target_modules` | attention | `"all-linear"` or list | QLoRA-All gives best quality |
|
|
439
|
+
| `use_gradient_checkpointing` | — | `"unsloth"` | 30% less memory than standard checkpointing |
|
|
440
|
+
| `use_rslora` | False | True/False | Rank-stabilized LoRA: scales by `sqrt(r)` instead of `r` |
|
|
441
|
+
| `learning_rate` | 2e-4 | 1e-4 to 5e-4 | For LoRA/QLoRA SFT. Use 5e-6 for RL |
|
|
442
|
+
| `num_train_epochs` | 3 | 1-5 | More than 5 risks overfitting |
|
|
443
|
+
| `per_device_train_batch_size` | 2 | 1-8 | Reduce to 1 if OOM |
|
|
444
|
+
| `gradient_accumulation_steps` | 4 | 1-16 | Effective batch = batch_size * accumulation |
|
|
445
|
+
|
|
446
|
+
### Batch Size Equivalence
|
|
447
|
+
|
|
448
|
+
Unsloth's gradient accumulation fix makes all configurations equivalent:
|
|
60
449
|
|
|
61
|
-
|
|
62
|
-
|
|
450
|
+
```
|
|
451
|
+
Effective Batch Size = per_device_train_batch_size × gradient_accumulation_steps
|
|
452
|
+
# batch_size=2, accum=4 ≡ batch_size=1, accum=8 ≡ batch_size=8, accum=1
|
|
453
|
+
```
|
|
63
454
|
|
|
64
|
-
|
|
455
|
+
**Sources:** [docs/lora-hyperparameters.md](docs/lora-hyperparameters.md)
|
|
65
456
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
457
|
+
---
|
|
458
|
+
|
|
459
|
+
## Saving and Deployment
|
|
460
|
+
|
|
461
|
+
### Save Methods
|
|
462
|
+
|
|
463
|
+
```python
|
|
464
|
+
# LoRA adapter only (~6MB)
|
|
465
|
+
model.save_pretrained("lora_adapter")
|
|
466
|
+
|
|
467
|
+
# Merged 16-bit (for vLLM deployment)
|
|
468
|
+
model.save_pretrained_merged("model_16bit", tokenizer, save_method="merged_16bit")
|
|
469
|
+
|
|
470
|
+
# GGUF (for Ollama, llama.cpp, LM Studio)
|
|
471
|
+
model.save_pretrained_gguf("model_gguf", tokenizer, quantization_method="q4_k_m")
|
|
472
|
+
|
|
473
|
+
# Push to Hugging Face Hub
|
|
474
|
+
model.push_to_hub_merged("username/model", tokenizer, save_method="merged_16bit", token="...")
|
|
475
|
+
model.push_to_hub_gguf("username/model", tokenizer, quantization_method="q4_k_m", token="...")
|
|
476
|
+
```
|
|
70
477
|
|
|
71
|
-
|
|
478
|
+
### GGUF Quantization Options
|
|
72
479
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
480
|
+
| Method | Bits | Quality | Speed | Size | Notes |
|
|
481
|
+
|--------|------|---------|-------|------|-------|
|
|
482
|
+
| `f16` | 16 | Best | Slow | Large | 100% accuracy, no quantization |
|
|
483
|
+
| `q8_0` | 8 | Very High | Good | Medium | Generally acceptable |
|
|
484
|
+
| `q5_k_m` | 5 | High | Fast | Small | Good balance |
|
|
485
|
+
| `q4_k_m` | 4 | Good | Fast | Small | **Recommended** for most use cases |
|
|
486
|
+
| `q3_k_m` | 3 | OK | Fastest | Smallest | For very limited VRAM |
|
|
487
|
+
| `q2_k` | 2 | Lower | Fastest | Tiny | Maximum compression |
|
|
76
488
|
|
|
77
|
-
|
|
489
|
+
### Deployment Targets
|
|
490
|
+
|
|
491
|
+
| Platform | Save Method | Command |
|
|
492
|
+
|----------|-------------|---------|
|
|
493
|
+
| Ollama | `save_pretrained_gguf` | Auto-creates Modelfile, then `ollama create` |
|
|
494
|
+
| vLLM | `save_pretrained_merged("...", save_method="merged_16bit")` | `vllm serve ./model` |
|
|
495
|
+
| llama.cpp | `save_pretrained_gguf` or manual GGUF | `./llama-cli -m model.gguf` |
|
|
496
|
+
| LM Studio | `save_pretrained_gguf` | Import GGUF file |
|
|
497
|
+
| Hugging Face | `push_to_hub_merged` or `push_to_hub_gguf` | Online inference |
|
|
498
|
+
|
|
499
|
+
### Inference with Unsloth (2x faster)
|
|
500
|
+
|
|
501
|
+
```python
|
|
502
|
+
from unsloth import FastLanguageModel
|
|
503
|
+
model, tokenizer = FastLanguageModel.from_pretrained("lora_adapter", max_seq_length=2048, load_in_4bit=True)
|
|
504
|
+
FastLanguageModel.for_inference(model) # Enable 2x faster inference
|
|
505
|
+
|
|
506
|
+
inputs = tokenizer("What is machine learning?", return_tensors="pt").to("cuda")
|
|
507
|
+
output = model.generate(**inputs, max_new_tokens=256)
|
|
508
|
+
print(tokenizer.decode(output[0], skip_special_tokens=True))
|
|
509
|
+
```
|
|
510
|
+
|
|
511
|
+
**Sources:** [docs/saving-to-gguf.md](docs/saving-to-gguf.md), [docs/saving-to-ollama.md](docs/saving-to-ollama.md), [docs/vllm-guide.md](docs/vllm-guide.md), [docs/inference.md](docs/inference.md)
|
|
512
|
+
|
|
513
|
+
---
|
|
78
514
|
|
|
515
|
+
## Common Issues
|
|
79
516
|
|
|
517
|
+
| Problem | Solution |
|
|
518
|
+
|---------|----------|
|
|
519
|
+
| CUDA OOM during training | Reduce `per_device_train_batch_size` to 1. Enable `use_gradient_checkpointing="unsloth"`. Use QLoRA (`load_in_4bit=True`). |
|
|
520
|
+
| Poor results after GGUF/Ollama export | Use the SAME chat template for training and inference. Check `eos_token`. Use conversational notebooks to force template. |
|
|
521
|
+
| GGUF/vLLM 16-bit save crashes | Reduce `maximum_memory_usage` to 0.5: `model.save_pretrained(..., maximum_memory_usage=0.5)` |
|
|
522
|
+
| Overfitting (val loss increases) | Reduce epochs/LR, increase weight_decay/lora_dropout, add more data, use early stopping |
|
|
523
|
+
| Underfitting (loss stays high) | Increase rank, alpha, epochs, or LR. Decrease batch size to 1. Use domain-relevant data. |
|
|
524
|
+
| All labels are -100 | `train_on_responses_only` has wrong instruction/response parts for your model. Check template. |
|
|
525
|
+
| RL OOM with vLLM | Enable Standby: `os.environ["UNSLOTH_VLLM_STANDBY"] = "1"`. Reduce `gpu_memory_utilization`. |
|
|
526
|
+
| `add_new_tokens` breaks LoRA | Must call `add_new_tokens(model, tokenizer, ...)` BEFORE `get_peft_model()` |
|
|
527
|
+
| CUDA device-side assert | Set `os.environ["UNSLOTH_COMPILE_DISABLE"] = "1"` and `os.environ["UNSLOTH_DISABLE_FAST_GENERATION"] = "1"` |
|
|
528
|
+
| New model not supported | Set `trust_remote_code=True` and `unsloth_force_compile=True` — works with any `transformers`-compatible model |
|
|
529
|
+
| Downloads stuck at 90-95% | Set `os.environ["UNSLOTH_STABLE_DOWNLOADS"] = "1"` before imports |
|
|
530
|
+
| torch.compile slow startup | Normal — takes ~5 minutes to warm up. Measure throughput after warmup. Disable with `UNSLOTH_COMPILE_DISABLE=1`. |
|
|
531
|
+
|
|
532
|
+
**Sources:** [docs/troubleshooting-faq.md](docs/troubleshooting-faq.md), [docs/troubleshooting-inference.md](docs/troubleshooting-inference.md)
|
|
533
|
+
|
|
534
|
+
---
|
|
535
|
+
|
|
536
|
+
## Best Practices
|
|
537
|
+
|
|
538
|
+
1. **Start with QLoRA 4-bit** (`load_in_4bit=True`) — fits most models on consumer GPUs with minimal accuracy loss
|
|
539
|
+
2. **Use `unsloth-bnb-4bit` model variants** for higher accuracy than standard 4-bit quants
|
|
540
|
+
3. **Set `use_gradient_checkpointing="unsloth"`** — 30% less VRAM than standard gradient checkpointing
|
|
541
|
+
4. **Use `target_modules="all-linear"`** for best quality, or specify attention+MLP modules
|
|
542
|
+
5. **Start with rank 16-32**, increase only if quality is insufficient
|
|
543
|
+
6. **Set `lora_alpha = r` or `2*r`** — higher alpha increases effective learning rate
|
|
544
|
+
7. **Enable packing** (`packing=True` in SFTConfig) for 2-5x faster training with proper attention masking
|
|
545
|
+
8. **Use `train_on_responses_only`** to avoid training on user prompts
|
|
546
|
+
9. **For RL, enable Standby** (`UNSLOTH_VLLM_STANDBY=1`) and `fast_inference=True`
|
|
547
|
+
10. **Use DAPO loss** (`loss_type="dapo"`) as the default RL algorithm — most stable
|
|
548
|
+
11. **Always use the same chat template** for training and inference to avoid gibberish output
|
|
549
|
+
12. **Consider FP8** (`load_in_fp8=True`) on Ampere+ GPUs for 60% less VRAM with ~equal accuracy
|
|
550
|
+
13. **Split dataset** into train/test and enable `eval_strategy="steps"` for monitoring
|
|
551
|
+
14. **Save adapters frequently** — they're tiny (~6MB) and easy to rollback
|
|
552
|
+
|
|
553
|
+
## References
|
|
554
|
+
|
|
555
|
+
### Core Training
|
|
556
|
+
- [docs/overview.md](docs/overview.md) — Features and capabilities overview
|
|
557
|
+
- [docs/datasets.md](docs/datasets.md) — Dataset formatting and preparation
|
|
558
|
+
- [docs/chat-templates.md](docs/chat-templates.md) — Chat template configuration
|
|
559
|
+
- [docs/lora-hyperparameters.md](docs/lora-hyperparameters.md) — LoRA parameter tuning guide
|
|
560
|
+
- [docs/kernels-packing.md](docs/kernels-packing.md) — Custom kernels and packing optimizations
|
|
561
|
+
|
|
562
|
+
### Reinforcement Learning
|
|
563
|
+
- [docs/tutorial-grpo.md](docs/tutorial-grpo.md) — Step-by-step GRPO tutorial
|
|
564
|
+
- [docs/advanced-rl.md](docs/advanced-rl.md) — Advanced RL parameters and batching
|
|
565
|
+
- [docs/memory-efficient-rl.md](docs/memory-efficient-rl.md) — Standby and memory optimizations
|
|
566
|
+
- [docs/fp8-rl.md](docs/fp8-rl.md) — FP8 precision RL training
|
|
567
|
+
- [docs/fp16-vs-bf16.md](docs/fp16-vs-bf16.md) — Precision comparison for RL stability
|
|
568
|
+
- [docs/reward-hacking.md](docs/reward-hacking.md) — Counter-measures for reward hacking
|
|
569
|
+
|
|
570
|
+
### Specialized Models
|
|
571
|
+
- [docs/vision-fine-tuning.md](docs/vision-fine-tuning.md) — Vision-language model training
|
|
572
|
+
- [docs/vision-rl.md](docs/vision-rl.md) — VLM RL with GRPO/GSPO
|
|
573
|
+
- [docs/tts-fine-tuning.md](docs/tts-fine-tuning.md) — Text-to-speech fine-tuning
|
|
574
|
+
- [docs/tool-calling.md](docs/tool-calling.md) — Tool/function calling training
|
|
575
|
+
|
|
576
|
+
### Deployment & Inference
|
|
577
|
+
- [docs/saving-to-gguf.md](docs/saving-to-gguf.md) — GGUF export and quantization
|
|
578
|
+
- [docs/saving-to-ollama.md](docs/saving-to-ollama.md) — Ollama integration
|
|
579
|
+
- [docs/vllm-guide.md](docs/vllm-guide.md) — vLLM deployment
|
|
580
|
+
- [docs/inference.md](docs/inference.md) — 2x faster native inference
|
|
581
|
+
- [docs/lora-hot-swapping.md](docs/lora-hot-swapping.md) — Runtime adapter switching
|
|
582
|
+
|
|
583
|
+
### Infrastructure
|
|
584
|
+
- [docs/requirements.md](docs/requirements.md) — System and VRAM requirements
|
|
585
|
+
- [docs/model-selection.md](docs/model-selection.md) — Choosing the right model
|
|
586
|
+
- [docs/models.md](docs/models.md) — Full model catalog (300+ models)
|
|
587
|
+
- [docs/multi-gpu-ddp.md](docs/multi-gpu-ddp.md) — Multi-GPU distributed training
|
|
588
|
+
- [docs/installation-pip.md](docs/installation-pip.md) — pip installation guide
|
|
589
|
+
- [docs/installation-docker.md](docs/installation-docker.md) — Docker setup
|
|
590
|
+
|
|
591
|
+
## Resources
|
|
80
592
|
|
|
593
|
+
- **GitHub**: https://github.com/unslothai/unsloth
|
|
594
|
+
- **Documentation**: https://docs.unsloth.ai
|
|
595
|
+
- **Hugging Face**: https://huggingface.co/unsloth
|
|
596
|
+
- **Docker Hub**: https://hub.docker.com/r/unsloth/unsloth
|
|
597
|
+
- **Notebooks**: https://github.com/unslothai/notebooks
|
|
598
|
+
- **Discord**: https://discord.gg/unsloth
|