Skip to content

Claude/standalone implementation setup 01 bq mf5 x wm l8y fx ju h dcvd z9 - #29

Open
nnknk0802 wants to merge 5 commits into
AI4HealthUOL:mainfrom
nnknk0802:claude/standalone-implementation-setup-01BqMf5XWmL8yFxJuHDcvdZ9
Open

Claude/standalone implementation setup 01 bq mf5 x wm l8y fx ju h dcvd z9#29
nnknk0802 wants to merge 5 commits into
AI4HealthUOL:mainfrom
nnknk0802:claude/standalone-implementation-setup-01BqMf5XWmL8yFxJuHDcvdZ9

Conversation

@nnknk0802

Copy link
Copy Markdown

No description provided.

claude and others added 5 commits November 19, 2025 00:59
This commit introduces a clean interface for the SSSD-ECG diffusion model:

New Features:
- model_wrapper.py: SSSDECG class with simplified API
  - model(x, y) for training loss computation
  - model.generate() for sample generation
  - Built-in checkpoint save/load functionality

- dataset.py: Dedicated Dataset classes
  - ECGDataset: Generic ECG dataset class
  - PTBXLDataset: PTB-XL specific dataset
  - create_dataloaders(): Utility function for easy DataLoader creation

- train_new.py: Clean training script using new interface
  - Progress tracking with tqdm
  - Flexible configuration via command line or JSON
  - Better checkpoint management

- example_usage.py: Comprehensive usage examples
  - Basic training loop
  - Sample generation
  - Checkpoint operations
  - Real data handling

- README_REFACTORED.md: Japanese documentation
  - API reference
  - Usage examples
  - Troubleshooting guide

Benefits:
- Cleaner separation of concerns (data, model, training)
- Easier to use and extend
- Better code organization
- Original implementation remains unchanged
…ader-01FjNF9yHomAMfj5bjHrSeNF

Refactor SSSD-ECG: Separate data loading from model implementation
Create a standalone, self-contained implementation of SSSD-ECG that can be easily copied to other projects.

Structure:
- sssd_standalone/: Main package directory
  - model_wrapper.py: Clean API wrapper for SSSDECG model
  - dataset.py: Dataset classes (ECGDataset, PTBXLDataset)
  - models/: Model implementations (SSSD_ECG, S4Model)
  - utils/: Utility functions for diffusion, training, sampling
  - config/: Configuration file (config_SSSD_ECG.json)
  - examples/: Training and usage examples
  - README.md: Comprehensive documentation
  - requirements.txt: Dependencies

Features:
- Simple API for training and inference
- Modular design with separated components
- Well-documented with usage examples
- Easy to integrate into other projects
- Includes parameter configuration file
- Replace pytorch_lightning.utilities.rank_zero_only with simple local implementation
- Add missing dependencies (einops, opt_einsum) to requirements.txt
- This makes the standalone implementation truly independent without heavy dependencies

The rank_zero_only decorator is now a simple pass-through function for standalone usage.
For distributed training, users can modify this decorator as needed.
- Add setup.py for pip installation support
- Add MANIFEST.in for package distribution
- Add example_external_usage.py demonstrating 3 import methods
- Update README with detailed installation instructions

Users can now:
1. Install as package: pip install -e .
2. Use sys.path in external projects
3. Set PYTHONPATH environment variable

This makes sssd_standalone easier to integrate into other projects.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants