{"id":22804216,"url":"https://github.com/datacte/sdxl-training-improvements","last_synced_at":"2025-08-21T15:33:07.978Z","repository":{"id":269762461,"uuid":"905913914","full_name":"DataCTE/SDXL-Training-Improvements","owner":"DataCTE","description":"📊 Research-focused SDXL training framework exploring novel optimization approaches. Goals include enhanced image quality, training stability \u0026 comprehensive monitoring. ⭐ Performance-focused research framework.","archived":false,"fork":false,"pushed_at":"2025-01-13T15:29:26.000Z","size":1926,"stargazers_count":19,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-08T12:46:41.989Z","etag":null,"topics":["deep-learning","diffusion","machine-learning","stable-diffusion","stable-diffusion-xl"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DataCTE.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS","dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-12-19T19:22:37.000Z","updated_at":"2025-02-26T01:01:51.000Z","dependencies_parsed_at":"2025-01-13T16:21:07.324Z","dependency_job_id":null,"html_url":"https://github.com/DataCTE/SDXL-Training-Improvements","commit_stats":{"total_commits":627,"total_committers":1,"mean_commits":627.0,"dds":0.0,"last_synced_commit":"fd9a115753284e4e966743e174588415a2777d5d"},"previous_names":["datacte/sdxl-training-improvements"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/DataCTE/SDXL-Training-Improvements","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DataCTE%2FSDXL-Training-Improvements","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DataCTE%2FSDXL-Training-Improvements/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DataCTE%2FSDXL-Training-Improvements/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DataCTE%2FSDXL-Training-Improvements/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DataCTE","download_url":"https://codeload.github.com/DataCTE/SDXL-Training-Improvements/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DataCTE%2FSDXL-Training-Improvements/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271500361,"owners_count":24770375,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-21T02:00:08.990Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["deep-learning","diffusion","machine-learning","stable-diffusion","stable-diffusion-xl"],"created_at":"2024-12-12T10:06:55.764Z","updated_at":"2025-08-21T15:33:07.952Z","avatar_url":"https://github.com/DataCTE.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SDXL Training Framework with Novel Research Methods\n\n[![Python 3.8+](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/downloads/)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\nA research-focused SDXL training framework implementing cutting-edge advances in diffusion model training, with emphasis on image quality and training stability.\n\n## Adding New Training Methods\n\nThe framework provides a template for easily implementing new training methods:\n\n```python\n# src/training/trainers/methods/example_method.py\nclass ExampleMethodTrainer(SDXLTrainer):\n    name = \"example_method\"  # Your method's name\n\n    def compute_loss(self, batch: Dict[str, Tensor]) -\u003e Dict[str, Any]:\n        \"\"\"Implement your method's loss computation here.\"\"\"\n        raise NotImplementedError()\n```\n\nTo add a new method:\n1. Copy `example_method.py` template\n2. Implement the `compute_loss()` method with your training logic\n3. Register method in config.yaml:\n```yaml\ntraining:\n  method: \"your_method_name\"\n```\n\nThe template handles all boilerplate code including:\n- Memory optimizations\n- Mixed precision training\n- Gradient accumulation\n- Progress tracking\n- Metric logging\n\n## Training Methods\n\n### Flow Matching with Logit-Normal Sampling [[4]](#references)\n\nAdvanced training method that eliminates noise scheduling:\n\n```python\n# Configure Flow Matching training\ntraining:\n  method: \"flow_matching\"\n  batch_size: 4\n  learning_rate: 1.0e-6\n```\n\nKey benefits:\n- 30% faster convergence via optimal transport paths\n- Direct velocity field learning reduces instability\n- No noise schedule dependencies\n- Logit-normal time sampling for better coverage\n\n### NovelAI V3 UNet Architecture [[7]](#references)\n\nState-of-the-art model improvements:\n\n```python\n# Enable NovelAI V3 features\ntraining:\n  prediction_type: \"v_prediction\"\n  zero_terminal_snr: true\n  sigma_max: 20000.0\n```\n\nImprovements:\n- Zero Terminal SNR training\n  - Infinite noise approximation (σ_max ≈ 20000)\n  - Better artifact handling\n  - Enhanced detail preservation\n- V-prediction parameterization\n  - Stable high-frequency gradients\n  - Reduced color shifting\n- Dynamic Karras schedule\n  - Adaptive noise spacing\n  - Improved texture quality\n\n## Training Monitoring\n\nTraining progress is monitored using Weights \u0026 Biases (wandb):\n- Real-time loss tracking\n- Generated sample visualization\n- Hyperparameter logging\n- Custom metric tracking\n- Experiment comparison\n\nEnable monitoring in config.yaml:\n```yaml\ntraining:\n  use_wandb: true\n```\n\n## Image Quality Improvements\n\n- Enhanced Detail Preservation\n  - Fine-grained texture generation\n  - Improved handling of complex patterns\n  - Better preservation of small objects and features\n\n- Color and Lighting\n  - More accurate color reproduction\n  - Enhanced dynamic range in highlights and shadows\n  - Better handling of complex lighting conditions\n\n- Composition and Structure\n  - Improved spatial coherence\n  - Better handling of perspective and depth\n  - More consistent object proportions\n\n\n## Requirements\n\n| Component | Version |\n|-----------|---------|\n| Python    | 3.8+ |\n| CUDA      | 11.7+ |\n| VRAM      | 24GB+ |\n\n## Installation\n\n```bash\n# Clone repository\ngit clone https://github.com/DataCTE/SDXL-Training-Improvements.git\ncd SDXL-Training-Improvements\n\n# Install in development mode with all extras\npip install -e \".[dev,docs]\"\n\n# Verify installation\npython -c \"import src; print(src.__version__)\"\n```\n\n## Configuration\n\nThe training framework is configured through a YAML file. Key configuration sections:\n\n```yaml\n# Model configuration\nmodel:\n  pretrained_model_name: \"stabilityai/stable-diffusion-xl-base-1.0\"\n  num_timesteps: 1000\n  sigma_min: 0.002\n  sigma_max: 80.0\n\n# Training parameters  \ntraining:\n  batch_size: 4\n  learning_rate: 4.0e-7\n  method: \"ddpm\"  # or \"flow_matching\"\n  zero_terminal_snr: true\n  \n# Dataset configuration\ndata:\n  train_data_dir: \n    - \"path/to/dataset1\"\n    - \"path/to/dataset2\"\n```\n\nSee [config.yaml](src/config.yaml) for full configuration options.\n\n## Usage Examples\n\nBasic training:\n```bash\n# Train with default config\npython src/main.py --config config.yaml\n\n# Train with custom config\npython src/main.py --config my_config.yaml\n\n# Distributed training\ntorchrun --nproc_per_node=2 src/main.py --config config.yaml\n```\n\n## References\n\n4. nyanko7, \"nyaflow-xl-alpha: SDXL finetuning with Flow Matching\", https://huggingface.co/nyanko7/nyaflow-xl-alpha, 2024\n7. Ossa et al., \"Improvements to SDXL in NovelAI Diffusion V3\", arXiv:2409.15997, 2024\n\n## License\n\nMIT License - see [LICENSE](LICENSE) file.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdatacte%2Fsdxl-training-improvements","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdatacte%2Fsdxl-training-improvements","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdatacte%2Fsdxl-training-improvements/lists"}