Sets up Sphinx documentation infrastructure for generating
comprehensive API documentation and user guides.
Sphinx Configuration (docs/conf.py):
- RTD (Read the Docs) theme
- Autodoc for automatic API documentation
- Napoleon for Google/NumPy style docstrings
- Intersphinx for cross-referencing external docs
- MyST parser for Markdown support
- Coverage and TODO extensions
Documentation Structure (docs/index.rst):
- Getting Started guides
- User Guide sections
- API Reference structure
- Development documentation
- Quick links and features overview
- System requirements
- Quick start examples
Build System (docs/Makefile):
- Standard Sphinx build targets
- HTML output generation
- Clean and build commands
Planned Documentation:
- Installation guide
- Quickstart tutorial
- Pipeline documentation
- Model architecture guides
- Configuration reference
- Distributed training guide
Build Commands:
- make html # Build HTML documentation
- make clean # Clean build directory
- make html-open # Build and open in browser
Benefits:
- Professional API documentation
- Searchable reference material
- Improved discoverability
- Better user onboarding
- Integration with Read the Docs
Adds essential documentation to make the project more welcoming,
secure, and maintainable for contributors and users.
CONTRIBUTING.md:
- Complete contribution guidelines with examples
- Development setup instructions
- Code style and testing requirements
- Commit message conventions (Conventional Commits)
- Pull request process
- Type hints and docstring guidelines
CODE_OF_CONDUCT.md:
- Based on Contributor Covenant 2.1
- Clear community standards and expectations
- Enforcement guidelines with graduated responses
- Reporting and resolution procedures
SECURITY.md:
- Vulnerability reporting process
- Security best practices for users
- Known security considerations
- Disclosure policy
- Supported versions table
- Security checklist for developers
CHANGELOG.md:
- Keep a Changelog format
- Comprehensive refactoring documentation
- Migration guide for security changes
- Detailed version history
- Deprecation notices section
Benefits:
- Clear expectations for contributors
- Professional community management
- Transparent security practices
- Comprehensive change tracking
- Improved onboarding experience
Implements a production-grade testing infrastructure with 100+ tests
covering all core modules and pipelines.
Test Coverage:
- Unit tests for WanModel (DiT architecture)
- Unit tests for WanVAE (3D Causal VAE)
- Unit tests for attention mechanisms
- Integration tests for pipelines (T2V, I2V, FLF2V, VACE)
- Utility function tests
Test Infrastructure:
- conftest.py with reusable fixtures for configs, devices, and dtypes
- pytest.ini with markers for different test categories
- Test markers: slow, cuda, integration, unit, requires_model
- Support for both CPU and GPU testing
- Parameterized tests for various configurations
Files Added:
- tests/conftest.py - Pytest fixtures and configuration
- tests/test_attention.py - Attention mechanism tests
- tests/test_model.py - WanModel tests
- tests/test_vae.py - VAE tests
- tests/test_utils.py - Utility function tests
- tests/test_pipelines.py - Pipeline integration tests
- pytest.ini - Pytest configuration
Test Execution:
- pytest tests/ -v # Run all tests
- pytest tests/ -m "not cuda" # CPU only
- pytest tests/ -m "integration" # Integration tests only
Fixes a critical security vulnerability where malicious model checkpoints
could execute arbitrary code through pickle deserialization.
Changes:
- wan/modules/vae.py: Add weights_only=True to torch.load()
- wan/modules/clip.py: Add weights_only=True to torch.load()
- wan/modules/t5.py: Add weights_only=True to torch.load()
This prevents arbitrary code execution when loading untrusted checkpoints
while maintaining full compatibility with legitimate model weights.
Security Impact: Critical - prevents RCE attacks
Breaking Changes: None - weights_only=True is compatible with all standard
PyTorch state_dict files