Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
5bc5f39
Add GitHub Actions workflow for deploying to PyPI
selimfirat Jun 15, 2025
7b88c0c
#32 Implement base image compressor and add JPEG/PNG compressor class…
selimfirat Jun 16, 2025
418fa0a
#32
selimfirat Jun 16, 2025
e4d46a9
#32 Refactor sample image loading into SampleDataLoader class
selimfirat Jun 16, 2025
c5fa064
Refactor neural compressors section in plot_image_compressors.py for …
selimfirat Jun 16, 2025
a8a9342
Merge branch 'main' into dev
selimfirat Jun 16, 2025
597b4fc
Add Code of Conduct document to repository
selimfirat Jun 17, 2025
6f10a94
Remove old test script and add comprehensive integration tests for im…
selimfirat Jun 18, 2025
ba5a720
#13 feat: Enhance model configuration and training capabilities
selimfirat Jun 19, 2025
9d8d744
feat: Introduce training module with Trainer and TrainingArguments cl…
selimfirat Jun 19, 2025
439ba39
Add comprehensive tests for kaira.data and kaira.training modules
selimfirat Jun 19, 2025
2b15207
#40 feat: Implement Kaira training CLI and add example scripts; creat…
selimfirat Jun 19, 2025
c7ecfdc
feat: Remove outdated Hydra training example script #40
selimfirat Jun 19, 2025
f14e00e
feat: Update data generation examples to use PyTorch tensors and enha…
selimfirat Jun 19, 2025
8f2293c
Refactor training script and tests for improved configuration handling
selimfirat Jun 19, 2025
92b3dc1
fix: Update docstring format for DeepJSCC model implementation
selimfirat Jun 19, 2025
87335e6
fix: Update docstring to include citation for Yilmaz2023DeepJSCCNOMA …
selimfirat Jun 19, 2025
b2cf3c3
feat: Add Hugging Face Hub integration for model upload and management
selimfirat Jun 19, 2025
90600fe
fix: Update API reference formatting in training documentation
selimfirat Jun 19, 2025
49c7351
Refactor training script and tests for improved configuration handling
selimfirat Jun 19, 2025
e66183d
fix: Add numpy seeding to seed_everything function for reproducibility
selimfirat Jun 20, 2025
fde75a6
chore: Remove unused image files from the repository
selimfirat Jun 24, 2025
dc7c4e9
fix: Update transformers dependency to include torch extras
selimfirat Jun 24, 2025
f3e2d0b
refactor: Update plotting utilities for consistent performance visual…
selimfirat Jun 25, 2025
a742c2e
refactor: Enhance documentation structure and organization for FEC mo…
selimfirat Jun 28, 2025
bf422ab
refactor: Clean up API reference documentation by removing redundant …
selimfirat Jun 28, 2025
083059c
Remove comprehensive tests for multimodal and text loss functions due…
selimfirat Jun 28, 2025
6c5e21b
Refactor dataset classes and tests for improved clarity and functiona…
selimfirat Jun 28, 2025
bf29c09
Refactor code for improved readability and consistency
selimfirat Jun 29, 2025
a4e136d
Remove outdated benchmark tests and related files
selimfirat Jun 29, 2025
878c864
refactor: Enhance DeepJSCC model compatibility and performance analysis
selimfirat Jun 29, 2025
bbc4554
Fix contributing guide outdated references
selimfirat Jul 22, 2025
a1d45b7
Fix remaining outdated reference in contributing guide
selimfirat Jul 22, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
141 changes: 141 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
name: Deploy to PyPI

on:
push:
branches: [main]
workflow_dispatch: # Allow manual triggering
workflow_run:
workflows: [
"Python CI",
"Tests",
"Generate Auto Examples",
"Update Changelog Documentation",
"Pre-commit Checks",
] # Trigger after CI and Tests complete
types:
- completed
branches: [main]

permissions:
contents: read
id-token: write # For trusted publishing to PyPI

