@synsci/cli-darwin-x64 1.1.49
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/accelerate/SKILL.md +332 -0
- package/bin/skills/accelerate/references/custom-plugins.md +453 -0
- package/bin/skills/accelerate/references/megatron-integration.md +489 -0
- package/bin/skills/accelerate/references/performance.md +525 -0
- package/bin/skills/audiocraft/SKILL.md +564 -0
- package/bin/skills/audiocraft/references/advanced-usage.md +666 -0
- package/bin/skills/audiocraft/references/troubleshooting.md +504 -0
- package/bin/skills/autogpt/SKILL.md +403 -0
- package/bin/skills/autogpt/references/advanced-usage.md +535 -0
- package/bin/skills/autogpt/references/troubleshooting.md +420 -0
- package/bin/skills/awq/SKILL.md +310 -0
- package/bin/skills/awq/references/advanced-usage.md +324 -0
- package/bin/skills/awq/references/troubleshooting.md +344 -0
- package/bin/skills/axolotl/SKILL.md +158 -0
- package/bin/skills/axolotl/references/api.md +5548 -0
- package/bin/skills/axolotl/references/dataset-formats.md +1029 -0
- package/bin/skills/axolotl/references/index.md +15 -0
- package/bin/skills/axolotl/references/other.md +3563 -0
- package/bin/skills/bigcode-evaluation-harness/SKILL.md +405 -0
- package/bin/skills/bigcode-evaluation-harness/references/benchmarks.md +393 -0
- package/bin/skills/bigcode-evaluation-harness/references/custom-tasks.md +424 -0
- package/bin/skills/bigcode-evaluation-harness/references/issues.md +394 -0
- package/bin/skills/bitsandbytes/SKILL.md +411 -0
- package/bin/skills/bitsandbytes/references/memory-optimization.md +521 -0
- package/bin/skills/bitsandbytes/references/qlora-training.md +521 -0
- package/bin/skills/bitsandbytes/references/quantization-formats.md +447 -0
- package/bin/skills/blip-2/SKILL.md +564 -0
- package/bin/skills/blip-2/references/advanced-usage.md +680 -0
- package/bin/skills/blip-2/references/troubleshooting.md +526 -0
- package/bin/skills/chroma/SKILL.md +406 -0
- package/bin/skills/chroma/references/integration.md +38 -0
- package/bin/skills/clip/SKILL.md +253 -0
- package/bin/skills/clip/references/applications.md +207 -0
- package/bin/skills/constitutional-ai/SKILL.md +290 -0
- package/bin/skills/crewai/SKILL.md +498 -0
- package/bin/skills/crewai/references/flows.md +438 -0
- package/bin/skills/crewai/references/tools.md +429 -0
- package/bin/skills/crewai/references/troubleshooting.md +480 -0
- package/bin/skills/deepspeed/SKILL.md +141 -0
- package/bin/skills/deepspeed/references/08.md +17 -0
- package/bin/skills/deepspeed/references/09.md +173 -0
- package/bin/skills/deepspeed/references/2020.md +378 -0
- package/bin/skills/deepspeed/references/2023.md +279 -0
- package/bin/skills/deepspeed/references/assets.md +179 -0
- package/bin/skills/deepspeed/references/index.md +35 -0
- package/bin/skills/deepspeed/references/mii.md +118 -0
- package/bin/skills/deepspeed/references/other.md +1191 -0
- package/bin/skills/deepspeed/references/tutorials.md +6554 -0
- package/bin/skills/dspy/SKILL.md +590 -0
- package/bin/skills/dspy/references/examples.md +663 -0
- package/bin/skills/dspy/references/modules.md +475 -0
- package/bin/skills/dspy/references/optimizers.md +566 -0
- package/bin/skills/faiss/SKILL.md +221 -0
- package/bin/skills/faiss/references/index_types.md +280 -0
- package/bin/skills/flash-attention/SKILL.md +367 -0
- package/bin/skills/flash-attention/references/benchmarks.md +215 -0
- package/bin/skills/flash-attention/references/transformers-integration.md +293 -0
- package/bin/skills/gguf/SKILL.md +427 -0
- package/bin/skills/gguf/references/advanced-usage.md +504 -0
- package/bin/skills/gguf/references/troubleshooting.md +442 -0
- package/bin/skills/gptq/SKILL.md +450 -0
- package/bin/skills/gptq/references/calibration.md +337 -0
- package/bin/skills/gptq/references/integration.md +129 -0
- package/bin/skills/gptq/references/troubleshooting.md +95 -0
- package/bin/skills/grpo-rl-training/README.md +97 -0
- package/bin/skills/grpo-rl-training/SKILL.md +572 -0
- package/bin/skills/grpo-rl-training/examples/reward_functions_library.py +393 -0
- package/bin/skills/grpo-rl-training/templates/basic_grpo_training.py +228 -0
- package/bin/skills/guidance/SKILL.md +572 -0
- package/bin/skills/guidance/references/backends.md +554 -0
- package/bin/skills/guidance/references/constraints.md +674 -0
- package/bin/skills/guidance/references/examples.md +767 -0
- package/bin/skills/hqq/SKILL.md +445 -0
- package/bin/skills/hqq/references/advanced-usage.md +528 -0
- package/bin/skills/hqq/references/troubleshooting.md +503 -0
- package/bin/skills/hugging-face-cli/SKILL.md +191 -0
- package/bin/skills/hugging-face-cli/references/commands.md +954 -0
- package/bin/skills/hugging-face-cli/references/examples.md +374 -0
- package/bin/skills/hugging-face-datasets/SKILL.md +547 -0
- package/bin/skills/hugging-face-datasets/examples/diverse_training_examples.json +239 -0
- package/bin/skills/hugging-face-datasets/examples/system_prompt_template.txt +196 -0
- package/bin/skills/hugging-face-datasets/examples/training_examples.json +176 -0
- package/bin/skills/hugging-face-datasets/scripts/dataset_manager.py +522 -0
- package/bin/skills/hugging-face-datasets/scripts/sql_manager.py +844 -0
- package/bin/skills/hugging-face-datasets/templates/chat.json +55 -0
- package/bin/skills/hugging-face-datasets/templates/classification.json +62 -0
- package/bin/skills/hugging-face-datasets/templates/completion.json +51 -0
- package/bin/skills/hugging-face-datasets/templates/custom.json +75 -0
- package/bin/skills/hugging-face-datasets/templates/qa.json +54 -0
- package/bin/skills/hugging-face-datasets/templates/tabular.json +81 -0
- package/bin/skills/hugging-face-evaluation/SKILL.md +656 -0
- package/bin/skills/hugging-face-evaluation/examples/USAGE_EXAMPLES.md +382 -0
- package/bin/skills/hugging-face-evaluation/examples/artificial_analysis_to_hub.py +141 -0
- package/bin/skills/hugging-face-evaluation/examples/example_readme_tables.md +135 -0
- package/bin/skills/hugging-face-evaluation/examples/metric_mapping.json +50 -0
- package/bin/skills/hugging-face-evaluation/requirements.txt +20 -0
- package/bin/skills/hugging-face-evaluation/scripts/evaluation_manager.py +1374 -0
- package/bin/skills/hugging-face-evaluation/scripts/inspect_eval_uv.py +104 -0
- package/bin/skills/hugging-face-evaluation/scripts/inspect_vllm_uv.py +317 -0
- package/bin/skills/hugging-face-evaluation/scripts/lighteval_vllm_uv.py +303 -0
- package/bin/skills/hugging-face-evaluation/scripts/run_eval_job.py +98 -0
- package/bin/skills/hugging-face-evaluation/scripts/run_vllm_eval_job.py +331 -0
- package/bin/skills/hugging-face-evaluation/scripts/test_extraction.py +206 -0
- package/bin/skills/hugging-face-jobs/SKILL.md +1041 -0
- package/bin/skills/hugging-face-jobs/index.html +216 -0
- package/bin/skills/hugging-face-jobs/references/hardware_guide.md +336 -0
- package/bin/skills/hugging-face-jobs/references/hub_saving.md +352 -0
- package/bin/skills/hugging-face-jobs/references/token_usage.md +546 -0
- package/bin/skills/hugging-face-jobs/references/troubleshooting.md +475 -0
- package/bin/skills/hugging-face-jobs/scripts/cot-self-instruct.py +718 -0
- package/bin/skills/hugging-face-jobs/scripts/finepdfs-stats.py +546 -0
- package/bin/skills/hugging-face-jobs/scripts/generate-responses.py +587 -0
- package/bin/skills/hugging-face-model-trainer/SKILL.md +711 -0
- package/bin/skills/hugging-face-model-trainer/references/gguf_conversion.md +296 -0
- package/bin/skills/hugging-face-model-trainer/references/hardware_guide.md +283 -0
- package/bin/skills/hugging-face-model-trainer/references/hub_saving.md +364 -0
- package/bin/skills/hugging-face-model-trainer/references/reliability_principles.md +371 -0
- package/bin/skills/hugging-face-model-trainer/references/trackio_guide.md +189 -0
- package/bin/skills/hugging-face-model-trainer/references/training_methods.md +150 -0
- package/bin/skills/hugging-face-model-trainer/references/training_patterns.md +203 -0
- package/bin/skills/hugging-face-model-trainer/references/troubleshooting.md +282 -0
- package/bin/skills/hugging-face-model-trainer/scripts/convert_to_gguf.py +424 -0
- package/bin/skills/hugging-face-model-trainer/scripts/dataset_inspector.py +417 -0
- package/bin/skills/hugging-face-model-trainer/scripts/estimate_cost.py +150 -0
- package/bin/skills/hugging-face-model-trainer/scripts/train_dpo_example.py +106 -0
- package/bin/skills/hugging-face-model-trainer/scripts/train_grpo_example.py +89 -0
- package/bin/skills/hugging-face-model-trainer/scripts/train_sft_example.py +122 -0
- package/bin/skills/hugging-face-paper-publisher/SKILL.md +627 -0
- package/bin/skills/hugging-face-paper-publisher/examples/example_usage.md +327 -0
- package/bin/skills/hugging-face-paper-publisher/references/quick_reference.md +216 -0
- package/bin/skills/hugging-face-paper-publisher/scripts/paper_manager.py +508 -0
- package/bin/skills/hugging-face-paper-publisher/templates/arxiv.md +299 -0
- package/bin/skills/hugging-face-paper-publisher/templates/ml-report.md +358 -0
- package/bin/skills/hugging-face-paper-publisher/templates/modern.md +319 -0
- package/bin/skills/hugging-face-paper-publisher/templates/standard.md +201 -0
- package/bin/skills/hugging-face-tool-builder/SKILL.md +115 -0
- package/bin/skills/hugging-face-tool-builder/references/baseline_hf_api.py +57 -0
- package/bin/skills/hugging-face-tool-builder/references/baseline_hf_api.sh +40 -0
- package/bin/skills/hugging-face-tool-builder/references/baseline_hf_api.tsx +57 -0
- package/bin/skills/hugging-face-tool-builder/references/find_models_by_paper.sh +230 -0
- package/bin/skills/hugging-face-tool-builder/references/hf_enrich_models.sh +96 -0
- package/bin/skills/hugging-face-tool-builder/references/hf_model_card_frontmatter.sh +188 -0
- package/bin/skills/hugging-face-tool-builder/references/hf_model_papers_auth.sh +171 -0
- package/bin/skills/hugging-face-trackio/SKILL.md +65 -0
- package/bin/skills/hugging-face-trackio/references/logging_metrics.md +206 -0
- package/bin/skills/hugging-face-trackio/references/retrieving_metrics.md +223 -0
- package/bin/skills/huggingface-tokenizers/SKILL.md +516 -0
- package/bin/skills/huggingface-tokenizers/references/algorithms.md +653 -0
- package/bin/skills/huggingface-tokenizers/references/integration.md +637 -0
- package/bin/skills/huggingface-tokenizers/references/pipeline.md +723 -0
- package/bin/skills/huggingface-tokenizers/references/training.md +565 -0
- package/bin/skills/instructor/SKILL.md +740 -0
- package/bin/skills/instructor/references/examples.md +107 -0
- package/bin/skills/instructor/references/providers.md +70 -0
- package/bin/skills/instructor/references/validation.md +606 -0
- package/bin/skills/knowledge-distillation/SKILL.md +458 -0
- package/bin/skills/knowledge-distillation/references/minillm.md +334 -0
- package/bin/skills/lambda-labs/SKILL.md +545 -0
- package/bin/skills/lambda-labs/references/advanced-usage.md +611 -0
- package/bin/skills/lambda-labs/references/troubleshooting.md +530 -0
- package/bin/skills/langchain/SKILL.md +480 -0
- package/bin/skills/langchain/references/agents.md +499 -0
- package/bin/skills/langchain/references/integration.md +562 -0
- package/bin/skills/langchain/references/rag.md +600 -0
- package/bin/skills/langsmith/SKILL.md +422 -0
- package/bin/skills/langsmith/references/advanced-usage.md +548 -0
- package/bin/skills/langsmith/references/troubleshooting.md +537 -0
- package/bin/skills/litgpt/SKILL.md +469 -0
- package/bin/skills/litgpt/references/custom-models.md +568 -0
- package/bin/skills/litgpt/references/distributed-training.md +451 -0
- package/bin/skills/litgpt/references/supported-models.md +336 -0
- package/bin/skills/litgpt/references/training-recipes.md +619 -0
- package/bin/skills/llama-cpp/SKILL.md +258 -0
- package/bin/skills/llama-cpp/references/optimization.md +89 -0
- package/bin/skills/llama-cpp/references/quantization.md +213 -0
- package/bin/skills/llama-cpp/references/server.md +125 -0
- package/bin/skills/llama-factory/SKILL.md +80 -0
- package/bin/skills/llama-factory/references/_images.md +23 -0
- package/bin/skills/llama-factory/references/advanced.md +1055 -0
- package/bin/skills/llama-factory/references/getting_started.md +349 -0
- package/bin/skills/llama-factory/references/index.md +19 -0
- package/bin/skills/llama-factory/references/other.md +31 -0
- package/bin/skills/llamaguard/SKILL.md +337 -0
- package/bin/skills/llamaindex/SKILL.md +569 -0
- package/bin/skills/llamaindex/references/agents.md +83 -0
- package/bin/skills/llamaindex/references/data_connectors.md +108 -0
- package/bin/skills/llamaindex/references/query_engines.md +406 -0
- package/bin/skills/llava/SKILL.md +304 -0
- package/bin/skills/llava/references/training.md +197 -0
- package/bin/skills/lm-evaluation-harness/SKILL.md +490 -0
- package/bin/skills/lm-evaluation-harness/references/api-evaluation.md +490 -0
- package/bin/skills/lm-evaluation-harness/references/benchmark-guide.md +488 -0
- package/bin/skills/lm-evaluation-harness/references/custom-tasks.md +602 -0
- package/bin/skills/lm-evaluation-harness/references/distributed-eval.md +519 -0
- package/bin/skills/long-context/SKILL.md +536 -0
- package/bin/skills/long-context/references/extension_methods.md +468 -0
- package/bin/skills/long-context/references/fine_tuning.md +611 -0
- package/bin/skills/long-context/references/rope.md +402 -0
- package/bin/skills/mamba/SKILL.md +260 -0
- package/bin/skills/mamba/references/architecture-details.md +206 -0
- package/bin/skills/mamba/references/benchmarks.md +255 -0
- package/bin/skills/mamba/references/training-guide.md +388 -0
- package/bin/skills/megatron-core/SKILL.md +366 -0
- package/bin/skills/megatron-core/references/benchmarks.md +249 -0
- package/bin/skills/megatron-core/references/parallelism-guide.md +404 -0
- package/bin/skills/megatron-core/references/production-examples.md +473 -0
- package/bin/skills/megatron-core/references/training-recipes.md +547 -0
- package/bin/skills/miles/SKILL.md +315 -0
- package/bin/skills/miles/references/api-reference.md +141 -0
- package/bin/skills/miles/references/troubleshooting.md +352 -0
- package/bin/skills/mlflow/SKILL.md +704 -0
- package/bin/skills/mlflow/references/deployment.md +744 -0
- package/bin/skills/mlflow/references/model-registry.md +770 -0
- package/bin/skills/mlflow/references/tracking.md +680 -0
- package/bin/skills/modal/SKILL.md +341 -0
- package/bin/skills/modal/references/advanced-usage.md +503 -0
- package/bin/skills/modal/references/troubleshooting.md +494 -0
- package/bin/skills/model-merging/SKILL.md +539 -0
- package/bin/skills/model-merging/references/evaluation.md +462 -0
- package/bin/skills/model-merging/references/examples.md +428 -0
- package/bin/skills/model-merging/references/methods.md +352 -0
- package/bin/skills/model-pruning/SKILL.md +495 -0
- package/bin/skills/model-pruning/references/wanda.md +347 -0
- package/bin/skills/moe-training/SKILL.md +526 -0
- package/bin/skills/moe-training/references/architectures.md +432 -0
- package/bin/skills/moe-training/references/inference.md +348 -0
- package/bin/skills/moe-training/references/training.md +425 -0
- package/bin/skills/nanogpt/SKILL.md +290 -0
- package/bin/skills/nanogpt/references/architecture.md +382 -0
- package/bin/skills/nanogpt/references/data.md +476 -0
- package/bin/skills/nanogpt/references/training.md +564 -0
- package/bin/skills/nemo-curator/SKILL.md +383 -0
- package/bin/skills/nemo-curator/references/deduplication.md +87 -0
- package/bin/skills/nemo-curator/references/filtering.md +102 -0
- package/bin/skills/nemo-evaluator/SKILL.md +494 -0
- package/bin/skills/nemo-evaluator/references/adapter-system.md +340 -0
- package/bin/skills/nemo-evaluator/references/configuration.md +447 -0
- package/bin/skills/nemo-evaluator/references/custom-benchmarks.md +315 -0
- package/bin/skills/nemo-evaluator/references/execution-backends.md +361 -0
- package/bin/skills/nemo-guardrails/SKILL.md +297 -0
- package/bin/skills/nnsight/SKILL.md +436 -0
- package/bin/skills/nnsight/references/README.md +78 -0
- package/bin/skills/nnsight/references/api.md +344 -0
- package/bin/skills/nnsight/references/tutorials.md +300 -0
- package/bin/skills/openrlhf/SKILL.md +249 -0
- package/bin/skills/openrlhf/references/algorithm-comparison.md +404 -0
- package/bin/skills/openrlhf/references/custom-rewards.md +530 -0
- package/bin/skills/openrlhf/references/hybrid-engine.md +287 -0
- package/bin/skills/openrlhf/references/multi-node-training.md +454 -0
- package/bin/skills/outlines/SKILL.md +652 -0
- package/bin/skills/outlines/references/backends.md +615 -0
- package/bin/skills/outlines/references/examples.md +773 -0
- package/bin/skills/outlines/references/json_generation.md +652 -0
- package/bin/skills/peft/SKILL.md +431 -0
- package/bin/skills/peft/references/advanced-usage.md +514 -0
- package/bin/skills/peft/references/troubleshooting.md +480 -0
- package/bin/skills/phoenix/SKILL.md +475 -0
- package/bin/skills/phoenix/references/advanced-usage.md +619 -0
- package/bin/skills/phoenix/references/troubleshooting.md +538 -0
- package/bin/skills/pinecone/SKILL.md +358 -0
- package/bin/skills/pinecone/references/deployment.md +181 -0
- package/bin/skills/pytorch-fsdp/SKILL.md +126 -0
- package/bin/skills/pytorch-fsdp/references/index.md +7 -0
- package/bin/skills/pytorch-fsdp/references/other.md +4249 -0
- package/bin/skills/pytorch-lightning/SKILL.md +346 -0
- package/bin/skills/pytorch-lightning/references/callbacks.md +436 -0
- package/bin/skills/pytorch-lightning/references/distributed.md +490 -0
- package/bin/skills/pytorch-lightning/references/hyperparameter-tuning.md +556 -0
- package/bin/skills/pyvene/SKILL.md +473 -0
- package/bin/skills/pyvene/references/README.md +73 -0
- package/bin/skills/pyvene/references/api.md +383 -0
- package/bin/skills/pyvene/references/tutorials.md +376 -0
- package/bin/skills/qdrant/SKILL.md +493 -0
- package/bin/skills/qdrant/references/advanced-usage.md +648 -0
- package/bin/skills/qdrant/references/troubleshooting.md +631 -0
- package/bin/skills/ray-data/SKILL.md +326 -0
- package/bin/skills/ray-data/references/integration.md +82 -0
- package/bin/skills/ray-data/references/transformations.md +83 -0
- package/bin/skills/ray-train/SKILL.md +406 -0
- package/bin/skills/ray-train/references/multi-node.md +628 -0
- package/bin/skills/rwkv/SKILL.md +260 -0
- package/bin/skills/rwkv/references/architecture-details.md +344 -0
- package/bin/skills/rwkv/references/rwkv7.md +386 -0
- package/bin/skills/rwkv/references/state-management.md +369 -0
- package/bin/skills/saelens/SKILL.md +386 -0
- package/bin/skills/saelens/references/README.md +70 -0
- package/bin/skills/saelens/references/api.md +333 -0
- package/bin/skills/saelens/references/tutorials.md +318 -0
- package/bin/skills/segment-anything/SKILL.md +500 -0
- package/bin/skills/segment-anything/references/advanced-usage.md +589 -0
- package/bin/skills/segment-anything/references/troubleshooting.md +484 -0
- package/bin/skills/sentence-transformers/SKILL.md +255 -0
- package/bin/skills/sentence-transformers/references/models.md +123 -0
- package/bin/skills/sentencepiece/SKILL.md +235 -0
- package/bin/skills/sentencepiece/references/algorithms.md +200 -0
- package/bin/skills/sentencepiece/references/training.md +304 -0
- package/bin/skills/sglang/SKILL.md +442 -0
- package/bin/skills/sglang/references/deployment.md +490 -0
- package/bin/skills/sglang/references/radix-attention.md +413 -0
- package/bin/skills/sglang/references/structured-generation.md +541 -0
- package/bin/skills/simpo/SKILL.md +219 -0
- package/bin/skills/simpo/references/datasets.md +478 -0
- package/bin/skills/simpo/references/hyperparameters.md +452 -0
- package/bin/skills/simpo/references/loss-functions.md +350 -0
- package/bin/skills/skypilot/SKILL.md +509 -0
- package/bin/skills/skypilot/references/advanced-usage.md +491 -0
- package/bin/skills/skypilot/references/troubleshooting.md +570 -0
- package/bin/skills/slime/SKILL.md +464 -0
- package/bin/skills/slime/references/api-reference.md +392 -0
- package/bin/skills/slime/references/troubleshooting.md +386 -0
- package/bin/skills/speculative-decoding/SKILL.md +467 -0
- package/bin/skills/speculative-decoding/references/lookahead.md +309 -0
- package/bin/skills/speculative-decoding/references/medusa.md +350 -0
- package/bin/skills/stable-diffusion/SKILL.md +519 -0
- package/bin/skills/stable-diffusion/references/advanced-usage.md +716 -0
- package/bin/skills/stable-diffusion/references/troubleshooting.md +555 -0
- package/bin/skills/tensorboard/SKILL.md +629 -0
- package/bin/skills/tensorboard/references/integrations.md +638 -0
- package/bin/skills/tensorboard/references/profiling.md +545 -0
- package/bin/skills/tensorboard/references/visualization.md +620 -0
- package/bin/skills/tensorrt-llm/SKILL.md +187 -0
- package/bin/skills/tensorrt-llm/references/multi-gpu.md +298 -0
- package/bin/skills/tensorrt-llm/references/optimization.md +242 -0
- package/bin/skills/tensorrt-llm/references/serving.md +470 -0
- package/bin/skills/tinker/SKILL.md +362 -0
- package/bin/skills/tinker/references/api-reference.md +168 -0
- package/bin/skills/tinker/references/getting-started.md +157 -0
- package/bin/skills/tinker/references/loss-functions.md +163 -0
- package/bin/skills/tinker/references/models-and-lora.md +139 -0
- package/bin/skills/tinker/references/recipes.md +280 -0
- package/bin/skills/tinker/references/reinforcement-learning.md +212 -0
- package/bin/skills/tinker/references/rendering.md +243 -0
- package/bin/skills/tinker/references/supervised-learning.md +232 -0
- package/bin/skills/tinker-training-cost/SKILL.md +187 -0
- package/bin/skills/tinker-training-cost/scripts/calculate_cost.py +123 -0
- package/bin/skills/torchforge/SKILL.md +433 -0
- package/bin/skills/torchforge/references/api-reference.md +327 -0
- package/bin/skills/torchforge/references/troubleshooting.md +409 -0
- package/bin/skills/torchtitan/SKILL.md +358 -0
- package/bin/skills/torchtitan/references/checkpoint.md +181 -0
- package/bin/skills/torchtitan/references/custom-models.md +258 -0
- package/bin/skills/torchtitan/references/float8.md +133 -0
- package/bin/skills/torchtitan/references/fsdp.md +126 -0
- package/bin/skills/transformer-lens/SKILL.md +346 -0
- package/bin/skills/transformer-lens/references/README.md +54 -0
- package/bin/skills/transformer-lens/references/api.md +362 -0
- package/bin/skills/transformer-lens/references/tutorials.md +339 -0
- package/bin/skills/trl-fine-tuning/SKILL.md +455 -0
- package/bin/skills/trl-fine-tuning/references/dpo-variants.md +227 -0
- package/bin/skills/trl-fine-tuning/references/online-rl.md +82 -0
- package/bin/skills/trl-fine-tuning/references/reward-modeling.md +122 -0
- package/bin/skills/trl-fine-tuning/references/sft-training.md +168 -0
- package/bin/skills/unsloth/SKILL.md +80 -0
- package/bin/skills/unsloth/references/index.md +7 -0
- package/bin/skills/unsloth/references/llms-full.md +16799 -0
- package/bin/skills/unsloth/references/llms-txt.md +12044 -0
- package/bin/skills/unsloth/references/llms.md +82 -0
- package/bin/skills/verl/SKILL.md +391 -0
- package/bin/skills/verl/references/api-reference.md +301 -0
- package/bin/skills/verl/references/troubleshooting.md +391 -0
- package/bin/skills/vllm/SKILL.md +364 -0
- package/bin/skills/vllm/references/optimization.md +226 -0
- package/bin/skills/vllm/references/quantization.md +284 -0
- package/bin/skills/vllm/references/server-deployment.md +255 -0
- package/bin/skills/vllm/references/troubleshooting.md +447 -0
- package/bin/skills/weights-and-biases/SKILL.md +590 -0
- package/bin/skills/weights-and-biases/references/artifacts.md +584 -0
- package/bin/skills/weights-and-biases/references/integrations.md +700 -0
- package/bin/skills/weights-and-biases/references/sweeps.md +847 -0
- package/bin/skills/whisper/SKILL.md +317 -0
- package/bin/skills/whisper/references/languages.md +189 -0
- package/bin/synsc +0 -0
- package/package.json +10 -0
|
@@ -0,0 +1,519 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: stable-diffusion-image-generation
|
|
3
|
+
description: State-of-the-art text-to-image generation with Stable Diffusion models via HuggingFace Diffusers. Use when generating images from text prompts, performing image-to-image translation, inpainting, or building custom diffusion pipelines.
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
author: Synthetic Sciences
|
|
6
|
+
license: MIT
|
|
7
|
+
tags: [Image Generation, Stable Diffusion, Diffusers, Text-to-Image, Multimodal, Computer Vision]
|
|
8
|
+
dependencies: [diffusers>=0.30.0, transformers>=4.41.0, accelerate>=0.31.0, torch>=2.0.0]
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Stable Diffusion Image Generation
|
|
12
|
+
|
|
13
|
+
Comprehensive guide to generating images with Stable Diffusion using the HuggingFace Diffusers library.
|
|
14
|
+
|
|
15
|
+
## When to use Stable Diffusion
|
|
16
|
+
|
|
17
|
+
**Use Stable Diffusion when:**
|
|
18
|
+
- Generating images from text descriptions
|
|
19
|
+
- Performing image-to-image translation (style transfer, enhancement)
|
|
20
|
+
- Inpainting (filling in masked regions)
|
|
21
|
+
- Outpainting (extending images beyond boundaries)
|
|
22
|
+
- Creating variations of existing images
|
|
23
|
+
- Building custom image generation workflows
|
|
24
|
+
|
|
25
|
+
**Key features:**
|
|
26
|
+
- **Text-to-Image**: Generate images from natural language prompts
|
|
27
|
+
- **Image-to-Image**: Transform existing images with text guidance
|
|
28
|
+
- **Inpainting**: Fill masked regions with context-aware content
|
|
29
|
+
- **ControlNet**: Add spatial conditioning (edges, poses, depth)
|
|
30
|
+
- **LoRA Support**: Efficient fine-tuning and style adaptation
|
|
31
|
+
- **Multiple Models**: SD 1.5, SDXL, SD 3.0, Flux support
|
|
32
|
+
|
|
33
|
+
**Use alternatives instead:**
|
|
34
|
+
- **DALL-E 3**: For API-based generation without GPU
|
|
35
|
+
- **Midjourney**: For artistic, stylized outputs
|
|
36
|
+
- **Imagen**: For Google Cloud integration
|
|
37
|
+
- **Leonardo.ai**: For web-based creative workflows
|
|
38
|
+
|
|
39
|
+
## Quick start
|
|
40
|
+
|
|
41
|
+
### Installation
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
pip install diffusers transformers accelerate torch
|
|
45
|
+
pip install xformers # Optional: memory-efficient attention
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Basic text-to-image
|
|
49
|
+
|
|
50
|
+
```python
|
|
51
|
+
from diffusers import DiffusionPipeline
|
|
52
|
+
import torch
|
|
53
|
+
|
|
54
|
+
# Load pipeline (auto-detects model type)
|
|
55
|
+
pipe = DiffusionPipeline.from_pretrained(
|
|
56
|
+
"stable-diffusion-v1-5/stable-diffusion-v1-5",
|
|
57
|
+
torch_dtype=torch.float16
|
|
58
|
+
)
|
|
59
|
+
pipe.to("cuda")
|
|
60
|
+
|
|
61
|
+
# Generate image
|
|
62
|
+
image = pipe(
|
|
63
|
+
"A serene mountain landscape at sunset, highly detailed",
|
|
64
|
+
num_inference_steps=50,
|
|
65
|
+
guidance_scale=7.5
|
|
66
|
+
).images[0]
|
|
67
|
+
|
|
68
|
+
image.save("output.png")
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Using SDXL (higher quality)
|
|
72
|
+
|
|
73
|
+
```python
|
|
74
|
+
from diffusers import AutoPipelineForText2Image
|
|
75
|
+
import torch
|
|
76
|
+
|
|
77
|
+
pipe = AutoPipelineForText2Image.from_pretrained(
|
|
78
|
+
"stabilityai/stable-diffusion-xl-base-1.0",
|
|
79
|
+
torch_dtype=torch.float16,
|
|
80
|
+
variant="fp16"
|
|
81
|
+
)
|
|
82
|
+
pipe.to("cuda")
|
|
83
|
+
|
|
84
|
+
# Enable memory optimization
|
|
85
|
+
pipe.enable_model_cpu_offload()
|
|
86
|
+
|
|
87
|
+
image = pipe(
|
|
88
|
+
prompt="A futuristic city with flying cars, cinematic lighting",
|
|
89
|
+
height=1024,
|
|
90
|
+
width=1024,
|
|
91
|
+
num_inference_steps=30
|
|
92
|
+
).images[0]
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Architecture overview
|
|
96
|
+
|
|
97
|
+
### Three-pillar design
|
|
98
|
+
|
|
99
|
+
Diffusers is built around three core components:
|
|
100
|
+
|
|
101
|
+
```
|
|
102
|
+
Pipeline (orchestration)
|
|
103
|
+
├── Model (neural networks)
|
|
104
|
+
│ ├── UNet / Transformer (noise prediction)
|
|
105
|
+
│ ├── VAE (latent encoding/decoding)
|
|
106
|
+
│ └── Text Encoder (CLIP/T5)
|
|
107
|
+
└── Scheduler (denoising algorithm)
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### Pipeline inference flow
|
|
111
|
+
|
|
112
|
+
```
|
|
113
|
+
Text Prompt → Text Encoder → Text Embeddings
|
|
114
|
+
↓
|
|
115
|
+
Random Noise → [Denoising Loop] ← Scheduler
|
|
116
|
+
↓
|
|
117
|
+
Predicted Noise
|
|
118
|
+
↓
|
|
119
|
+
VAE Decoder → Final Image
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## Core concepts
|
|
123
|
+
|
|
124
|
+
### Pipelines
|
|
125
|
+
|
|
126
|
+
Pipelines orchestrate complete workflows:
|
|
127
|
+
|
|
128
|
+
| Pipeline | Purpose |
|
|
129
|
+
|----------|---------|
|
|
130
|
+
| `StableDiffusionPipeline` | Text-to-image (SD 1.x/2.x) |
|
|
131
|
+
| `StableDiffusionXLPipeline` | Text-to-image (SDXL) |
|
|
132
|
+
| `StableDiffusion3Pipeline` | Text-to-image (SD 3.0) |
|
|
133
|
+
| `FluxPipeline` | Text-to-image (Flux models) |
|
|
134
|
+
| `StableDiffusionImg2ImgPipeline` | Image-to-image |
|
|
135
|
+
| `StableDiffusionInpaintPipeline` | Inpainting |
|
|
136
|
+
|
|
137
|
+
### Schedulers
|
|
138
|
+
|
|
139
|
+
Schedulers control the denoising process:
|
|
140
|
+
|
|
141
|
+
| Scheduler | Steps | Quality | Use Case |
|
|
142
|
+
|-----------|-------|---------|----------|
|
|
143
|
+
| `EulerDiscreteScheduler` | 20-50 | Good | Default choice |
|
|
144
|
+
| `EulerAncestralDiscreteScheduler` | 20-50 | Good | More variation |
|
|
145
|
+
| `DPMSolverMultistepScheduler` | 15-25 | Excellent | Fast, high quality |
|
|
146
|
+
| `DDIMScheduler` | 50-100 | Good | Deterministic |
|
|
147
|
+
| `LCMScheduler` | 4-8 | Good | Very fast |
|
|
148
|
+
| `UniPCMultistepScheduler` | 15-25 | Excellent | Fast convergence |
|
|
149
|
+
|
|
150
|
+
### Swapping schedulers
|
|
151
|
+
|
|
152
|
+
```python
|
|
153
|
+
from diffusers import DPMSolverMultistepScheduler
|
|
154
|
+
|
|
155
|
+
# Swap for faster generation
|
|
156
|
+
pipe.scheduler = DPMSolverMultistepScheduler.from_config(
|
|
157
|
+
pipe.scheduler.config
|
|
158
|
+
)
|
|
159
|
+
|
|
160
|
+
# Now generate with fewer steps
|
|
161
|
+
image = pipe(prompt, num_inference_steps=20).images[0]
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
## Generation parameters
|
|
165
|
+
|
|
166
|
+
### Key parameters
|
|
167
|
+
|
|
168
|
+
| Parameter | Default | Description |
|
|
169
|
+
|-----------|---------|-------------|
|
|
170
|
+
| `prompt` | Required | Text description of desired image |
|
|
171
|
+
| `negative_prompt` | None | What to avoid in the image |
|
|
172
|
+
| `num_inference_steps` | 50 | Denoising steps (more = better quality) |
|
|
173
|
+
| `guidance_scale` | 7.5 | Prompt adherence (7-12 typical) |
|
|
174
|
+
| `height`, `width` | 512/1024 | Output dimensions (multiples of 8) |
|
|
175
|
+
| `generator` | None | Torch generator for reproducibility |
|
|
176
|
+
| `num_images_per_prompt` | 1 | Batch size |
|
|
177
|
+
|
|
178
|
+
### Reproducible generation
|
|
179
|
+
|
|
180
|
+
```python
|
|
181
|
+
import torch
|
|
182
|
+
|
|
183
|
+
generator = torch.Generator(device="cuda").manual_seed(42)
|
|
184
|
+
|
|
185
|
+
image = pipe(
|
|
186
|
+
prompt="A cat wearing a top hat",
|
|
187
|
+
generator=generator,
|
|
188
|
+
num_inference_steps=50
|
|
189
|
+
).images[0]
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
### Negative prompts
|
|
193
|
+
|
|
194
|
+
```python
|
|
195
|
+
image = pipe(
|
|
196
|
+
prompt="Professional photo of a dog in a garden",
|
|
197
|
+
negative_prompt="blurry, low quality, distorted, ugly, bad anatomy",
|
|
198
|
+
guidance_scale=7.5
|
|
199
|
+
).images[0]
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
## Image-to-image
|
|
203
|
+
|
|
204
|
+
Transform existing images with text guidance:
|
|
205
|
+
|
|
206
|
+
```python
|
|
207
|
+
from diffusers import AutoPipelineForImage2Image
|
|
208
|
+
from PIL import Image
|
|
209
|
+
|
|
210
|
+
pipe = AutoPipelineForImage2Image.from_pretrained(
|
|
211
|
+
"stable-diffusion-v1-5/stable-diffusion-v1-5",
|
|
212
|
+
torch_dtype=torch.float16
|
|
213
|
+
).to("cuda")
|
|
214
|
+
|
|
215
|
+
init_image = Image.open("input.jpg").resize((512, 512))
|
|
216
|
+
|
|
217
|
+
image = pipe(
|
|
218
|
+
prompt="A watercolor painting of the scene",
|
|
219
|
+
image=init_image,
|
|
220
|
+
strength=0.75, # How much to transform (0-1)
|
|
221
|
+
num_inference_steps=50
|
|
222
|
+
).images[0]
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
## Inpainting
|
|
226
|
+
|
|
227
|
+
Fill masked regions:
|
|
228
|
+
|
|
229
|
+
```python
|
|
230
|
+
from diffusers import AutoPipelineForInpainting
|
|
231
|
+
from PIL import Image
|
|
232
|
+
|
|
233
|
+
pipe = AutoPipelineForInpainting.from_pretrained(
|
|
234
|
+
"runwayml/stable-diffusion-inpainting",
|
|
235
|
+
torch_dtype=torch.float16
|
|
236
|
+
).to("cuda")
|
|
237
|
+
|
|
238
|
+
image = Image.open("photo.jpg")
|
|
239
|
+
mask = Image.open("mask.png") # White = inpaint region
|
|
240
|
+
|
|
241
|
+
result = pipe(
|
|
242
|
+
prompt="A red car parked on the street",
|
|
243
|
+
image=image,
|
|
244
|
+
mask_image=mask,
|
|
245
|
+
num_inference_steps=50
|
|
246
|
+
).images[0]
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
## ControlNet
|
|
250
|
+
|
|
251
|
+
Add spatial conditioning for precise control:
|
|
252
|
+
|
|
253
|
+
```python
|
|
254
|
+
from diffusers import StableDiffusionControlNetPipeline, ControlNetModel
|
|
255
|
+
import torch
|
|
256
|
+
|
|
257
|
+
# Load ControlNet for edge conditioning
|
|
258
|
+
controlnet = ControlNetModel.from_pretrained(
|
|
259
|
+
"lllyasviel/control_v11p_sd15_canny",
|
|
260
|
+
torch_dtype=torch.float16
|
|
261
|
+
)
|
|
262
|
+
|
|
263
|
+
pipe = StableDiffusionControlNetPipeline.from_pretrained(
|
|
264
|
+
"stable-diffusion-v1-5/stable-diffusion-v1-5",
|
|
265
|
+
controlnet=controlnet,
|
|
266
|
+
torch_dtype=torch.float16
|
|
267
|
+
).to("cuda")
|
|
268
|
+
|
|
269
|
+
# Use Canny edge image as control
|
|
270
|
+
control_image = get_canny_image(input_image)
|
|
271
|
+
|
|
272
|
+
image = pipe(
|
|
273
|
+
prompt="A beautiful house in the style of Van Gogh",
|
|
274
|
+
image=control_image,
|
|
275
|
+
num_inference_steps=30
|
|
276
|
+
).images[0]
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
### Available ControlNets
|
|
280
|
+
|
|
281
|
+
| ControlNet | Input Type | Use Case |
|
|
282
|
+
|------------|------------|----------|
|
|
283
|
+
| `canny` | Edge maps | Preserve structure |
|
|
284
|
+
| `openpose` | Pose skeletons | Human poses |
|
|
285
|
+
| `depth` | Depth maps | 3D-aware generation |
|
|
286
|
+
| `normal` | Normal maps | Surface details |
|
|
287
|
+
| `mlsd` | Line segments | Architectural lines |
|
|
288
|
+
| `scribble` | Rough sketches | Sketch-to-image |
|
|
289
|
+
|
|
290
|
+
## LoRA adapters
|
|
291
|
+
|
|
292
|
+
Load fine-tuned style adapters:
|
|
293
|
+
|
|
294
|
+
```python
|
|
295
|
+
from diffusers import DiffusionPipeline
|
|
296
|
+
|
|
297
|
+
pipe = DiffusionPipeline.from_pretrained(
|
|
298
|
+
"stable-diffusion-v1-5/stable-diffusion-v1-5",
|
|
299
|
+
torch_dtype=torch.float16
|
|
300
|
+
).to("cuda")
|
|
301
|
+
|
|
302
|
+
# Load LoRA weights
|
|
303
|
+
pipe.load_lora_weights("path/to/lora", weight_name="style.safetensors")
|
|
304
|
+
|
|
305
|
+
# Generate with LoRA style
|
|
306
|
+
image = pipe("A portrait in the trained style").images[0]
|
|
307
|
+
|
|
308
|
+
# Adjust LoRA strength
|
|
309
|
+
pipe.fuse_lora(lora_scale=0.8)
|
|
310
|
+
|
|
311
|
+
# Unload LoRA
|
|
312
|
+
pipe.unload_lora_weights()
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
### Multiple LoRAs
|
|
316
|
+
|
|
317
|
+
```python
|
|
318
|
+
# Load multiple LoRAs
|
|
319
|
+
pipe.load_lora_weights("lora1", adapter_name="style")
|
|
320
|
+
pipe.load_lora_weights("lora2", adapter_name="character")
|
|
321
|
+
|
|
322
|
+
# Set weights for each
|
|
323
|
+
pipe.set_adapters(["style", "character"], adapter_weights=[0.7, 0.5])
|
|
324
|
+
|
|
325
|
+
image = pipe("A portrait").images[0]
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
## Memory optimization
|
|
329
|
+
|
|
330
|
+
### Enable CPU offloading
|
|
331
|
+
|
|
332
|
+
```python
|
|
333
|
+
# Model CPU offload - moves models to CPU when not in use
|
|
334
|
+
pipe.enable_model_cpu_offload()
|
|
335
|
+
|
|
336
|
+
# Sequential CPU offload - more aggressive, slower
|
|
337
|
+
pipe.enable_sequential_cpu_offload()
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
### Attention slicing
|
|
341
|
+
|
|
342
|
+
```python
|
|
343
|
+
# Reduce memory by computing attention in chunks
|
|
344
|
+
pipe.enable_attention_slicing()
|
|
345
|
+
|
|
346
|
+
# Or specific chunk size
|
|
347
|
+
pipe.enable_attention_slicing("max")
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
### xFormers memory-efficient attention
|
|
351
|
+
|
|
352
|
+
```python
|
|
353
|
+
# Requires xformers package
|
|
354
|
+
pipe.enable_xformers_memory_efficient_attention()
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
### VAE slicing for large images
|
|
358
|
+
|
|
359
|
+
```python
|
|
360
|
+
# Decode latents in tiles for large images
|
|
361
|
+
pipe.enable_vae_slicing()
|
|
362
|
+
pipe.enable_vae_tiling()
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
## Model variants
|
|
366
|
+
|
|
367
|
+
### Loading different precisions
|
|
368
|
+
|
|
369
|
+
```python
|
|
370
|
+
# FP16 (recommended for GPU)
|
|
371
|
+
pipe = DiffusionPipeline.from_pretrained(
|
|
372
|
+
"model-id",
|
|
373
|
+
torch_dtype=torch.float16,
|
|
374
|
+
variant="fp16"
|
|
375
|
+
)
|
|
376
|
+
|
|
377
|
+
# BF16 (better precision, requires Ampere+ GPU)
|
|
378
|
+
pipe = DiffusionPipeline.from_pretrained(
|
|
379
|
+
"model-id",
|
|
380
|
+
torch_dtype=torch.bfloat16
|
|
381
|
+
)
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
### Loading specific components
|
|
385
|
+
|
|
386
|
+
```python
|
|
387
|
+
from diffusers import UNet2DConditionModel, AutoencoderKL
|
|
388
|
+
|
|
389
|
+
# Load custom VAE
|
|
390
|
+
vae = AutoencoderKL.from_pretrained("stabilityai/sd-vae-ft-mse")
|
|
391
|
+
|
|
392
|
+
# Use with pipeline
|
|
393
|
+
pipe = DiffusionPipeline.from_pretrained(
|
|
394
|
+
"stable-diffusion-v1-5/stable-diffusion-v1-5",
|
|
395
|
+
vae=vae,
|
|
396
|
+
torch_dtype=torch.float16
|
|
397
|
+
)
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
## Batch generation
|
|
401
|
+
|
|
402
|
+
Generate multiple images efficiently:
|
|
403
|
+
|
|
404
|
+
```python
|
|
405
|
+
# Multiple prompts
|
|
406
|
+
prompts = [
|
|
407
|
+
"A cat playing piano",
|
|
408
|
+
"A dog reading a book",
|
|
409
|
+
"A bird painting a picture"
|
|
410
|
+
]
|
|
411
|
+
|
|
412
|
+
images = pipe(prompts, num_inference_steps=30).images
|
|
413
|
+
|
|
414
|
+
# Multiple images per prompt
|
|
415
|
+
images = pipe(
|
|
416
|
+
"A beautiful sunset",
|
|
417
|
+
num_images_per_prompt=4,
|
|
418
|
+
num_inference_steps=30
|
|
419
|
+
).images
|
|
420
|
+
```
|
|
421
|
+
|
|
422
|
+
## Common workflows
|
|
423
|
+
|
|
424
|
+
### Workflow 1: High-quality generation
|
|
425
|
+
|
|
426
|
+
```python
|
|
427
|
+
from diffusers import StableDiffusionXLPipeline, DPMSolverMultistepScheduler
|
|
428
|
+
import torch
|
|
429
|
+
|
|
430
|
+
# 1. Load SDXL with optimizations
|
|
431
|
+
pipe = StableDiffusionXLPipeline.from_pretrained(
|
|
432
|
+
"stabilityai/stable-diffusion-xl-base-1.0",
|
|
433
|
+
torch_dtype=torch.float16,
|
|
434
|
+
variant="fp16"
|
|
435
|
+
)
|
|
436
|
+
pipe.to("cuda")
|
|
437
|
+
pipe.scheduler = DPMSolverMultistepScheduler.from_config(pipe.scheduler.config)
|
|
438
|
+
pipe.enable_model_cpu_offload()
|
|
439
|
+
|
|
440
|
+
# 2. Generate with quality settings
|
|
441
|
+
image = pipe(
|
|
442
|
+
prompt="A majestic lion in the savanna, golden hour lighting, 8k, detailed fur",
|
|
443
|
+
negative_prompt="blurry, low quality, cartoon, anime, sketch",
|
|
444
|
+
num_inference_steps=30,
|
|
445
|
+
guidance_scale=7.5,
|
|
446
|
+
height=1024,
|
|
447
|
+
width=1024
|
|
448
|
+
).images[0]
|
|
449
|
+
```
|
|
450
|
+
|
|
451
|
+
### Workflow 2: Fast prototyping
|
|
452
|
+
|
|
453
|
+
```python
|
|
454
|
+
from diffusers import AutoPipelineForText2Image, LCMScheduler
|
|
455
|
+
import torch
|
|
456
|
+
|
|
457
|
+
# Use LCM for 4-8 step generation
|
|
458
|
+
pipe = AutoPipelineForText2Image.from_pretrained(
|
|
459
|
+
"stabilityai/stable-diffusion-xl-base-1.0",
|
|
460
|
+
torch_dtype=torch.float16
|
|
461
|
+
).to("cuda")
|
|
462
|
+
|
|
463
|
+
# Load LCM LoRA for fast generation
|
|
464
|
+
pipe.load_lora_weights("latent-consistency/lcm-lora-sdxl")
|
|
465
|
+
pipe.scheduler = LCMScheduler.from_config(pipe.scheduler.config)
|
|
466
|
+
pipe.fuse_lora()
|
|
467
|
+
|
|
468
|
+
# Generate in ~1 second
|
|
469
|
+
image = pipe(
|
|
470
|
+
"A beautiful landscape",
|
|
471
|
+
num_inference_steps=4,
|
|
472
|
+
guidance_scale=1.0
|
|
473
|
+
).images[0]
|
|
474
|
+
```
|
|
475
|
+
|
|
476
|
+
## Common issues
|
|
477
|
+
|
|
478
|
+
**CUDA out of memory:**
|
|
479
|
+
```python
|
|
480
|
+
# Enable memory optimizations
|
|
481
|
+
pipe.enable_model_cpu_offload()
|
|
482
|
+
pipe.enable_attention_slicing()
|
|
483
|
+
pipe.enable_vae_slicing()
|
|
484
|
+
|
|
485
|
+
# Or use lower precision
|
|
486
|
+
pipe = DiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
|
|
487
|
+
```
|
|
488
|
+
|
|
489
|
+
**Black/noise images:**
|
|
490
|
+
```python
|
|
491
|
+
# Check VAE configuration
|
|
492
|
+
# Use safety checker bypass if needed
|
|
493
|
+
pipe.safety_checker = None
|
|
494
|
+
|
|
495
|
+
# Ensure proper dtype consistency
|
|
496
|
+
pipe = pipe.to(dtype=torch.float16)
|
|
497
|
+
```
|
|
498
|
+
|
|
499
|
+
**Slow generation:**
|
|
500
|
+
```python
|
|
501
|
+
# Use faster scheduler
|
|
502
|
+
from diffusers import DPMSolverMultistepScheduler
|
|
503
|
+
pipe.scheduler = DPMSolverMultistepScheduler.from_config(pipe.scheduler.config)
|
|
504
|
+
|
|
505
|
+
# Reduce steps
|
|
506
|
+
image = pipe(prompt, num_inference_steps=20).images[0]
|
|
507
|
+
```
|
|
508
|
+
|
|
509
|
+
## References
|
|
510
|
+
|
|
511
|
+
- **[Advanced Usage](references/advanced-usage.md)** - Custom pipelines, fine-tuning, deployment
|
|
512
|
+
- **[Troubleshooting](references/troubleshooting.md)** - Common issues and solutions
|
|
513
|
+
|
|
514
|
+
## Resources
|
|
515
|
+
|
|
516
|
+
- **Documentation**: https://huggingface.co/docs/diffusers
|
|
517
|
+
- **Repository**: https://github.com/huggingface/diffusers
|
|
518
|
+
- **Model Hub**: https://huggingface.co/models?library=diffusers
|
|
519
|
+
- **Discord**: https://discord.gg/diffusers
|