Initial release v0.1.0

- Token-level differential privacy for LLMs
  - Integration with Document Privacy API
  - Comprehensive test suite and documentation
  - Examples and Jupyter notebook included
This commit is contained in:
rushil-thareja 2025-12-23 17:02:06 +04:00
commit d012046d85
31 changed files with 4480 additions and 0 deletions

47
.github/ISSUE_TEMPLATE/bug_report.md vendored Normal file
View file

@ -0,0 +1,47 @@
---
name: Bug Report
about: Report a bug or unexpected behavior
title: "[BUG] "
labels: bug
assignees: ''
---
## Description
A clear description of the bug.
## Environment
- Python version:
- PyTorch version:
- Transformers version:
- dp-fusion-lib version:
- OS:
- GPU (if applicable):
## Steps to Reproduce
```python
# Minimal code to reproduce the issue
from dp_fusion_lib import DPFusion
# ...
```
## Expected Behavior
What you expected to happen.
## Actual Behavior
What actually happened.
## Error Traceback
```
Paste full traceback here
```
## Additional Context
Any other context about the problem.

View file

@ -0,0 +1,27 @@
---
name: Feature Request
about: Suggest a new feature or enhancement
title: "[FEATURE] "
labels: enhancement
assignees: ''
---
## Description
A clear description of the feature you'd like.
## Motivation
Why is this feature needed? What problem does it solve?
## Proposed Solution
If you have ideas on how to implement this, describe them here.
## Alternatives Considered
Any alternative solutions or features you've considered.
## Additional Context
Any other context, examples, or references.

28
.github/PULL_REQUEST_TEMPLATE.md vendored Normal file
View file

@ -0,0 +1,28 @@
## Description
Brief description of what this PR does.
## Type of Change
- [ ] Bug fix (non-breaking change that fixes an issue)
- [ ] New feature (non-breaking change that adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
- [ ] Documentation update
- [ ] Refactoring (no functional changes)
## Checklist
- [ ] I have read the [CONTRIBUTING](CONTRIBUTING.md) guidelines
- [ ] My code follows the project's code style
- [ ] I have added tests that prove my fix/feature works
- [ ] All new and existing tests pass
- [ ] I have updated documentation as needed
- [ ] My changes don't introduce new warnings
## Testing
Describe how you tested your changes.
## Related Issues
Fixes #(issue number)

56
.github/workflows/publish.yml vendored Normal file
View file

@ -0,0 +1,56 @@
name: Publish to PyPI
on:
release:
types: [published]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install build tools
run: |
python -m pip install --upgrade pip
pip install build twine
- name: Build package
run: |
python -m build
- name: Check package
run: |
twine check dist/*
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/
publish:
needs: build
runs-on: ubuntu-latest
environment: pypi
permissions:
id-token: write # For trusted publishing
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: dist
path: dist/
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
# Uses trusted publishing (no API token needed if configured in PyPI)
# Alternatively, use:
# with:
# password: ${{ secrets.PYPI_API_TOKEN }}

63
.github/workflows/tests.yml vendored Normal file
View file

@ -0,0 +1,63 @@
name: Tests
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"
- name: Run linter
run: |
ruff check src/
- name: Run tests
run: |
pytest tests/ -v --cov=dp_fusion_lib --cov-report=term-missing
- name: Check import works
run: |
python -c "from dp_fusion_lib import DPFusion, Tagger, compute_epsilon_single_group; print('Import successful')"
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install linting tools
run: |
python -m pip install --upgrade pip
pip install ruff black
- name: Check formatting with black
run: |
black --check src/ tests/ examples/
- name: Lint with ruff
run: |
ruff check src/ tests/ examples/