jobs:
check-version:
runs-on: ubuntu-latest
# Only run if workflow_run was successful or if triggered by push/manual
if: github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success'
outputs:
version-changed: ${{ steps.version-check.outputs.changed }}
current-version: ${{ steps.version-check.outputs.version }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch full history for version comparison

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"

- name: Install dependencies
run: |
python -m pip install --upgrade pip

- name: Check if version changed
id: version-check
run: |
# Get current version from kaira/version.py
CURRENT_VERSION=$(python -c "from kaira.version import __version__; print(__version__)")
echo "current-version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
echo "Current version: $CURRENT_VERSION"

# Check if this version exists on PyPI using simple curl
if curl -f -s "https://pypi.org/pypi/pykaira/$CURRENT_VERSION/json" > /dev/null 2>&1; then
echo "Version $CURRENT_VERSION already exists on PyPI"
echo "changed=false" >> $GITHUB_OUTPUT
else
echo "Version $CURRENT_VERSION is new"
echo "changed=true" >> $GITHUB_OUTPUT
fi

deploy-pypi:
needs: check-version
if: needs.check-version.outputs.version-changed == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"

- name: Install build dependencies
run: |
python -m pip install --upgrade pip
pip install build twine setuptools wheel

- name: Clean build artifacts
run: |
# Clean Python build artifacts and cache files
find . -type d -name "__pycache__" -exec rm -rf {} + || true
find . -type d -name "*.egg-info" -exec rm -rf {} + || true
find . -type d -name ".eggs" -exec rm -rf {} + || true
find . -type f -name "*.pyc" -delete || true
find . -type f -name "*.pyo" -delete || true
find . -type f -name "*.pyd" -delete || true
find . -type f -name ".coverage" -delete || true
find . -type f -name "coverage.xml" -delete || true
find . -type d -name ".pytest_cache" -exec rm -rf {} + || true
find . -type d -name ".coverage*" -exec rm -rf {} + || true
find . -type d -name "htmlcov" -exec rm -rf {} + || true

# Clean documentation build artifacts
rm -rf docs/_build/ || true
rm -rf docs/gen_modules/ || true
rm -rf docs/generated/ || true
rm -rf docs/auto_examples/ || true

# Remove build and dist directories
rm -rf build/ dist/ ./*.egg-info/ || true

- name: Build distribution packages
run: |
echo "Building distribution for version ${{ needs.check-version.outputs.current-version }}"
python setup.py sdist bdist_wheel

- name: Check package with twine
run: twine check dist/*

- name: Upload to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
# Use API token stored in repository secrets
password: ${{ secrets.PYPI_API_TOKEN }}
verbose: true

- name: Verify deployment
run: |
# Wait a bit for the package to be available
sleep 30

# Try to install from PyPI
pip install pykaira==${{ needs.check-version.outputs.current-version }}

# Basic import test
python -c "import kaira; print(f'Successfully deployed kaira version: {kaira.__version__}')"

- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
tag_name: v${{ needs.check-version.outputs.current-version }}
name: Release v${{ needs.check-version.outputs.current-version }}
body: |
## Changes in v${{ needs.check-version.outputs.current-version }}

This release has been automatically deployed to PyPI.

Install with: `pip install pykaira==${{ needs.check-version.outputs.current-version }}`
draft: false
prerelease: false
5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@ paper*
# C extensions
*.so
results
examples/benchmarks/example_results
examples/benchmarks/benchmark_results
examples/benchmarks/visualization_results
.gradio
wandb
presentation

# Distribution / packaging
.Python
Expand Down
3 changes: 3 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Code of Conduct

We follow the [Python Software Foundation Code of Conduct](https://www.python.org/psf/codeofconduct/). All contributors are expected to adhere to its principles of openness, respect, and collaboration.
20 changes: 13 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,14 @@ There are many ways to contribute to Kaira:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate

# Install development dependencies
pip install -e ".[dev]"
# Or alternatively:
# Install the package in development mode
pip install -e .

# Install development dependencies
pip install -r requirements-dev.txt

# Set up pre-commit hooks (recommended)
pre-commit install
```

### Making Changes
Expand All @@ -66,10 +69,14 @@ There are many ways to contribute to Kaira:
pytest
```

4. **Check code style**:
4. **Check code style and formatting**:

```bash
bash scripts/lint.sh
# Run all pre-commit hooks (formatting, linting, etc.)
pre-commit run -a

# Or use the Makefile shortcut
make format
```

### Submitting a Pull Request
Expand Down Expand Up @@ -183,10 +190,9 @@ Examples are organized into categories:
- `metrics` - Performance metrics and evaluation tools
- `models` - Neural network models and architectures
- `models_fec` - Forward Error Correction models
- `benchmarks` - Benchmarking tools and comparisons
- And more...

For detailed information, see `docs/automated_example_gallery.md`.
For detailed information, see the existing examples in each category directory.

## Testing

Expand Down
101 changes: 101 additions & 0 deletions configs/training_example.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
# @package _global_

# Hydra configuration for Kaira training
# This configuration demonstrates how to set up training parameters
# for communication system models using Hydra

defaults:
- _self_

# Model configuration
model:
_target_: kaira.models.DeepJSCCModel
type: deepjscc
input_dim: 512
channel_uses: 64
hidden_dim: 256
encoder_layers: 3
decoder_layers: 3
activation: relu

# Training configuration
training:
output_dir: ./training_results
num_train_epochs: 10
per_device_train_batch_size: 32
per_device_eval_batch_size: 32
learning_rate: 1e-4
weight_decay: 0.01
warmup_steps: 1000
logging_steps: 100
eval_steps: 500
save_steps: 1000
eval_strategy: steps
save_strategy: steps
save_total_limit: 3

# Communication-specific parameters
snr_min: 0.0
snr_max: 20.0
noise_variance_min: 0.1
noise_variance_max: 2.0
channel_uses: 64
channel_type: awgn

# Training flags
do_eval: true
do_predict: false
fp16: false
dataloader_num_workers: 0

# Optimization
gradient_accumulation_steps: 1
max_grad_norm: 1.0
lr_scheduler_type: linear

# Logging and monitoring
logging_dir: ${training.output_dir}/logs
run_name: deepjscc_training
report_to: [] # Can be set to ["wandb", "tensorboard"] for monitoring

# Data configuration
data:
dataset_name: null # Most communication models generate synthetic data
train_batch_size: ${training.per_device_train_batch_size}
eval_batch_size: ${training.per_device_eval_batch_size}
max_train_samples: null
max_eval_samples: null
preprocessing_num_workers: 4

# Channel simulation configuration
channel:
type: ${training.channel_type}
snr_range:
- ${training.snr_min}
- ${training.snr_max}
noise_type: gaussian
fading: false

# Optimizer configuration
optimizer:
type: adamw
lr: ${training.learning_rate}
weight_decay: ${training.weight_decay}
betas:
- 0.9
- 0.999
eps: 1e-8

# Scheduler configuration
scheduler:
type: ${training.lr_scheduler_type}
warmup_steps: ${training.warmup_steps}
num_training_steps: null # Will be calculated automatically

# Hydra configuration
hydra:
run:
dir: ${training.output_dir}/hydra_outputs/${now:%Y-%m-%d_%H-%M-%S}
job:
name: kaira_training
chdir: true
26 changes: 26 additions & 0 deletions configs/training_simple.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# @package _global_

# Simple Hydra configuration for Kaira training
defaults:
- _self_

# Model configuration
model:
_target_: kaira.models.DeepJSCCModel
type: deepjscc
input_dim: 256
channel_uses: 32
hidden_dim: 128

# Training configuration
training:
output_dir: ./simple_training
num_train_epochs: 5
per_device_train_batch_size: 16
learning_rate: 1e-3
snr_min: 0.0
snr_max: 10.0
channel_type: awgn
eval_strategy: no
save_strategy: epoch
logging_steps: 50
Loading
Loading