torchebm 0.2.4__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.
- torchebm-0.2.4/.github/workflows/docs_ci.yml +129 -0
- torchebm-0.2.4/.github/workflows/publish.yml +39 -0
- torchebm-0.2.4/.github/workflows/tag-release.yml +206 -0
- torchebm-0.2.4/.gitignore +165 -0
- torchebm-0.2.4/LICENSE +21 -0
- torchebm-0.2.4/PKG-INFO +265 -0
- torchebm-0.2.4/README.md +193 -0
- torchebm-0.2.4/__init__.py +1 -0
- torchebm-0.2.4/api_nav_structure.yml +25 -0
- torchebm-0.2.4/docs/api/index.md +111 -0
- torchebm-0.2.4/docs/api/torchebm/core/basesampler/classes/BaseSampler.md +23 -0
- torchebm-0.2.4/docs/api/torchebm/core/basesampler/index.md +31 -0
- torchebm-0.2.4/docs/api/torchebm/core/energy_function/classes/AckleyEnergy.md +23 -0
- torchebm-0.2.4/docs/api/torchebm/core/energy_function/classes/DoubleWellEnergy.md +23 -0
- torchebm-0.2.4/docs/api/torchebm/core/energy_function/classes/EnergyFunction.md +23 -0
- torchebm-0.2.4/docs/api/torchebm/core/energy_function/classes/GaussianEnergy.md +23 -0
- torchebm-0.2.4/docs/api/torchebm/core/energy_function/classes/HarmonicEnergy.md +23 -0
- torchebm-0.2.4/docs/api/torchebm/core/energy_function/classes/RastriginEnergy.md +23 -0
- torchebm-0.2.4/docs/api/torchebm/core/energy_function/classes/RosenbrockEnergy.md +23 -0
- torchebm-0.2.4/docs/api/torchebm/core/energy_function/index.md +37 -0
- torchebm-0.2.4/docs/api/torchebm/core/index.md +36 -0
- torchebm-0.2.4/docs/api/torchebm/core/losses/classes/Loss.md +23 -0
- torchebm-0.2.4/docs/api/torchebm/core/losses/index.md +31 -0
- torchebm-0.2.4/docs/api/torchebm/core/optimizer/classes/Optimizer.md +23 -0
- torchebm-0.2.4/docs/api/torchebm/core/optimizer/index.md +31 -0
- torchebm-0.2.4/docs/api/torchebm/core/score_matching/classes/ScoreMatching.md +23 -0
- torchebm-0.2.4/docs/api/torchebm/core/score_matching/index.md +31 -0
- torchebm-0.2.4/docs/api/torchebm/core/trainer/classes/ContrastiveDivergenceTrainer.md +23 -0
- torchebm-0.2.4/docs/api/torchebm/core/trainer/index.md +31 -0
- torchebm-0.2.4/docs/api/torchebm/cuda/index.md +27 -0
- torchebm-0.2.4/docs/api/torchebm/index.md +36 -0
- torchebm-0.2.4/docs/api/torchebm/losses/contrastive_divergence/classes/ContrastiveDivergence.md +23 -0
- torchebm-0.2.4/docs/api/torchebm/losses/contrastive_divergence/classes/ContrastiveDivergenceBase.md +23 -0
- torchebm-0.2.4/docs/api/torchebm/losses/contrastive_divergence/classes/ParallelTemperingCD.md +23 -0
- torchebm-0.2.4/docs/api/torchebm/losses/contrastive_divergence/classes/PersistentContrastiveDivergence.md +23 -0
- torchebm-0.2.4/docs/api/torchebm/losses/contrastive_divergence/index.md +34 -0
- torchebm-0.2.4/docs/api/torchebm/losses/index.md +31 -0
- torchebm-0.2.4/docs/api/torchebm/models/base_model/classes/BaseModel.md +23 -0
- torchebm-0.2.4/docs/api/torchebm/models/base_model/index.md +31 -0
- torchebm-0.2.4/docs/api/torchebm/models/index.md +31 -0
- torchebm-0.2.4/docs/api/torchebm/samplers/index.md +32 -0
- torchebm-0.2.4/docs/api/torchebm/samplers/langevin_dynamics/classes/LangevinDynamics.md +23 -0
- torchebm-0.2.4/docs/api/torchebm/samplers/langevin_dynamics/index.md +31 -0
- torchebm-0.2.4/docs/api/torchebm/samplers/mcmc/classes/HamiltonianMonteCarlo.md +23 -0
- torchebm-0.2.4/docs/api/torchebm/samplers/mcmc/index.md +31 -0
- torchebm-0.2.4/docs/api/torchebm/utils/index.md +31 -0
- torchebm-0.2.4/docs/assets/images/blog/hamiltonian/non-L-pendulum.png +0 -0
- torchebm-0.2.4/docs/assets/images/blog/hamiltonian/numerical_err.png +0 -0
- torchebm-0.2.4/docs/assets/images/blog/hamiltonian/pendulum_phase_space.mp4 +0 -0
- torchebm-0.2.4/docs/assets/images/blog/hamiltonian/quadratics.png +0 -0
- torchebm-0.2.4/docs/assets/images/e_functions/ackley.png +0 -0
- torchebm-0.2.4/docs/assets/images/e_functions/double_well.png +0 -0
- torchebm-0.2.4/docs/assets/images/e_functions/gaussian.png +0 -0
- torchebm-0.2.4/docs/assets/images/e_functions/harmonic.png +0 -0
- torchebm-0.2.4/docs/assets/images/e_functions/rastrigin.png +0 -0
- torchebm-0.2.4/docs/assets/images/e_functions/rosenbrock.png +0 -0
- torchebm-0.2.4/docs/assets/images/examples/double_well_trajectory.png +0 -0
- torchebm-0.2.4/docs/assets/images/examples/hmc_basic.png +0 -0
- torchebm-0.2.4/docs/assets/images/examples/hmc_comparison.png +0 -0
- torchebm-0.2.4/docs/assets/images/examples/hmc_custom_mass.png +0 -0
- torchebm-0.2.4/docs/assets/images/examples/hmc_standard.png +0 -0
- torchebm-0.2.4/docs/assets/images/examples/langevin_basic.png +0 -0
- torchebm-0.2.4/docs/assets/images/examples/langevin_trajectory.png +0 -0
- torchebm-0.2.4/docs/assets/images/favicon.svg +33 -0
- torchebm-0.2.4/docs/assets/images/logo_with_text.svg +50 -0
- torchebm-0.2.4/docs/assets/images/nabla_icon.svg +176 -0
- torchebm-0.2.4/docs/assets/images/parallel.jpg +0 -0
- torchebm-0.2.4/docs/assets/images/sampling.jpg +0 -0
- torchebm-0.2.4/docs/assets/images/trajectory.jpg +0 -0
- torchebm-0.2.4/docs/assets/images/visualization/advanced_energy_landscape.png +0 -0
- torchebm-0.2.4/docs/assets/images/visualization/basic_energy_landscape.png +0 -0
- torchebm-0.2.4/docs/assets/images/visualization/distribution_comparison.png +0 -0
- torchebm-0.2.4/docs/assets/images/visualization/energy_evolution.png +0 -0
- torchebm-0.2.4/docs/assets/images/visualization/interactive_visualization.png +0 -0
- torchebm-0.2.4/docs/assets/images/visualization/langevin_trajectory.png +0 -0
- torchebm-0.2.4/docs/assets/images/visualization/multiple_chains.png +0 -0
- torchebm-0.2.4/docs/blog/.authors.yml +15 -0
- torchebm-0.2.4/docs/blog/index.md +51 -0
- torchebm-0.2.4/docs/blog/posts/code-examples.md +57 -0
- torchebm-0.2.4/docs/blog/posts/hamiltonian-mechanics.md +723 -0
- torchebm-0.2.4/docs/blog/posts/langevin_dynamics_sampling.md +128 -0
- torchebm-0.2.4/docs/blog/posts/neural_energy_functions.md +12 -0
- torchebm-0.2.4/docs/blog/posts/schrodinger-bridges.md +18 -0
- torchebm-0.2.4/docs/developer_guide/api_design.md +288 -0
- torchebm-0.2.4/docs/developer_guide/api_generation.md +239 -0
- torchebm-0.2.4/docs/developer_guide/architecture.md +159 -0
- torchebm-0.2.4/docs/developer_guide/code_style.md +320 -0
- torchebm-0.2.4/docs/developer_guide/commit_conventions.md +81 -0
- torchebm-0.2.4/docs/developer_guide/contributing.md +249 -0
- torchebm-0.2.4/docs/developer_guide/core_components.md +610 -0
- torchebm-0.2.4/docs/developer_guide/cuda_optimizations.md +629 -0
- torchebm-0.2.4/docs/developer_guide/design_principles.md +321 -0
- torchebm-0.2.4/docs/developer_guide/development_setup.md +184 -0
- torchebm-0.2.4/docs/developer_guide/implementation_energy.md +663 -0
- torchebm-0.2.4/docs/developer_guide/implementation_losses.md +837 -0
- torchebm-0.2.4/docs/developer_guide/implementation_models.md +500 -0
- torchebm-0.2.4/docs/developer_guide/implementation_samplers.md +492 -0
- torchebm-0.2.4/docs/developer_guide/index.md +204 -0
- torchebm-0.2.4/docs/developer_guide/performance.md +301 -0
- torchebm-0.2.4/docs/developer_guide/project_structure.md +248 -0
- torchebm-0.2.4/docs/developer_guide/testing_guide.md +332 -0
- torchebm-0.2.4/docs/examples/core/energy_functions.md +118 -0
- torchebm-0.2.4/docs/examples/energy_visualization.md +201 -0
- torchebm-0.2.4/docs/examples/hmc.md +264 -0
- torchebm-0.2.4/docs/examples/index.md +129 -0
- torchebm-0.2.4/docs/examples/langevin_dynamics.md +280 -0
- torchebm-0.2.4/docs/examples/langevin_trajectory.md +274 -0
- torchebm-0.2.4/docs/examples/samplers/hmc.md +264 -0
- torchebm-0.2.4/docs/examples/samplers/langevin.md +280 -0
- torchebm-0.2.4/docs/examples/visualization/index.md +233 -0
- torchebm-0.2.4/docs/faq.md +153 -0
- torchebm-0.2.4/docs/getting_started.md +92 -0
- torchebm-0.2.4/docs/guides/custom_neural_networks.md +432 -0
- torchebm-0.2.4/docs/guides/energy_functions.md +178 -0
- torchebm-0.2.4/docs/guides/index.md +155 -0
- torchebm-0.2.4/docs/guides/loss_functions.md +210 -0
- torchebm-0.2.4/docs/guides/parallel_sampling.md +26 -0
- torchebm-0.2.4/docs/guides/samplers.md +183 -0
- torchebm-0.2.4/docs/guides/training.md +618 -0
- torchebm-0.2.4/docs/guides/visualization.md +461 -0
- torchebm-0.2.4/docs/hooks/socialmedia.py +29 -0
- torchebm-0.2.4/docs/index.md +348 -0
- torchebm-0.2.4/docs/introduction.md +72 -0
- torchebm-0.2.4/docs/overrides/partials/outdated.html +9 -0
- torchebm-0.2.4/docs/stylesheets/extra.css +265 -0
- torchebm-0.2.4/docs/tags.md +0 -0
- torchebm-0.2.4/examples/README.md +71 -0
- torchebm-0.2.4/examples/core/energy_advanced.py +106 -0
- torchebm-0.2.4/examples/core/energy_basic.py +39 -0
- torchebm-0.2.4/examples/core/energy_functions/landscape_2d.py +39 -0
- torchebm-0.2.4/examples/core/energy_functions/multimodal.py +106 -0
- torchebm-0.2.4/examples/core/energy_functions/parametric.py +50 -0
- torchebm-0.2.4/examples/main.py +88 -0
- torchebm-0.2.4/examples/samplers/hmc/advanced.py +408 -0
- torchebm-0.2.4/examples/samplers/hmc/gaussian_sampling.py +412 -0
- torchebm-0.2.4/examples/samplers/hmc/mass_matrix.py +89 -0
- torchebm-0.2.4/examples/samplers/langevin/advanced.py +246 -0
- torchebm-0.2.4/examples/samplers/langevin/gaussian_sampling.py +246 -0
- torchebm-0.2.4/examples/samplers/langevin/multimodal_sampling.py +164 -0
- torchebm-0.2.4/examples/samplers/langevin/visualization_trajectory.py +201 -0
- torchebm-0.2.4/examples/visualization/advanced/energy_evolution.py +51 -0
- torchebm-0.2.4/examples/visualization/advanced/energy_landscape.py +57 -0
- torchebm-0.2.4/examples/visualization/advanced/energy_over_time.py +51 -0
- torchebm-0.2.4/examples/visualization/advanced/langevin_trajectory.py +83 -0
- torchebm-0.2.4/examples/visualization/advanced/multiple_chains.py +76 -0
- torchebm-0.2.4/examples/visualization/advanced/multiple_doublewell.py +50 -0
- torchebm-0.2.4/examples/visualization/advanced/parallel_chains.py +76 -0
- torchebm-0.2.4/examples/visualization/advanced/trajectory_animation.py +83 -0
- torchebm-0.2.4/examples/visualization/advanced/visualization_examples.py +171 -0
- torchebm-0.2.4/examples/visualization/basic/contour_plots.py +41 -0
- torchebm-0.2.4/examples/visualization/basic/current_energy_fns_vis.py +106 -0
- torchebm-0.2.4/examples/visualization/basic/distribution_comparison.py +93 -0
- torchebm-0.2.4/examples/visualization/basic/energy_fn_vis.py +173 -0
- torchebm-0.2.4/examples/visualization/basic/energy_landscape.py +41 -0
- torchebm-0.2.4/examples/visualization/samplers_vis.py +171 -0
- torchebm-0.2.4/examples/visualization/utils.py +173 -0
- torchebm-0.2.4/generate_api_docs.py +912 -0
- torchebm-0.2.4/mkdocs.yml +278 -0
- torchebm-0.2.4/pyproject.toml +96 -0
- torchebm-0.2.4/requirements-docs.txt +13 -0
- torchebm-0.2.4/requirements.txt +3 -0
- torchebm-0.2.4/setup.cfg +4 -0
- torchebm-0.2.4/tests/conftest.py +33 -0
- torchebm-0.2.4/tests/core/test_energy_function.py +45 -0
- torchebm-0.2.4/tests/samplers/test_hmc.py +522 -0
- torchebm-0.2.4/tests/samplers/test_langevin_dynamics.py +182 -0
- torchebm-0.2.4/torchebm/__init__.py +1 -0
- torchebm-0.2.4/torchebm/_version.py +21 -0
- torchebm-0.2.4/torchebm/core/__init__.py +12 -0
- torchebm-0.2.4/torchebm/core/basesampler.py +104 -0
- torchebm-0.2.4/torchebm/core/energy_function.py +469 -0
- torchebm-0.2.4/torchebm/core/losses.py +17 -0
- torchebm-0.2.4/torchebm/core/optimizer.py +30 -0
- torchebm-0.2.4/torchebm/core/score_matching.py +61 -0
- torchebm-0.2.4/torchebm/core/trainer.py +43 -0
- torchebm-0.2.4/torchebm/cuda/__init__.py +0 -0
- torchebm-0.2.4/torchebm/losses/__init__.py +0 -0
- torchebm-0.2.4/torchebm/losses/contrastive_divergence.py +89 -0
- torchebm-0.2.4/torchebm/models/__init__.py +0 -0
- torchebm-0.2.4/torchebm/models/base_model.py +35 -0
- torchebm-0.2.4/torchebm/samplers/__init__.py +1 -0
- torchebm-0.2.4/torchebm/samplers/langevin_dynamics.py +382 -0
- torchebm-0.2.4/torchebm/samplers/mcmc.py +646 -0
- torchebm-0.2.4/torchebm/utils/__init__.py +3 -0
- torchebm-0.2.4/torchebm/utils/visualization.py +413 -0
- torchebm-0.2.4/torchebm.egg-info/PKG-INFO +265 -0
- torchebm-0.2.4/torchebm.egg-info/SOURCES.txt +188 -0
- torchebm-0.2.4/torchebm.egg-info/dependency_links.txt +1 -0
- torchebm-0.2.4/torchebm.egg-info/requires.txt +25 -0
- torchebm-0.2.4/torchebm.egg-info/top_level.txt +5 -0
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
name: ci
|
|
2
|
+
on:
|
|
3
|
+
push:
|
|
4
|
+
branches:
|
|
5
|
+
- master
|
|
6
|
+
- main
|
|
7
|
+
permissions:
|
|
8
|
+
contents: write
|
|
9
|
+
jobs:
|
|
10
|
+
deploy:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
steps:
|
|
13
|
+
- uses: actions/checkout@v4
|
|
14
|
+
with:
|
|
15
|
+
fetch-depth: 0
|
|
16
|
+
- name: Configure Git Credentials
|
|
17
|
+
run: |
|
|
18
|
+
git config user.name github-actions[bot]
|
|
19
|
+
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
|
|
20
|
+
- uses: actions/setup-python@v5
|
|
21
|
+
with:
|
|
22
|
+
python-version: 3.x
|
|
23
|
+
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
|
|
24
|
+
- uses: actions/cache@v4
|
|
25
|
+
with:
|
|
26
|
+
key: mkdocs-material-${{ env.cache_id }}
|
|
27
|
+
path: .cache
|
|
28
|
+
restore-keys: |
|
|
29
|
+
mkdocs-material-
|
|
30
|
+
- run: |
|
|
31
|
+
python -m pip install -e .[docs]
|
|
32
|
+
pip install -e .
|
|
33
|
+
- name: Generate API Documentation
|
|
34
|
+
run: |
|
|
35
|
+
python generate_api_docs.py
|
|
36
|
+
- name: Extract Version
|
|
37
|
+
run: |
|
|
38
|
+
# Get version from SCM (setuptools_scm)
|
|
39
|
+
python -c "from torchebm._version import version; print(f'VERSION={version}')" >> $GITHUB_ENV
|
|
40
|
+
- name: Setup gh-pages branch
|
|
41
|
+
run: |
|
|
42
|
+
# Initialize gh-pages branch if it doesn't exist
|
|
43
|
+
git fetch origin gh-pages || git checkout --orphan gh-pages
|
|
44
|
+
if ! git show-ref --verify --quiet refs/remotes/origin/gh-pages; then
|
|
45
|
+
# If gh-pages doesn't exist on remote, create it
|
|
46
|
+
git checkout --orphan gh-pages
|
|
47
|
+
git rm -rf .
|
|
48
|
+
touch .nojekyll
|
|
49
|
+
git add .nojekyll
|
|
50
|
+
git commit -m "Initialize gh-pages branch"
|
|
51
|
+
git push -u origin gh-pages
|
|
52
|
+
git checkout -
|
|
53
|
+
else
|
|
54
|
+
# If it exists, ensure we have it locally
|
|
55
|
+
git checkout gh-pages || git checkout -b gh-pages origin/gh-pages
|
|
56
|
+
# Make sure it's up to date
|
|
57
|
+
git pull origin gh-pages
|
|
58
|
+
git checkout -
|
|
59
|
+
fi
|
|
60
|
+
- name: Extract clean version
|
|
61
|
+
run: |
|
|
62
|
+
# Extract clean version without build metadata for mike
|
|
63
|
+
CLEAN_VERSION=$(echo $VERSION | cut -d'+' -f1)
|
|
64
|
+
echo "CLEAN_VERSION=${CLEAN_VERSION}" >> $GITHUB_ENV
|
|
65
|
+
- name: Build Documentation
|
|
66
|
+
run: |
|
|
67
|
+
# Print MkDocs configuration
|
|
68
|
+
echo "MkDocs configuration:"
|
|
69
|
+
cat mkdocs.yml | grep -E "site_dir|docs_dir" || echo "No site_dir or docs_dir specified in mkdocs.yml"
|
|
70
|
+
|
|
71
|
+
# First build the documentation to generate the site directory
|
|
72
|
+
mkdocs build -v
|
|
73
|
+
|
|
74
|
+
# Check the output directory after build
|
|
75
|
+
echo "Directories after build:"
|
|
76
|
+
ls -la
|
|
77
|
+
|
|
78
|
+
# Create .nojekyll file in the root to prevent GitHub Pages from using Jekyll
|
|
79
|
+
touch .nojekyll
|
|
80
|
+
|
|
81
|
+
# Make sure the site directory exists before creating .nojekyll inside it
|
|
82
|
+
if [ -d "site" ]; then
|
|
83
|
+
touch site/.nojekyll
|
|
84
|
+
echo "Site directory found, created .nojekyll inside it"
|
|
85
|
+
else
|
|
86
|
+
echo "Warning: Site directory not found. Checking alternative directories..."
|
|
87
|
+
for dir in public/ _site/ build/ docs/site/ site_docs/; do
|
|
88
|
+
if [ -d "$dir" ]; then
|
|
89
|
+
echo "Found alternative directory: $dir"
|
|
90
|
+
touch "$dir/.nojekyll"
|
|
91
|
+
# Create symlink to make things consistent
|
|
92
|
+
ln -sf "$dir" site
|
|
93
|
+
break
|
|
94
|
+
fi
|
|
95
|
+
done
|
|
96
|
+
fi
|
|
97
|
+
- name: Deploy with Mike
|
|
98
|
+
run: |
|
|
99
|
+
# Check that we have a valid version to deploy
|
|
100
|
+
if [ -z "${CLEAN_VERSION}" ]; then
|
|
101
|
+
echo "Error: No version found to deploy"
|
|
102
|
+
exit 1
|
|
103
|
+
fi
|
|
104
|
+
|
|
105
|
+
echo "Deploying version: ${CLEAN_VERSION}"
|
|
106
|
+
|
|
107
|
+
# List current mike versions
|
|
108
|
+
mike list || echo "No versions found yet"
|
|
109
|
+
|
|
110
|
+
# Print mike configuration
|
|
111
|
+
echo "Mike configuration:"
|
|
112
|
+
mike --help
|
|
113
|
+
|
|
114
|
+
# Verify site directory exists before deploying
|
|
115
|
+
if [ ! -d "site" ]; then
|
|
116
|
+
echo "Error: 'site' directory not found. Cannot deploy with mike."
|
|
117
|
+
exit 1
|
|
118
|
+
fi
|
|
119
|
+
|
|
120
|
+
# Deploy with Mike - first remove latest alias if it exists
|
|
121
|
+
mike delete --push latest || true
|
|
122
|
+
|
|
123
|
+
# Deploy the new version and set it as latest
|
|
124
|
+
mike deploy --push --update-aliases ${CLEAN_VERSION} latest
|
|
125
|
+
|
|
126
|
+
# Set default version to latest
|
|
127
|
+
mike set-default --push latest
|
|
128
|
+
|
|
129
|
+
echo "Deployment completed successfully!"
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- 'v*' # Trigger on version tags like v1.0.0
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
build:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
|
|
12
|
+
steps:
|
|
13
|
+
- name: Checkout code
|
|
14
|
+
uses: actions/checkout@v3
|
|
15
|
+
|
|
16
|
+
- name: Set up Python
|
|
17
|
+
uses: actions/setup-python@v4
|
|
18
|
+
with:
|
|
19
|
+
python-version: '3.10'
|
|
20
|
+
|
|
21
|
+
- name: Install dependencies
|
|
22
|
+
run: |
|
|
23
|
+
python -m pip install --upgrade pip
|
|
24
|
+
pip install -r requirements.txt
|
|
25
|
+
|
|
26
|
+
- name: Run tests
|
|
27
|
+
run: |
|
|
28
|
+
pytest tests/ # Adjust the path to your test directory
|
|
29
|
+
|
|
30
|
+
- name: Build the package
|
|
31
|
+
run: |
|
|
32
|
+
python -m pip install --upgrade build
|
|
33
|
+
python -m build # This will create .tar.gz and .whl files in the dist/ directory
|
|
34
|
+
|
|
35
|
+
- name: Publish to PyPI
|
|
36
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
37
|
+
with:
|
|
38
|
+
username: __token__
|
|
39
|
+
password: ${{ secrets.PYPI_API_TOKEN_EBM }}
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
#name: Release and Publish
|
|
2
|
+
#
|
|
3
|
+
#on:
|
|
4
|
+
# push:
|
|
5
|
+
# branches:
|
|
6
|
+
# - master # Adjust as necessary
|
|
7
|
+
#
|
|
8
|
+
#jobs:
|
|
9
|
+
# release:
|
|
10
|
+
# runs-on: ubuntu-latest
|
|
11
|
+
#
|
|
12
|
+
# steps:
|
|
13
|
+
# - name: Checkout code
|
|
14
|
+
# uses: actions/checkout@v3
|
|
15
|
+
#
|
|
16
|
+
# - name: Get latest tag
|
|
17
|
+
# id: get_latest_tag
|
|
18
|
+
# run: |
|
|
19
|
+
# git fetch --tags
|
|
20
|
+
# TAG=$(git tag --sort=-creatordate | head -n 1)
|
|
21
|
+
# echo "Latest tag is $TAG"
|
|
22
|
+
# echo "::set-output name=latest::$TAG"
|
|
23
|
+
#
|
|
24
|
+
# - name: Determine new version
|
|
25
|
+
# id: new_version
|
|
26
|
+
# run: |
|
|
27
|
+
# latest_tag="${{ steps.get_latest_tag.outputs.latest }}"
|
|
28
|
+
# if [ -z "$latest_tag" ]; then
|
|
29
|
+
# new_version="0.1.0" # No 'v' prefix for version number
|
|
30
|
+
# else
|
|
31
|
+
# # Increment the patch version
|
|
32
|
+
# new_version=$(echo $latest_tag | awk -F. -v OFS=. '{$NF++;print}' | sed 's/^v//')
|
|
33
|
+
# fi
|
|
34
|
+
# echo "New version is $new_version"
|
|
35
|
+
# echo "::set-output name=new_version::$new_version"
|
|
36
|
+
#
|
|
37
|
+
# - name: Update pyproject.toml version
|
|
38
|
+
# run: |
|
|
39
|
+
# sed -i "s/^version = .*/version = \"${{ steps.new_version.outputs.new_version }}\"/" pyproject.toml
|
|
40
|
+
#
|
|
41
|
+
# - name: Create new tag
|
|
42
|
+
# run: |
|
|
43
|
+
# git tag "v${{ steps.new_version.outputs.new_version }}"
|
|
44
|
+
# git push origin "v${{ steps.new_version.outputs.new_version }}"
|
|
45
|
+
#
|
|
46
|
+
# - name: Set up Python
|
|
47
|
+
# uses: actions/setup-python@v4
|
|
48
|
+
# with:
|
|
49
|
+
# python-version: '3.10'
|
|
50
|
+
#
|
|
51
|
+
# - name: Install dependencies
|
|
52
|
+
# run: |
|
|
53
|
+
# python -m pip install --upgrade pip
|
|
54
|
+
# pip install -r requirements.txt
|
|
55
|
+
#
|
|
56
|
+
# - name: Set PYTHONPATH
|
|
57
|
+
# run: echo "PYTHONPATH=$(pwd)/torchebm" >> $GITHUB_ENV
|
|
58
|
+
#
|
|
59
|
+
# - name: Install package
|
|
60
|
+
# run: |
|
|
61
|
+
# pip install .
|
|
62
|
+
#
|
|
63
|
+
# - name: Run tests
|
|
64
|
+
# run: |
|
|
65
|
+
# pytest tests/ # Adjust the path to your test directory
|
|
66
|
+
#
|
|
67
|
+
# - name: Build the package
|
|
68
|
+
# run: |
|
|
69
|
+
# python -m pip install --upgrade build
|
|
70
|
+
# python -m build # This will create .tar.gz and .whl files in the dist/ directory
|
|
71
|
+
#
|
|
72
|
+
# - name: Publish to PyPI
|
|
73
|
+
# uses: pypa/gh-action-pypi-publish@release/v1
|
|
74
|
+
# with:
|
|
75
|
+
# username: __token__ # Use __token__ for token-based authentication
|
|
76
|
+
# password: ${{ secrets.PYPI_API_TOKEN_EBM }}
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
name: Automated Tagging and Release
|
|
80
|
+
|
|
81
|
+
on:
|
|
82
|
+
push:
|
|
83
|
+
branches:
|
|
84
|
+
- master
|
|
85
|
+
|
|
86
|
+
jobs:
|
|
87
|
+
update-tag:
|
|
88
|
+
runs-on: ubuntu-latest
|
|
89
|
+
outputs:
|
|
90
|
+
new_tag: ${{ steps.create_tag.outputs.new_tag }}
|
|
91
|
+
update_type: ${{ steps.get_update_type.outputs.update_type }}
|
|
92
|
+
|
|
93
|
+
steps:
|
|
94
|
+
- name: Checkout code
|
|
95
|
+
uses: actions/checkout@v3
|
|
96
|
+
with:
|
|
97
|
+
fetch-depth: 0
|
|
98
|
+
|
|
99
|
+
- name: Get update type from commit message
|
|
100
|
+
id: get_update_type
|
|
101
|
+
run: |
|
|
102
|
+
commit_message="${{ github.event.head_commit.message }}"
|
|
103
|
+
if [[ "$commit_message" == *"#major"* ]]; then
|
|
104
|
+
echo "update_type=major" >> $GITHUB_OUTPUT
|
|
105
|
+
elif [[ "$commit_message" == *"#minor"* ]]; then
|
|
106
|
+
echo "update_type=minor" >> $GITHUB_OUTPUT
|
|
107
|
+
else
|
|
108
|
+
echo "update_type=patch" >> $GITHUB_OUTPUT
|
|
109
|
+
fi
|
|
110
|
+
|
|
111
|
+
- name: Get latest tag
|
|
112
|
+
id: get_latest_tag
|
|
113
|
+
run: |
|
|
114
|
+
git fetch --tags
|
|
115
|
+
latest_tag=$(git describe --tags `git rev-list --tags --max-count=1` 2>/dev/null || echo "")
|
|
116
|
+
echo "latest_tag=${latest_tag}" >> $GITHUB_OUTPUT
|
|
117
|
+
|
|
118
|
+
- name: Create new tag
|
|
119
|
+
id: create_tag
|
|
120
|
+
run: |
|
|
121
|
+
latest_tag=${{ steps.get_latest_tag.outputs.latest_tag }}
|
|
122
|
+
update_type=${{ steps.get_update_type.outputs.update_type }}
|
|
123
|
+
|
|
124
|
+
if [ -z "$latest_tag" ]; then
|
|
125
|
+
new_tag="v0.1.0"
|
|
126
|
+
else
|
|
127
|
+
IFS='.' read -ra VERSION <<< "${latest_tag#v}"
|
|
128
|
+
major=${VERSION[0]}
|
|
129
|
+
minor=${VERSION[1]}
|
|
130
|
+
patch=${VERSION[2]}
|
|
131
|
+
|
|
132
|
+
case $update_type in
|
|
133
|
+
major)
|
|
134
|
+
major=$((major+1))
|
|
135
|
+
minor=0
|
|
136
|
+
patch=0
|
|
137
|
+
;;
|
|
138
|
+
minor)
|
|
139
|
+
minor=$((minor+1))
|
|
140
|
+
patch=0
|
|
141
|
+
;;
|
|
142
|
+
patch)
|
|
143
|
+
patch=$((patch+1))
|
|
144
|
+
;;
|
|
145
|
+
esac
|
|
146
|
+
|
|
147
|
+
new_tag="v$major.$minor.$patch"
|
|
148
|
+
fi
|
|
149
|
+
|
|
150
|
+
echo "new_tag=${new_tag}" >> $GITHUB_OUTPUT
|
|
151
|
+
git config user.name github-actions
|
|
152
|
+
git config user.email github-actions@github.com
|
|
153
|
+
git tag $new_tag
|
|
154
|
+
git push origin $new_tag
|
|
155
|
+
|
|
156
|
+
release:
|
|
157
|
+
needs: update-tag
|
|
158
|
+
if: contains(github.event.head_commit.message, '#release')
|
|
159
|
+
runs-on: ubuntu-latest
|
|
160
|
+
|
|
161
|
+
steps:
|
|
162
|
+
- name: Checkout code
|
|
163
|
+
uses: actions/checkout@v3
|
|
164
|
+
with:
|
|
165
|
+
fetch-depth: 0
|
|
166
|
+
|
|
167
|
+
- name: Set up Python
|
|
168
|
+
uses: actions/setup-python@v4
|
|
169
|
+
with:
|
|
170
|
+
python-version: '3.10'
|
|
171
|
+
cache: 'pip'
|
|
172
|
+
|
|
173
|
+
- name: Install dependencies
|
|
174
|
+
run: |
|
|
175
|
+
python -m pip install --upgrade pip
|
|
176
|
+
pip install -r requirements.txt
|
|
177
|
+
pip install build twine wheel
|
|
178
|
+
|
|
179
|
+
- name: Install package for testing
|
|
180
|
+
run: pip install -e .
|
|
181
|
+
|
|
182
|
+
- name: Run tests
|
|
183
|
+
run: pytest tests/
|
|
184
|
+
|
|
185
|
+
- name: Build package
|
|
186
|
+
run: |
|
|
187
|
+
python -m build --sdist --wheel
|
|
188
|
+
python -m twine check dist/*
|
|
189
|
+
|
|
190
|
+
- name: Publish to PyPI
|
|
191
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
192
|
+
with:
|
|
193
|
+
username: __token__
|
|
194
|
+
password: ${{ secrets.PYPI_API_TOKEN_EBM }}
|
|
195
|
+
verbose: true
|
|
196
|
+
|
|
197
|
+
- name: Create GitHub Release
|
|
198
|
+
uses: softprops/action-gh-release@v1
|
|
199
|
+
with:
|
|
200
|
+
tag_name: ${{ needs.update-tag.outputs.new_tag }}
|
|
201
|
+
name: Release ${{ needs.update-tag.outputs.new_tag }}
|
|
202
|
+
draft: false
|
|
203
|
+
prerelease: false
|
|
204
|
+
generate_release_notes: true
|
|
205
|
+
env:
|
|
206
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
dist
|
|
15
|
+
downloads/
|
|
16
|
+
eggs/
|
|
17
|
+
.eggs/
|
|
18
|
+
lib/
|
|
19
|
+
lib64/
|
|
20
|
+
parts/
|
|
21
|
+
sdist/
|
|
22
|
+
var/
|
|
23
|
+
wheels/
|
|
24
|
+
share/python-wheels/
|
|
25
|
+
*.egg-info/
|
|
26
|
+
.installed.cfg
|
|
27
|
+
*.egg
|
|
28
|
+
MANIFEST
|
|
29
|
+
|
|
30
|
+
# PyInstaller
|
|
31
|
+
# Usually these files are written by a python script from a template
|
|
32
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
33
|
+
*.manifest
|
|
34
|
+
*.spec
|
|
35
|
+
|
|
36
|
+
# Installer logs
|
|
37
|
+
pip-log.txt
|
|
38
|
+
pip-delete-this-directory.txt
|
|
39
|
+
|
|
40
|
+
# Unit test / coverage reports
|
|
41
|
+
htmlcov/
|
|
42
|
+
.tox/
|
|
43
|
+
.nox/
|
|
44
|
+
.coverage
|
|
45
|
+
.coverage.*
|
|
46
|
+
.cache
|
|
47
|
+
nosetests.xml
|
|
48
|
+
coverage.xml
|
|
49
|
+
*.cover
|
|
50
|
+
*.py,cover
|
|
51
|
+
.hypothesis/
|
|
52
|
+
.pytest_cache/
|
|
53
|
+
cover/
|
|
54
|
+
|
|
55
|
+
# Translations
|
|
56
|
+
*.mo
|
|
57
|
+
*.pot
|
|
58
|
+
|
|
59
|
+
# Django stuff:
|
|
60
|
+
*.log
|
|
61
|
+
local_settings.py
|
|
62
|
+
db.sqlite3
|
|
63
|
+
db.sqlite3-journal
|
|
64
|
+
|
|
65
|
+
# Flask stuff:
|
|
66
|
+
instance/
|
|
67
|
+
.webassets-cache
|
|
68
|
+
|
|
69
|
+
# Scrapy stuff:
|
|
70
|
+
.scrapy
|
|
71
|
+
|
|
72
|
+
# Sphinx documentation
|
|
73
|
+
docs/_build/
|
|
74
|
+
|
|
75
|
+
# PyBuilder
|
|
76
|
+
.pybuilder/
|
|
77
|
+
target/
|
|
78
|
+
|
|
79
|
+
# Jupyter Notebook
|
|
80
|
+
.ipynb_checkpoints
|
|
81
|
+
|
|
82
|
+
# IPython
|
|
83
|
+
profile_default/
|
|
84
|
+
ipython_config.py
|
|
85
|
+
|
|
86
|
+
# pyenv
|
|
87
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
88
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
89
|
+
# .python-version
|
|
90
|
+
|
|
91
|
+
# pipenv
|
|
92
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
93
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
94
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
95
|
+
# install all needed dependencies.
|
|
96
|
+
#Pipfile.lock
|
|
97
|
+
|
|
98
|
+
# poetry
|
|
99
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
100
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
101
|
+
# commonly ignored for libraries.
|
|
102
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
103
|
+
#poetry.lock
|
|
104
|
+
|
|
105
|
+
# pdm
|
|
106
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
107
|
+
#pdm.lock
|
|
108
|
+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
|
109
|
+
# in version control.
|
|
110
|
+
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
|
|
111
|
+
.pdm.toml
|
|
112
|
+
.pdm-python
|
|
113
|
+
.pdm-build/
|
|
114
|
+
|
|
115
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
116
|
+
__pypackages__/
|
|
117
|
+
|
|
118
|
+
# Celery stuff
|
|
119
|
+
celerybeat-schedule
|
|
120
|
+
celerybeat.pid
|
|
121
|
+
|
|
122
|
+
# SageMath parsed files
|
|
123
|
+
*.sage.py
|
|
124
|
+
|
|
125
|
+
# Environments
|
|
126
|
+
.env
|
|
127
|
+
.venv
|
|
128
|
+
env/
|
|
129
|
+
venv/
|
|
130
|
+
ENV/
|
|
131
|
+
env.bak/
|
|
132
|
+
venv.bak/
|
|
133
|
+
|
|
134
|
+
# Spyder project settings
|
|
135
|
+
.spyderproject
|
|
136
|
+
.spyproject
|
|
137
|
+
|
|
138
|
+
# Rope project settings
|
|
139
|
+
.ropeproject
|
|
140
|
+
|
|
141
|
+
# mkdocs documentation
|
|
142
|
+
/site
|
|
143
|
+
|
|
144
|
+
# mypy
|
|
145
|
+
.mypy_cache/
|
|
146
|
+
.dmypy.json
|
|
147
|
+
dmypy.json
|
|
148
|
+
|
|
149
|
+
# Pyre type checker
|
|
150
|
+
.pyre/
|
|
151
|
+
|
|
152
|
+
# pytype static type analyzer
|
|
153
|
+
.pytype/
|
|
154
|
+
|
|
155
|
+
# Cython debug symbols
|
|
156
|
+
cython_debug/
|
|
157
|
+
|
|
158
|
+
# PyCharm
|
|
159
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
160
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
161
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
162
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
163
|
+
#.idea/
|
|
164
|
+
/scope.txt
|
|
165
|
+
/.venv13/
|
torchebm-0.2.4/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 TorchEBM Contributors
|
|
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.
|