ml-networks 0.2.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. ml_networks-0.2.2/.github/workflows/ci.yml +128 -0
  2. ml_networks-0.2.2/.github/workflows/docs.yml +40 -0
  3. ml_networks-0.2.2/.github/workflows/release.yml +78 -0
  4. ml_networks-0.2.2/.github/workflows/version-bump.yml +113 -0
  5. ml_networks-0.2.2/.gitignore +75 -0
  6. ml_networks-0.2.2/.pre-commit-config.yaml +34 -0
  7. ml_networks-0.2.2/.python-version +1 -0
  8. ml_networks-0.2.2/LICENSE +21 -0
  9. ml_networks-0.2.2/PKG-INFO +421 -0
  10. ml_networks-0.2.2/README.md +365 -0
  11. ml_networks-0.2.2/README_JP.md +359 -0
  12. ml_networks-0.2.2/docs/api/activations.md +41 -0
  13. ml_networks-0.2.2/docs/api/config.md +63 -0
  14. ml_networks-0.2.2/docs/api/distributions.md +41 -0
  15. ml_networks-0.2.2/docs/api/index.md +59 -0
  16. ml_networks-0.2.2/docs/api/jax.md +62 -0
  17. ml_networks-0.2.2/docs/api/layers.md +61 -0
  18. ml_networks-0.2.2/docs/api/loss.md +29 -0
  19. ml_networks-0.2.2/docs/api/others.md +27 -0
  20. ml_networks-0.2.2/docs/api/unet.md +17 -0
  21. ml_networks-0.2.2/docs/api/utils.md +65 -0
  22. ml_networks-0.2.2/docs/api/vision.md +33 -0
  23. ml_networks-0.2.2/docs/development.md +123 -0
  24. ml_networks-0.2.2/docs/getting-started.md +283 -0
  25. ml_networks-0.2.2/docs/guides/advanced.md +284 -0
  26. ml_networks-0.2.2/docs/guides/config-management.md +346 -0
  27. ml_networks-0.2.2/docs/guides/data-io.md +52 -0
  28. ml_networks-0.2.2/docs/guides/decoder.md +178 -0
  29. ml_networks-0.2.2/docs/guides/distributions.md +226 -0
  30. ml_networks-0.2.2/docs/guides/encoder.md +243 -0
  31. ml_networks-0.2.2/docs/guides/jax.md +269 -0
  32. ml_networks-0.2.2/docs/guides/loss-functions.md +99 -0
  33. ml_networks-0.2.2/docs/guides/mlp.md +171 -0
  34. ml_networks-0.2.2/docs/guides/unet.md +231 -0
  35. ml_networks-0.2.2/docs/guides/utilities.md +112 -0
  36. ml_networks-0.2.2/docs/index.md +163 -0
  37. ml_networks-0.2.2/mkdocs.yml +106 -0
  38. ml_networks-0.2.2/pyproject.toml +149 -0
  39. ml_networks-0.2.2/scripts/bump_version.py +126 -0
  40. ml_networks-0.2.2/src/ml_networks/__init__.py +63 -0
  41. ml_networks-0.2.2/src/ml_networks/callbacks.py +29 -0
  42. ml_networks-0.2.2/src/ml_networks/config.py +556 -0
  43. ml_networks-0.2.2/src/ml_networks/jax/__init__.py +103 -0
  44. ml_networks-0.2.2/src/ml_networks/jax/activations.py +226 -0
  45. ml_networks-0.2.2/src/ml_networks/jax/base.py +170 -0
  46. ml_networks-0.2.2/src/ml_networks/jax/contrastive.py +286 -0
  47. ml_networks-0.2.2/src/ml_networks/jax/distributions.py +529 -0
  48. ml_networks-0.2.2/src/ml_networks/jax/hypernetworks.py +339 -0
  49. ml_networks-0.2.2/src/ml_networks/jax/jax_utils.py +481 -0
  50. ml_networks-0.2.2/src/ml_networks/jax/layers.py +1643 -0
  51. ml_networks-0.2.2/src/ml_networks/jax/loss.py +355 -0
  52. ml_networks-0.2.2/src/ml_networks/jax/unet.py +886 -0
  53. ml_networks-0.2.2/src/ml_networks/jax/vision.py +929 -0
  54. ml_networks-0.2.2/src/ml_networks/py.typed +0 -0
  55. ml_networks-0.2.2/src/ml_networks/torch/__init__.py +97 -0
  56. ml_networks-0.2.2/src/ml_networks/torch/activations.py +202 -0
  57. ml_networks-0.2.2/src/ml_networks/torch/base.py +31 -0
  58. ml_networks-0.2.2/src/ml_networks/torch/contrastive.py +337 -0
  59. ml_networks-0.2.2/src/ml_networks/torch/distributions.py +1016 -0
  60. ml_networks-0.2.2/src/ml_networks/torch/hypernetworks.py +623 -0
  61. ml_networks-0.2.2/src/ml_networks/torch/layers.py +1557 -0
  62. ml_networks-0.2.2/src/ml_networks/torch/loss.py +359 -0
  63. ml_networks-0.2.2/src/ml_networks/torch/torch_utils.py +299 -0
  64. ml_networks-0.2.2/src/ml_networks/torch/unet.py +879 -0
  65. ml_networks-0.2.2/src/ml_networks/torch/vision.py +1276 -0
  66. ml_networks-0.2.2/src/ml_networks/utils.py +464 -0
  67. ml_networks-0.2.2/uv.lock +4167 -0
@@ -0,0 +1,128 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [ main, develop ]
6
+ pull_request:
7
+ branches: [ main, develop ]
8
+
9
+ jobs:
10
+ lint:
11
+ name: Lint and Format Check
12
+ runs-on: ubuntu-latest
13
+ steps:
14
+ - uses: actions/checkout@v4
15
+
16
+ - name: Set up Python
17
+ uses: actions/setup-python@v5
18
+ with:
19
+ python-version: '3.10'
20
+
21
+ - name: Install dependencies
22
+ run: |
23
+ python -m pip install --upgrade pip
24
+ pip install ruff
25
+
26
+ - name: Run ruff check
27
+ run: ruff check .
28
+
29
+ - name: Run ruff format check
30
+ run: ruff format --check .
31
+
32
+ type-check:
33
+ name: Type Check
34
+ runs-on: ubuntu-latest
35
+ steps:
36
+ - uses: actions/checkout@v4
37
+ - name: Set up Python
38
+ uses: actions/setup-python@v5
39
+ with:
40
+ python-version: '3.10'
41
+
42
+ - name: Install dependencies
43
+ run: |
44
+ python -m pip install --upgrade pip
45
+ pip install -e ".[dev]"
46
+
47
+ - name: Run mypy
48
+ run: mypy src/
49
+
50
+ test:
51
+ name: Test (Python ${{ matrix.python-version }})
52
+ runs-on: ubuntu-latest
53
+ strategy:
54
+ matrix:
55
+ python-version: ['3.10']
56
+ steps:
57
+ - uses: actions/checkout@v4
58
+
59
+ - name: Set up Python ${{ matrix.python-version }}
60
+ uses: actions/setup-python@v5
61
+ with:
62
+ python-version: ${{ matrix.python-version }}
63
+
64
+ - name: Install dependencies
65
+ run: |
66
+ python -m pip install --upgrade pip
67
+ pip install -e ".[dev]"
68
+
69
+ - name: Check for test files
70
+ id: check_tests
71
+ run: |
72
+ if [ -d "tests" ] || find . -maxdepth 1 -name "test_*.py" -o -name "tests.py" | grep -q .; then
73
+ echo "has_tests=true" >> $GITHUB_OUTPUT
74
+ else
75
+ echo "has_tests=false" >> $GITHUB_OUTPUT
76
+ fi
77
+
78
+ - name: Run tests
79
+ if: steps.check_tests.outputs.has_tests == 'true'
80
+ run: |
81
+ pytest --cov=src/ml_networks --cov-report=xml --cov-report=term
82
+
83
+ - name: Upload coverage to Codecov
84
+ if: steps.check_tests.outputs.has_tests == 'true' && matrix.python-version == '3.10'
85
+ uses: codecov/codecov-action@v4
86
+ with:
87
+ file: ./coverage.xml
88
+ flags: unittests
89
+ name: codecov-umbrella
90
+ continue-on-error: true
91
+
92
+ - name: Skip tests
93
+ if: steps.check_tests.outputs.has_tests == 'false'
94
+ run: echo "No test files found, skipping test execution"
95
+
96
+ build:
97
+ name: Build Package
98
+ runs-on: ubuntu-latest
99
+ needs: [lint, type-check]
100
+ steps:
101
+ - uses: actions/checkout@v4
102
+
103
+ - name: Set up Python
104
+ uses: actions/setup-python@v5
105
+ with:
106
+ python-version: '3.10'
107
+
108
+ - name: Install build dependencies
109
+ run: |
110
+ python -m pip install --upgrade pip
111
+ pip install build
112
+
113
+ - name: Build package
114
+ run: python -m build
115
+
116
+ - name: Verify package contents
117
+ run: |
118
+ pip install pkginfo
119
+ python -c "
120
+ from pkginfo import Wheel
121
+ import glob
122
+ for whl in glob.glob('dist/*.whl'):
123
+ w = Wheel(whl)
124
+ assert w.name, 'Missing package name'
125
+ assert w.version, 'Missing version'
126
+ assert w.summary, 'Missing description'
127
+ print(f'{w.name}=={w.version}: OK')
128
+ "
@@ -0,0 +1,40 @@
1
+ name: Docs
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ workflow_dispatch:
8
+
9
+ permissions:
10
+ contents: write
11
+
12
+ jobs:
13
+ build-and-deploy:
14
+ name: Build and Deploy MkDocs site
15
+ runs-on: ubuntu-latest
16
+
17
+ steps:
18
+ - name: Checkout
19
+ uses: actions/checkout@v4
20
+
21
+ - name: Set up Python
22
+ uses: actions/setup-python@v5
23
+ with:
24
+ python-version: '3.10'
25
+
26
+ - name: Install docs dependencies
27
+ run: |
28
+ python -m pip install --upgrade pip
29
+ pip install -e ".[docs]"
30
+
31
+ - name: Build docs
32
+ run: mkdocs build --verbose
33
+
34
+ - name: Deploy to GitHub Pages
35
+ uses: peaceiris/actions-gh-pages@v4
36
+ with:
37
+ github_token: ${{ secrets.GITHUB_TOKEN }}
38
+ publish_dir: ./site
39
+ publish_branch: gh-pages
40
+ force_orphan: true
@@ -0,0 +1,78 @@
1
+ name: Release
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - 'v*.*.*' # v1.0.0, v1.2.3 などの形式
7
+
8
+ jobs:
9
+ release:
10
+ name: Create Release and Build
11
+ runs-on: ubuntu-latest
12
+ permissions:
13
+ contents: write
14
+ steps:
15
+ - uses: actions/checkout@v4
16
+ with:
17
+ fetch-depth: 0
18
+
19
+ - name: Set up Python
20
+ uses: actions/setup-python@v5
21
+ with:
22
+ python-version: '3.10'
23
+
24
+ - name: Install dependencies
25
+ run: |
26
+ python -m pip install --upgrade pip
27
+ pip install build
28
+
29
+ - name: Extract version from tag
30
+ id: get_version
31
+ run: |
32
+ VERSION=${GITHUB_REF#refs/tags/v}
33
+ echo "version=$VERSION" >> $GITHUB_OUTPUT
34
+ echo "Version: $VERSION"
35
+
36
+ - name: Update version in pyproject.toml
37
+ run: |
38
+ VERSION="${{ steps.get_version.outputs.version }}"
39
+ sed -i "s/^version = \".*\"/version = \"$VERSION\"/" pyproject.toml
40
+ cat pyproject.toml | grep version
41
+
42
+ - name: Build package
43
+ run: python -m build
44
+
45
+ - name: Upload dist artifacts
46
+ uses: actions/upload-artifact@v4
47
+ with:
48
+ name: dist
49
+ path: dist/
50
+
51
+ - name: Create GitHub Release
52
+ uses: softprops/action-gh-release@v1
53
+ with:
54
+ files: dist/*
55
+ generate_release_notes: true
56
+ draft: false
57
+ prerelease: false
58
+ env:
59
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
60
+
61
+ publish:
62
+ name: Publish to PyPI
63
+ needs: release
64
+ runs-on: ubuntu-latest
65
+ permissions:
66
+ id-token: write
67
+ environment:
68
+ name: pypi
69
+ url: https://pypi.org/p/ml-networks
70
+ steps:
71
+ - name: Download dist artifacts
72
+ uses: actions/download-artifact@v4
73
+ with:
74
+ name: dist
75
+ path: dist/
76
+
77
+ - name: Publish to PyPI
78
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,113 @@
1
+ name: Version Bump
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ inputs:
6
+ version_type:
7
+ description: 'Version bump type'
8
+ required: true
9
+ type: choice
10
+ options:
11
+ - patch
12
+ - minor
13
+ - major
14
+ create_tag:
15
+ description: 'Create git tag and trigger release'
16
+ required: true
17
+ type: boolean
18
+ default: true
19
+
20
+ jobs:
21
+ bump-version:
22
+ name: Bump Version
23
+ runs-on: ubuntu-latest
24
+ permissions:
25
+ contents: write
26
+ pull-requests: write
27
+ steps:
28
+ - uses: actions/checkout@v4
29
+ with:
30
+ token: ${{ secrets.GITHUB_TOKEN }}
31
+ fetch-depth: 0
32
+
33
+ - name: Set up Python
34
+ uses: actions/setup-python@v5
35
+ with:
36
+ python-version: '3.10'
37
+
38
+ - name: Install dependencies
39
+ run: |
40
+ python -m pip install --upgrade pip
41
+ pip install bump2version
42
+
43
+ - name: Configure git
44
+ run: |
45
+ git config --local user.email "action@github.com"
46
+ git config --local user.name "GitHub Action"
47
+
48
+ - name: Get current version
49
+ id: current_version
50
+ run: |
51
+ CURRENT_VERSION=$(grep '^version = ' pyproject.toml | sed 's/version = "\(.*\)"/\1/')
52
+ echo "current=$CURRENT_VERSION" >> $GITHUB_OUTPUT
53
+ echo "Current version: $CURRENT_VERSION"
54
+
55
+ - name: Bump version
56
+ id: bump_version
57
+ run: |
58
+ VERSION_TYPE="${{ inputs.version_type }}"
59
+ CURRENT_VERSION="${{ steps.current_version.outputs.current }}"
60
+
61
+ # Parse current version
62
+ IFS='.' read -r -a VERSION_PARTS <<< "$CURRENT_VERSION"
63
+ MAJOR="${VERSION_PARTS[0]}"
64
+ MINOR="${VERSION_PARTS[1]}"
65
+ PATCH="${VERSION_PARTS[2]}"
66
+
67
+ # Bump version
68
+ case "$VERSION_TYPE" in
69
+ major)
70
+ MAJOR=$((MAJOR + 1))
71
+ MINOR=0
72
+ PATCH=0
73
+ ;;
74
+ minor)
75
+ MINOR=$((MINOR + 1))
76
+ PATCH=0
77
+ ;;
78
+ patch)
79
+ PATCH=$((PATCH + 1))
80
+ ;;
81
+ esac
82
+
83
+ NEW_VERSION="$MAJOR.$MINOR.$PATCH"
84
+ echo "new=$NEW_VERSION" >> $GITHUB_OUTPUT
85
+ echo "New version: $NEW_VERSION"
86
+
87
+ # Update pyproject.toml
88
+ sed -i "s/^version = \".*\"/version = \"$NEW_VERSION\"/" pyproject.toml
89
+ cat pyproject.toml | grep version
90
+
91
+ - name: Create Pull Request
92
+ if: inputs.create_tag == false
93
+ uses: peter-evans/create-pull-request@v6
94
+ with:
95
+ token: ${{ secrets.GITHUB_TOKEN }}
96
+ commit-message: "Bump version to ${{ steps.bump_version.outputs.new }}"
97
+ title: "Bump version to ${{ steps.bump_version.outputs.new }}"
98
+ body: |
99
+ This PR bumps the version from ${{ steps.current_version.outputs.current }} to ${{ steps.bump_version.outputs.new }}.
100
+
101
+ Version type: **${{ inputs.version_type }}**
102
+ branch: version-bump-${{ steps.bump_version.outputs.new }}
103
+ delete-branch: true
104
+
105
+ - name: Create tag and commit
106
+ if: inputs.create_tag == true
107
+ run: |
108
+ NEW_VERSION="${{ steps.bump_version.outputs.new }}"
109
+ git add pyproject.toml
110
+ git commit -m "Bump version to $NEW_VERSION"
111
+ git tag -a "v$NEW_VERSION" -m "Release v$NEW_VERSION"
112
+ git push origin main
113
+ git push origin "v$NEW_VERSION"
@@ -0,0 +1,75 @@
1
+ # Python-generated files
2
+ __pycache__/
3
+ *.py[oc]
4
+ *.pyc
5
+ *.pyo
6
+ *.pyd
7
+ .Python
8
+ build/
9
+ dist/
10
+ wheels/
11
+ *.egg-info
12
+ *.egg
13
+ *.so
14
+ *.dylib
15
+
16
+ # Virtual environments
17
+ .venv
18
+ venv/
19
+ ENV/
20
+ env/
21
+ .ENV
22
+
23
+ # IDE
24
+ .vscode/
25
+ .idea/
26
+ *.swp
27
+ *.swo
28
+ *~
29
+ .DS_Store
30
+
31
+ # Jupyter Notebook
32
+ .ipynb_checkpoints
33
+ *.ipynb
34
+
35
+ # pytest
36
+ .pytest_cache/
37
+ .coverage
38
+ htmlcov/
39
+ .tox/
40
+
41
+ # mypy
42
+ .mypy_cache/
43
+ .dmypy.json
44
+ dmypy.json
45
+ site/**/*
46
+
47
+ # ruff
48
+ .ruff_cache/
49
+
50
+ # OS
51
+ .DS_Store
52
+ .DS_Store?
53
+ ._*
54
+ .Spotlight-V100
55
+ .Trashes
56
+ ehthumbs.db
57
+ Thumbs.db
58
+
59
+ # Data files
60
+ **/*.blosc2
61
+ *.h5
62
+ *.hdf5
63
+
64
+ # Logs
65
+ *.log
66
+ logs/
67
+
68
+ # Reports (keep directory structure but ignore data files)
69
+ reports/*.blosc2
70
+ reports/*.png
71
+ reports/*.jpg
72
+ reports/*.jpeg
73
+
74
+ # Lock files (optional - uncomment if you want to ignore)
75
+ # uv.lock
@@ -0,0 +1,34 @@
1
+ repos:
2
+ - repo: https://github.com/pre-commit/pre-commit-hooks
3
+ rev: v5.0.0
4
+ hooks:
5
+ - id: trailing-whitespace
6
+ - id: end-of-file-fixer
7
+ - id: check-yaml
8
+ args: [--unsafe]
9
+ - id: check-added-large-files
10
+
11
+ - repo: https://github.com/astral-sh/ruff-pre-commit
12
+ rev: v0.9.7
13
+ hooks:
14
+ - id: ruff
15
+ args: [--fix]
16
+ - id: ruff-format
17
+
18
+ - repo: https://github.com/codespell-project/codespell
19
+ rev: v2.4.1
20
+ hooks:
21
+ - id: codespell
22
+ args:
23
+ - --ignore-words-list=nce,NCE
24
+ additional_dependencies:
25
+ - tomli
26
+
27
+ - repo: https://github.com/pre-commit/mirrors-mypy
28
+ rev: v1.15.0
29
+ hooks:
30
+ - id: mypy
31
+ additional_dependencies:
32
+ - types-requests
33
+ - numpy
34
+ - types-PyYAML
@@ -0,0 +1 @@
1
+ 3.10
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024-2026 oakwood-fujiken, nomutin
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.