guohanghui commited on
Commit
c47daca
·
verified ·
1 Parent(s): 6e728f2

Upload 883 files

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +8 -0
  2. Dockerfile +18 -0
  3. README.md +27 -5
  4. app.py +45 -0
  5. pyro/mcp_output/README_MCP.md +59 -0
  6. pyro/mcp_output/analysis.json +2110 -0
  7. pyro/mcp_output/diff_report.md +63 -0
  8. pyro/mcp_output/mcp_plugin/__init__.py +0 -0
  9. pyro/mcp_output/mcp_plugin/adapter.py +211 -0
  10. pyro/mcp_output/mcp_plugin/main.py +13 -0
  11. pyro/mcp_output/mcp_plugin/mcp_service.py +119 -0
  12. pyro/mcp_output/requirements.txt +9 -0
  13. pyro/mcp_output/start_mcp.py +30 -0
  14. pyro/mcp_output/workflow_summary.json +219 -0
  15. pyro/source/.codecov.yml +14 -0
  16. pyro/source/.coveragerc +21 -0
  17. pyro/source/.readthedocs.yml +23 -0
  18. pyro/source/CODE_OF_CONDUCT.md +53 -0
  19. pyro/source/CONTRIBUTING.md +133 -0
  20. pyro/source/LICENSE.md +202 -0
  21. pyro/source/LICENSES/Apache-2.0.txt +73 -0
  22. pyro/source/LICENSES/BSD-3-Clause.txt +11 -0
  23. pyro/source/LICENSES/MIT.txt +9 -0
  24. pyro/source/MANIFEST.in +2 -0
  25. pyro/source/Makefile +91 -0
  26. pyro/source/README.md +110 -0
  27. pyro/source/RELEASE-MANAGEMENT.md +33 -0
  28. pyro/source/__init__.py +4 -0
  29. pyro/source/docker/Dockerfile +67 -0
  30. pyro/source/docker/Makefile +163 -0
  31. pyro/source/docker/README.md +66 -0
  32. pyro/source/docker/install.sh +43 -0
  33. pyro/source/docs/Makefile +28 -0
  34. pyro/source/docs/README.md +26 -0
  35. pyro/source/docs/requirements.txt +15 -0
  36. pyro/source/docs/source/_static/css/pyro.css +35 -0
  37. pyro/source/docs/source/_static/img/favicon/android-icon-144x144.png +0 -0
  38. pyro/source/docs/source/_static/img/favicon/android-icon-192x192.png +0 -0
  39. pyro/source/docs/source/_static/img/favicon/android-icon-36x36.png +0 -0
  40. pyro/source/docs/source/_static/img/favicon/android-icon-48x48.png +0 -0
  41. pyro/source/docs/source/_static/img/favicon/android-icon-72x72.png +0 -0
  42. pyro/source/docs/source/_static/img/favicon/android-icon-96x96.png +0 -0
  43. pyro/source/docs/source/_static/img/favicon/apple-icon-114x114.png +0 -0
  44. pyro/source/docs/source/_static/img/favicon/apple-icon-120x120.png +0 -0
  45. pyro/source/docs/source/_static/img/favicon/apple-icon-144x144.png +0 -0
  46. pyro/source/docs/source/_static/img/favicon/apple-icon-152x152.png +0 -0
  47. pyro/source/docs/source/_static/img/favicon/apple-icon-180x180.png +0 -0
  48. pyro/source/docs/source/_static/img/favicon/apple-icon-57x57.png +0 -0
  49. pyro/source/docs/source/_static/img/favicon/apple-icon-60x60.png +0 -0
  50. pyro/source/docs/source/_static/img/favicon/apple-icon-72x72.png +0 -0
.gitattributes CHANGED
@@ -33,3 +33,11 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ pyro/source/tutorial/source/_static/img/first_embedding.png filter=lfs diff=lfs merge=lfs -text
37
+ pyro/source/tutorial/source/_static/img/gpr-fit.gif filter=lfs diff=lfs merge=lfs -text
38
+ pyro/source/tutorial/source/_static/img/guide.png filter=lfs diff=lfs merge=lfs -text
39
+ pyro/source/tutorial/source/_static/img/model.png filter=lfs diff=lfs merge=lfs -text
40
+ pyro/source/tutorial/source/_static/img/sir_hmc/forecast.png filter=lfs diff=lfs merge=lfs -text
41
+ pyro/source/tutorial/source/_static/img/ss_vae_zoo.png filter=lfs diff=lfs merge=lfs -text
42
+ pyro/source/tutorial/source/_static/img/svgpr-fit.gif filter=lfs diff=lfs merge=lfs -text
43
+ pyro/source/tutorial/source/_static/img/third_embedding.png filter=lfs diff=lfs merge=lfs -text
Dockerfile ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.10
2
+
3
+ RUN useradd -m -u 1000 user && python -m pip install --upgrade pip
4
+ USER user
5
+ ENV PATH="/home/user/.local/bin:$PATH"
6
+
7
+ WORKDIR /app
8
+
9
+ COPY --chown=user ./requirements.txt requirements.txt
10
+ RUN pip install --no-cache-dir --upgrade -r requirements.txt
11
+
12
+ COPY --chown=user . /app
13
+ ENV MCP_TRANSPORT=http
14
+ ENV MCP_PORT=7860
15
+
16
+ EXPOSE 7860
17
+
18
+ CMD ["python", "pyro/mcp_output/start_mcp.py"]
README.md CHANGED
@@ -1,10 +1,32 @@
1
  ---
2
- title: Pyro
3
- emoji: 🌍
4
- colorFrom: indigo
5
- colorTo: indigo
6
  sdk: docker
 
 
7
  pinned: false
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ title: Pyro MCP
3
+ emoji: 🤖
4
+ colorFrom: blue
5
+ colorTo: purple
6
  sdk: docker
7
+ sdk_version: "4.26.0"
8
+ app_file: app.py
9
  pinned: false
10
  ---
11
 
12
+ # Pyro MCP Service
13
+
14
+ Auto-generated MCP service for pyro.
15
+
16
+ ## Usage
17
+
18
+ ```
19
+ https://None-pyro-mcp.hf.space/mcp
20
+ ```
21
+
22
+ ## Connect with Cursor
23
+
24
+ ```json
25
+ {
26
+ "mcpServers": {
27
+ "pyro": {
28
+ "url": "https://None-pyro-mcp.hf.space/mcp"
29
+ }
30
+ }
31
+ }
32
+ ```
app.py ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from fastapi import FastAPI
2
+ import os
3
+ import sys
4
+
5
+ mcp_plugin_path = os.path.join(os.path.dirname(__file__), "pyro", "mcp_output", "mcp_plugin")
6
+ sys.path.insert(0, mcp_plugin_path)
7
+
8
+ app = FastAPI(
9
+ title="Pyro MCP Service",
10
+ description="Auto-generated MCP service for pyro",
11
+ version="1.0.0"
12
+ )
13
+
14
+ @app.get("/")
15
+ def root():
16
+ return {
17
+ "service": "Pyro MCP Service",
18
+ "version": "1.0.0",
19
+ "status": "running",
20
+ "transport": os.environ.get("MCP_TRANSPORT", "http")
21
+ }
22
+
23
+ @app.get("/health")
24
+ def health_check():
25
+ return {"status": "healthy", "service": "pyro MCP"}
26
+
27
+ @app.get("/tools")
28
+ def list_tools():
29
+ try:
30
+ from mcp_service import create_app
31
+ mcp_app = create_app()
32
+ tools = []
33
+ for tool_name, tool_func in mcp_app.tools.items():
34
+ tools.append({
35
+ "name": tool_name,
36
+ "description": tool_func.__doc__ or "No description available"
37
+ })
38
+ return {"tools": tools}
39
+ except Exception as e:
40
+ return {"error": f"Failed to load tools: {str(e)}"}
41
+
42
+ if __name__ == "__main__":
43
+ import uvicorn
44
+ port = int(os.environ.get("PORT", 7860))
45
+ uvicorn.run(app, host="0.0.0.0", port=port)
pyro/mcp_output/README_MCP.md ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Pyro: Probabilistic Programming with PyTorch
2
+
3
+ ## Project Introduction
4
+
5
+ Pyro is a universal probabilistic programming language (PPL) built on PyTorch. It allows developers to write generative models as Python programs and perform inference over them using a variety of algorithms, including Stochastic Variational Inference (SVI) and Markov Chain Monte Carlo (MCMC). Pyro is designed to be flexible, scalable, and minimal, providing powerful abstractions for probabilistic modeling and inference.
6
+
7
+ ## Installation Method
8
+
9
+ To install Pyro, ensure you have Python 3.8 or higher. You can install Pyro and its core dependencies using pip:
10
+
11
+ ```
12
+ pip install pyro-ppl
13
+ ```
14
+
15
+ Pyro requires `torch` and `numpy` as core dependencies. Optional dependencies include `matplotlib` and `scipy` for enhanced functionality.
16
+
17
+ ## Quick Start
18
+
19
+ Here's a simple example to get you started with Pyro:
20
+
21
+ 1. Import Pyro and necessary modules.
22
+ 2. Define a model using Pyro's primitives like `sample` and `param`.
23
+ 3. Perform inference using SVI or MCMC.
24
+
25
+ Example:
26
+
27
+ ```
28
+ import pyro
29
+ import pyro.distributions as dist
30
+
31
+ def model(data):
32
+ alpha = pyro.param("alpha", torch.tensor(1.0))
33
+ beta = pyro.param("beta", torch.tensor(1.0))
34
+ with pyro.plate("data", len(data)):
35
+ pyro.sample("obs", dist.Beta(alpha, beta), obs=data)
36
+
37
+ # Perform inference using SVI or MCMC
38
+ ```
39
+
40
+ ## Available Tools and Endpoints List
41
+
42
+ - **Core Primitives**: Functions like `sample`, `param`, `plate`, `factor`, and `deterministic` for building probabilistic models.
43
+ - **Effect Handlers (Poutine)**: Tools like `trace`, `replay`, `condition`, `block`, `scale`, and `enum` for intercepting and transforming probabilistic primitives.
44
+ - **Inference Algorithms**: Includes `SVI`, `MCMC`, and `Importance` for performing inference on models.
45
+ - **Distributions**: Extensions to PyTorch's distribution library with additional distributions like `Delta`, `HiddenMarkovModel`, and `Empirical`.
46
+
47
+ ## Common Issues and Notes
48
+
49
+ - **Dependencies**: Ensure that `torch` and `numpy` are installed. Optional dependencies like `matplotlib` and `scipy` can enhance functionality but are not required.
50
+ - **Environment**: Pyro requires Python 3.8 or higher. Ensure your environment is set up accordingly.
51
+ - **Performance**: Pyro is designed to scale with minimal overhead. However, performance can be affected by the complexity of the model and the size of the data.
52
+
53
+ ## Reference Links or Documentation
54
+
55
+ - [Pyro GitHub Repository](https://github.com/pyro-ppl/pyro)
56
+ - [Pyro Documentation](https://pyro.ai/)
57
+ - [Pyro Tutorials](https://pyro.ai/examples/)
58
+
59
+ For more detailed information on Pyro's architecture, design philosophy, and core components, please refer to the official documentation and tutorials.
pyro/mcp_output/analysis.json ADDED
@@ -0,0 +1,2110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "summary": {
3
+ "repository_url": "https://github.com/pyro-ppl/pyro",
4
+ "summary": "Imported via zip fallback, file count: 655",
5
+ "file_tree": {
6
+ ".codecov.yml": {
7
+ "size": 126
8
+ },
9
+ ".github/FUNDING.yml": {
10
+ "size": 812
11
+ },
12
+ ".github/issue_template.md": {
13
+ "size": 975
14
+ },
15
+ ".github/workflows/ci.yml": {
16
+ "size": 10372
17
+ },
18
+ ".github/workflows/publish.yml": {
19
+ "size": 990
20
+ },
21
+ ".readthedocs.yml": {
22
+ "size": 413
23
+ },
24
+ "CODE_OF_CONDUCT.md": {
25
+ "size": 3212
26
+ },
27
+ "CONTRIBUTING.md": {
28
+ "size": 3956
29
+ },
30
+ "LICENSE.md": {
31
+ "size": 11358
32
+ },
33
+ "README.md": {
34
+ "size": 4538
35
+ },
36
+ "RELEASE-MANAGEMENT.md": {
37
+ "size": 1628
38
+ },
39
+ "docker/README.md": {
40
+ "size": 2649
41
+ },
42
+ "docs/README.md": {
43
+ "size": 545
44
+ },
45
+ "docs/requirements.txt": {
46
+ "size": 153
47
+ },
48
+ "docs/source/_static/img/favicon/manifest.json": {
49
+ "size": 720
50
+ },
51
+ "docs/source/conf.py": {
52
+ "size": 6997
53
+ },
54
+ "docs/source/pyro.infer.mcmc.txt": {
55
+ "size": 1053
56
+ },
57
+ "docs/source/pyro.optim.txt": {
58
+ "size": 1181
59
+ },
60
+ "docs/source/pyro.poutine.txt": {
61
+ "size": 3375
62
+ },
63
+ "examples/__init__.py": {
64
+ "size": 0
65
+ },
66
+ "examples/air/air.py": {
67
+ "size": 14031
68
+ },
69
+ "examples/air/main.py": {
70
+ "size": 14628
71
+ },
72
+ "examples/air/modules.py": {
73
+ "size": 2991
74
+ },
75
+ "examples/air/viz.py": {
76
+ "size": 2528
77
+ },
78
+ "examples/baseball.py": {
79
+ "size": 16383
80
+ },
81
+ "examples/capture_recapture/cjs.py": {
82
+ "size": 14374
83
+ },
84
+ "examples/contrib/__init__.py": {
85
+ "size": 0
86
+ },
87
+ "examples/contrib/autoname/mixture.py": {
88
+ "size": 2572
89
+ },
90
+ "examples/contrib/autoname/scoping_mixture.py": {
91
+ "size": 2239
92
+ },
93
+ "examples/contrib/autoname/tree_data.py": {
94
+ "size": 3560
95
+ },
96
+ "examples/contrib/cevae/synthetic.py": {
97
+ "size": 3802
98
+ },
99
+ "examples/contrib/epidemiology/regional.py": {
100
+ "size": 7900
101
+ },
102
+ "examples/contrib/epidemiology/sir.py": {
103
+ "size": 15144
104
+ },
105
+ "examples/contrib/forecast/bart.py": {
106
+ "size": 7530
107
+ },
108
+ "examples/contrib/funsor/__init__.py": {
109
+ "size": 0
110
+ },
111
+ "examples/contrib/funsor/hmm.py": {
112
+ "size": 35805
113
+ },
114
+ "examples/contrib/gp/sv-dkl.py": {
115
+ "size": 8529
116
+ },
117
+ "examples/contrib/mue/FactorMuE.py": {
118
+ "size": 13776
119
+ },
120
+ "examples/contrib/mue/ProfileHMM.py": {
121
+ "size": 10356
122
+ },
123
+ "examples/contrib/oed/ab_test.py": {
124
+ "size": 4658
125
+ },
126
+ "examples/contrib/oed/gp_bayes_opt.py": {
127
+ "size": 5456
128
+ },
129
+ "examples/contrib/timeseries/gp_models.py": {
130
+ "size": 7165
131
+ },
132
+ "examples/cvae/__init__.py": {
133
+ "size": 0
134
+ },
135
+ "examples/cvae/baseline.py": {
136
+ "size": 3456
137
+ },
138
+ "examples/cvae/cvae.py": {
139
+ "size": 6875
140
+ },
141
+ "examples/cvae/main.py": {
142
+ "size": 4147
143
+ },
144
+ "examples/cvae/mnist.py": {
145
+ "size": 3204
146
+ },
147
+ "examples/cvae/util.py": {
148
+ "size": 4845
149
+ },
150
+ "examples/dmm.py": {
151
+ "size": 25355
152
+ },
153
+ "examples/eight_schools/README.md": {
154
+ "size": 672
155
+ },
156
+ "examples/eight_schools/data.py": {
157
+ "size": 249
158
+ },
159
+ "examples/eight_schools/mcmc.py": {
160
+ "size": 1818
161
+ },
162
+ "examples/eight_schools/svi.py": {
163
+ "size": 3025
164
+ },
165
+ "examples/einsum.py": {
166
+ "size": 7580
167
+ },
168
+ "examples/hmm.py": {
169
+ "size": 32364
170
+ },
171
+ "examples/inclined_plane.py": {
172
+ "size": 5455
173
+ },
174
+ "examples/lda.py": {
175
+ "size": 6708
176
+ },
177
+ "examples/lkj.py": {
178
+ "size": 2735
179
+ },
180
+ "examples/minipyro.py": {
181
+ "size": 2971
182
+ },
183
+ "examples/mixed_hmm/README.md": {
184
+ "size": 4517
185
+ },
186
+ "examples/mixed_hmm/__init__.py": {
187
+ "size": 0
188
+ },
189
+ "examples/mixed_hmm/experiment.py": {
190
+ "size": 5959
191
+ },
192
+ "examples/mixed_hmm/model.py": {
193
+ "size": 9884
194
+ },
195
+ "examples/mixed_hmm/seal_data.py": {
196
+ "size": 2549
197
+ },
198
+ "examples/neutra.py": {
199
+ "size": 9381
200
+ },
201
+ "examples/rsa/README.md": {
202
+ "size": 972
203
+ },
204
+ "examples/rsa/generics.py": {
205
+ "size": 5389
206
+ },
207
+ "examples/rsa/hyperbole.py": {
208
+ "size": 6737
209
+ },
210
+ "examples/rsa/schelling.py": {
211
+ "size": 2839
212
+ },
213
+ "examples/rsa/schelling_false.py": {
214
+ "size": 3334
215
+ },
216
+ "examples/rsa/search_inference.py": {
217
+ "size": 7562
218
+ },
219
+ "examples/rsa/semantic_parsing.py": {
220
+ "size": 8669
221
+ },
222
+ "examples/scanvi/__init__.py": {
223
+ "size": 0
224
+ },
225
+ "examples/scanvi/scanvi.py": {
226
+ "size": 16796
227
+ },
228
+ "examples/sir_hmc.py": {
229
+ "size": 24193
230
+ },
231
+ "examples/smcfilter.py": {
232
+ "size": 3358
233
+ },
234
+ "examples/sparse_gamma_def.py": {
235
+ "size": 12095
236
+ },
237
+ "examples/sparse_regression.py": {
238
+ "size": 13613
239
+ },
240
+ "examples/svi_horovod.py": {
241
+ "size": 6668
242
+ },
243
+ "examples/svi_lightning.py": {
244
+ "size": 4919
245
+ },
246
+ "examples/svi_torch.py": {
247
+ "size": 5054
248
+ },
249
+ "examples/toy_mixture_model_discrete_enumeration.py": {
250
+ "size": 5197
251
+ },
252
+ "examples/vae/ss_vae_M2.py": {
253
+ "size": 20428
254
+ },
255
+ "examples/vae/utils/__init__.py": {
256
+ "size": 0
257
+ },
258
+ "examples/vae/utils/custom_mlp.py": {
259
+ "size": 6871
260
+ },
261
+ "examples/vae/utils/mnist_cached.py": {
262
+ "size": 8857
263
+ },
264
+ "examples/vae/utils/vae_plots.py": {
265
+ "size": 3678
266
+ },
267
+ "examples/vae/vae.py": {
268
+ "size": 9201
269
+ },
270
+ "examples/vae/vae_comparison.py": {
271
+ "size": 9094
272
+ },
273
+ "profiler/__init__.py": {
274
+ "size": 0
275
+ },
276
+ "profiler/distributions.py": {
277
+ "size": 5360
278
+ },
279
+ "profiler/gaussianhmm.py": {
280
+ "size": 2678
281
+ },
282
+ "profiler/hmm.py": {
283
+ "size": 2834
284
+ },
285
+ "profiler/profiling_utils.py": {
286
+ "size": 4006
287
+ },
288
+ "pyproject.toml": {
289
+ "size": 100
290
+ },
291
+ "pyro/__init__.py": {
292
+ "size": 1324
293
+ },
294
+ "pyro/contrib/README.md": {
295
+ "size": 608
296
+ },
297
+ "pyro/contrib/__init__.py": {
298
+ "size": 693
299
+ },
300
+ "pyro/contrib/autoguide.py": {
301
+ "size": 317
302
+ },
303
+ "pyro/contrib/autoname/__init__.py": {
304
+ "size": 486
305
+ },
306
+ "pyro/contrib/autoname/autoname.py": {
307
+ "size": 5100
308
+ },
309
+ "pyro/contrib/autoname/named.py": {
310
+ "size": 8618
311
+ },
312
+ "pyro/contrib/autoname/scoping.py": {
313
+ "size": 6482
314
+ },
315
+ "pyro/contrib/bnn/__init__.py": {
316
+ "size": 177
317
+ },
318
+ "pyro/contrib/bnn/hidden_layer.py": {
319
+ "size": 5384
320
+ },
321
+ "pyro/contrib/bnn/utils.py": {
322
+ "size": 490
323
+ },
324
+ "pyro/contrib/cevae/__init__.py": {
325
+ "size": 23079
326
+ },
327
+ "pyro/contrib/conjugate/__init__.py": {
328
+ "size": 0
329
+ },
330
+ "pyro/contrib/conjugate/infer.py": {
331
+ "size": 9073
332
+ },
333
+ "pyro/contrib/easyguide/__init__.py": {
334
+ "size": 206
335
+ },
336
+ "pyro/contrib/easyguide/easyguide.py": {
337
+ "size": 12912
338
+ },
339
+ "pyro/contrib/epidemiology/__init__.py": {
340
+ "size": 406
341
+ },
342
+ "pyro/contrib/epidemiology/compartmental.py": {
343
+ "size": 49835
344
+ },
345
+ "pyro/contrib/epidemiology/distributions.py": {
346
+ "size": 13525
347
+ },
348
+ "pyro/contrib/epidemiology/models.py": {
349
+ "size": 51215
350
+ },
351
+ "pyro/contrib/epidemiology/util.py": {
352
+ "size": 10993
353
+ },
354
+ "pyro/contrib/examples/__init__.py": {
355
+ "size": 0
356
+ },
357
+ "pyro/contrib/examples/bart.py": {
358
+ "size": 6760
359
+ },
360
+ "pyro/contrib/examples/finance.py": {
361
+ "size": 694
362
+ },
363
+ "pyro/contrib/examples/multi_mnist.py": {
364
+ "size": 2920
365
+ },
366
+ "pyro/contrib/examples/nextstrain.py": {
367
+ "size": 1547
368
+ },
369
+ "pyro/contrib/examples/polyphonic_data_loader.py": {
370
+ "size": 6875
371
+ },
372
+ "pyro/contrib/examples/scanvi_data.py": {
373
+ "size": 7442
374
+ },
375
+ "pyro/contrib/examples/util.py": {
376
+ "size": 1556
377
+ },
378
+ "pyro/contrib/forecast/__init__.py": {
379
+ "size": 360
380
+ },
381
+ "pyro/contrib/forecast/evaluate.py": {
382
+ "size": 8823
383
+ },
384
+ "pyro/contrib/forecast/forecaster.py": {
385
+ "size": 23353
386
+ },
387
+ "pyro/contrib/forecast/util.py": {
388
+ "size": 16054
389
+ },
390
+ "pyro/contrib/funsor/__init__.py": {
391
+ "size": 1223
392
+ },
393
+ "pyro/contrib/funsor/handlers/__init__.py": {
394
+ "size": 1408
395
+ },
396
+ "pyro/contrib/funsor/handlers/enum_messenger.py": {
397
+ "size": 9727
398
+ },
399
+ "pyro/contrib/funsor/handlers/named_messenger.py": {
400
+ "size": 7623
401
+ },
402
+ "pyro/contrib/funsor/handlers/plate_messenger.py": {
403
+ "size": 15224
404
+ },
405
+ "pyro/contrib/funsor/handlers/primitives.py": {
406
+ "size": 1076
407
+ },
408
+ "pyro/contrib/funsor/handlers/replay_messenger.py": {
409
+ "size": 1806
410
+ },
411
+ "pyro/contrib/funsor/handlers/runtime.py": {
412
+ "size": 8558
413
+ },
414
+ "pyro/contrib/funsor/handlers/trace_messenger.py": {
415
+ "size": 3632
416
+ },
417
+ "pyro/contrib/funsor/infer/__init__.py": {
418
+ "size": 514
419
+ },
420
+ "pyro/contrib/funsor/infer/discrete.py": {
421
+ "size": 2921
422
+ },
423
+ "pyro/contrib/funsor/infer/elbo.py": {
424
+ "size": 1652
425
+ },
426
+ "pyro/contrib/funsor/infer/trace_elbo.py": {
427
+ "size": 1724
428
+ },
429
+ "pyro/contrib/funsor/infer/traceenum_elbo.py": {
430
+ "size": 12731
431
+ },
432
+ "pyro/contrib/funsor/infer/tracetmc_elbo.py": {
433
+ "size": 1916
434
+ },
435
+ "pyro/contrib/gp/__init__.py": {
436
+ "size": 340
437
+ },
438
+ "pyro/contrib/gp/kernels/__init__.py": {
439
+ "size": 1533
440
+ },
441
+ "pyro/contrib/gp/kernels/brownian.py": {
442
+ "size": 1577
443
+ },
444
+ "pyro/contrib/gp/kernels/coregionalize.py": {
445
+ "size": 3699
446
+ },
447
+ "pyro/contrib/gp/kernels/dot_product.py": {
448
+ "size": 2646
449
+ },
450
+ "pyro/contrib/gp/kernels/isotropic.py": {
451
+ "size": 5740
452
+ },
453
+ "pyro/contrib/gp/kernels/kernel.py": {
454
+ "size": 8446
455
+ },
456
+ "pyro/contrib/gp/kernels/periodic.py": {
457
+ "size": 2424
458
+ },
459
+ "pyro/contrib/gp/kernels/static.py": {
460
+ "size": 1536
461
+ },
462
+ "pyro/contrib/gp/likelihoods/__init__.py": {
463
+ "size": 897
464
+ },
465
+ "pyro/contrib/gp/likelihoods/binary.py": {
466
+ "size": 1988
467
+ },
468
+ "pyro/contrib/gp/likelihoods/gaussian.py": {
469
+ "size": 1677
470
+ },
471
+ "pyro/contrib/gp/likelihoods/likelihood.py": {
472
+ "size": 875
473
+ },
474
+ "pyro/contrib/gp/likelihoods/multi_class.py": {
475
+ "size": 2859
476
+ },
477
+ "pyro/contrib/gp/likelihoods/poisson.py": {
478
+ "size": 1884
479
+ },
480
+ "pyro/contrib/gp/models/__init__.py": {
481
+ "size": 546
482
+ },
483
+ "pyro/contrib/gp/models/gplvm.py": {
484
+ "size": 3897
485
+ },
486
+ "pyro/contrib/gp/models/gpr.py": {
487
+ "size": 8932
488
+ },
489
+ "pyro/contrib/gp/models/model.py": {
490
+ "size": 9145
491
+ },
492
+ "pyro/contrib/gp/models/sgpr.py": {
493
+ "size": 11001
494
+ },
495
+ "pyro/contrib/gp/models/vgp.py": {
496
+ "size": 6859
497
+ },
498
+ "pyro/contrib/gp/models/vsgp.py": {
499
+ "size": 8417
500
+ },
501
+ "pyro/contrib/gp/parameterized.py": {
502
+ "size": 8052
503
+ },
504
+ "pyro/contrib/gp/util.py": {
505
+ "size": 7152
506
+ },
507
+ "pyro/contrib/minipyro.py": {
508
+ "size": 15591
509
+ },
510
+ "pyro/contrib/mue/__init__.py": {
511
+ "size": 0
512
+ },
513
+ "pyro/contrib/mue/dataloaders.py": {
514
+ "size": 6063
515
+ },
516
+ "pyro/contrib/mue/missingdatahmm.py": {
517
+ "size": 13358
518
+ },
519
+ "pyro/contrib/mue/models.py": {
520
+ "size": 34329
521
+ },
522
+ "pyro/contrib/mue/statearrangers.py": {
523
+ "size": 9017
524
+ },
525
+ "pyro/contrib/oed/__init__.py": {
526
+ "size": 3786
527
+ },
528
+ "pyro/contrib/oed/eig.py": {
529
+ "size": 44795
530
+ },
531
+ "pyro/contrib/oed/glmm/__init__.py": {
532
+ "size": 1551
533
+ },
534
+ "pyro/contrib/oed/glmm/glmm.py": {
535
+ "size": 16376
536
+ },
537
+ "pyro/contrib/oed/glmm/guides.py": {
538
+ "size": 11368
539
+ },
540
+ "pyro/contrib/oed/search.py": {
541
+ "size": 867
542
+ },
543
+ "pyro/contrib/oed/util.py": {
544
+ "size": 1230
545
+ },
546
+ "pyro/contrib/randomvariable/__init__.py": {
547
+ "size": 193
548
+ },
549
+ "pyro/contrib/randomvariable/random_variable.py": {
550
+ "size": 5424
551
+ },
552
+ "pyro/contrib/timeseries/__init__.py": {
553
+ "size": 711
554
+ },
555
+ "pyro/contrib/timeseries/base.py": {
556
+ "size": 2211
557
+ },
558
+ "pyro/contrib/timeseries/gp.py": {
559
+ "size": 23486
560
+ },
561
+ "pyro/contrib/timeseries/lgssm.py": {
562
+ "size": 6439
563
+ },
564
+ "pyro/contrib/timeseries/lgssmgp.py": {
565
+ "size": 11260
566
+ },
567
+ "pyro/contrib/tracking/__init__.py": {
568
+ "size": 167
569
+ },
570
+ "pyro/contrib/tracking/assignment.py": {
571
+ "size": 19243
572
+ },
573
+ "pyro/contrib/tracking/distributions.py": {
574
+ "size": 3577
575
+ },
576
+ "pyro/contrib/tracking/dynamic_models.py": {
577
+ "size": 16560
578
+ },
579
+ "pyro/contrib/tracking/extended_kalman_filter.py": {
580
+ "size": 7796
581
+ },
582
+ "pyro/contrib/tracking/hashing.py": {
583
+ "size": 7266
584
+ },
585
+ "pyro/contrib/tracking/measurements.py": {
586
+ "size": 4544
587
+ },
588
+ "pyro/contrib/util.py": {
589
+ "size": 2800
590
+ },
591
+ "pyro/contrib/zuko.py": {
592
+ "size": 2230
593
+ },
594
+ "pyro/distributions/__init__.py": {
595
+ "size": 7555
596
+ },
597
+ "pyro/distributions/affine_beta.py": {
598
+ "size": 3985
599
+ },
600
+ "pyro/distributions/asymmetriclaplace.py": {
601
+ "size": 7367
602
+ },
603
+ "pyro/distributions/avf_mvn.py": {
604
+ "size": 4062
605
+ },
606
+ "pyro/distributions/coalescent.py": {
607
+ "size": 20914
608
+ },
609
+ "pyro/distributions/conditional.py": {
610
+ "size": 4895
611
+ },
612
+ "pyro/distributions/conjugate.py": {
613
+ "size": 10898
614
+ },
615
+ "pyro/distributions/constraints.py": {
616
+ "size": 5739
617
+ },
618
+ "pyro/distributions/delta.py": {
619
+ "size": 3066
620
+ },
621
+ "pyro/distributions/diag_normal_mixture.py": {
622
+ "size": 10433
623
+ },
624
+ "pyro/distributions/diag_normal_mixture_shared_cov.py": {
625
+ "size": 9139
626
+ },
627
+ "pyro/distributions/distribution.py": {
628
+ "size": 8481
629
+ },
630
+ "pyro/distributions/empirical.py": {
631
+ "size": 6765
632
+ },
633
+ "pyro/distributions/extended.py": {
634
+ "size": 1885
635
+ },
636
+ "pyro/distributions/folded.py": {
637
+ "size": 1290
638
+ },
639
+ "pyro/distributions/gaussian_scale_mixture.py": {
640
+ "size": 7983
641
+ },
642
+ "pyro/distributions/grouped_normal_normal.py": {
643
+ "size": 6572
644
+ },
645
+ "pyro/distributions/hmm.py": {
646
+ "size": 54251
647
+ },
648
+ "pyro/distributions/improper_uniform.py": {
649
+ "size": 2448
650
+ },
651
+ "pyro/distributions/inverse_gamma.py": {
652
+ "size": 1489
653
+ },
654
+ "pyro/distributions/kl.py": {
655
+ "size": 1661
656
+ },
657
+ "pyro/distributions/lkj.py": {
658
+ "size": 2534
659
+ },
660
+ "pyro/distributions/log_normal_negative_binomial.py": {
661
+ "size": 5720
662
+ },
663
+ "pyro/distributions/logistic.py": {
664
+ "size": 5473
665
+ },
666
+ "pyro/distributions/mixture.py": {
667
+ "size": 6150
668
+ },
669
+ "pyro/distributions/multivariate_studentt.py": {
670
+ "size": 5193
671
+ },
672
+ "pyro/distributions/nanmasked.py": {
673
+ "size": 3381
674
+ },
675
+ "pyro/distributions/omt_mvn.py": {
676
+ "size": 3176
677
+ },
678
+ "pyro/distributions/one_one_matching.py": {
679
+ "size": 6714
680
+ },
681
+ "pyro/distributions/one_two_matching.py": {
682
+ "size": 8193
683
+ },
684
+ "pyro/distributions/ordered_logistic.py": {
685
+ "size": 2874
686
+ },
687
+ "pyro/distributions/polya_gamma.py": {
688
+ "size": 3090
689
+ },
690
+ "pyro/distributions/projected_normal.py": {
691
+ "size": 7441
692
+ },
693
+ "pyro/distributions/rejector.py": {
694
+ "size": 2933
695
+ },
696
+ "pyro/distributions/relaxed_straight_through.py": {
697
+ "size": 3637
698
+ },
699
+ "pyro/distributions/score_parts.py": {
700
+ "size": 1282
701
+ },
702
+ "pyro/distributions/sine_bivariate_von_mises.py": {
703
+ "size": 11562
704
+ },
705
+ "pyro/distributions/sine_skewed.py": {
706
+ "size": 7372
707
+ },
708
+ "pyro/distributions/softlaplace.py": {
709
+ "size": 2471
710
+ },
711
+ "pyro/distributions/spanning_tree.py": {
712
+ "size": 22257
713
+ },
714
+ "pyro/distributions/stable.py": {
715
+ "size": 9997
716
+ },
717
+ "pyro/distributions/stable_log_prob.py": {
718
+ "size": 6573
719
+ },
720
+ "pyro/distributions/testing/__init__.py": {
721
+ "size": 215
722
+ },
723
+ "pyro/distributions/testing/fakes.py": {
724
+ "size": 421
725
+ },
726
+ "pyro/distributions/testing/gof.py": {
727
+ "size": 10761
728
+ },
729
+ "pyro/distributions/testing/naive_dirichlet.py": {
730
+ "size": 1598
731
+ },
732
+ "pyro/distributions/testing/rejection_exponential.py": {
733
+ "size": 1167
734
+ },
735
+ "pyro/distributions/testing/rejection_gamma.py": {
736
+ "size": 8842
737
+ },
738
+ "pyro/distributions/testing/special.py": {
739
+ "size": 3610
740
+ },
741
+ "pyro/distributions/torch.py": {
742
+ "size": 15147
743
+ },
744
+ "pyro/distributions/torch_distribution.py": {
745
+ "size": 20865
746
+ },
747
+ "pyro/distributions/torch_patch.py": {
748
+ "size": 3044
749
+ },
750
+ "pyro/distributions/torch_transform.py": {
751
+ "size": 1452
752
+ },
753
+ "pyro/distributions/transforms/__init__.py": {
754
+ "size": 8118
755
+ },
756
+ "pyro/distributions/transforms/affine_autoregressive.py": {
757
+ "size": 16342
758
+ },
759
+ "pyro/distributions/transforms/affine_coupling.py": {
760
+ "size": 15805
761
+ },
762
+ "pyro/distributions/transforms/basic.py": {
763
+ "size": 2073
764
+ },
765
+ "pyro/distributions/transforms/batchnorm.py": {
766
+ "size": 6147
767
+ },
768
+ "pyro/distributions/transforms/block_autoregressive.py": {
769
+ "size": 11703
770
+ },
771
+ "pyro/distributions/transforms/cholesky.py": {
772
+ "size": 2117
773
+ },
774
+ "pyro/distributions/transforms/discrete_cosine.py": {
775
+ "size": 3383
776
+ },
777
+ "pyro/distributions/transforms/generalized_channel_permute.py": {
778
+ "size": 11680
779
+ },
780
+ "pyro/distributions/transforms/haar.py": {
781
+ "size": 2883
782
+ },
783
+ "pyro/distributions/transforms/householder.py": {
784
+ "size": 10536
785
+ },
786
+ "pyro/distributions/transforms/lower_cholesky_affine.py": {
787
+ "size": 2479
788
+ },
789
+ "pyro/distributions/transforms/matrix_exponential.py": {
790
+ "size": 13725
791
+ },
792
+ "pyro/distributions/transforms/neural_autoregressive.py": {
793
+ "size": 9794
794
+ },
795
+ "pyro/distributions/transforms/normalize.py": {
796
+ "size": 1072
797
+ },
798
+ "pyro/distributions/transforms/ordered.py": {
799
+ "size": 921
800
+ },
801
+ "pyro/distributions/transforms/permute.py": {
802
+ "size": 5300
803
+ },
804
+ "pyro/distributions/transforms/planar.py": {
805
+ "size": 8881
806
+ },
807
+ "pyro/distributions/transforms/polynomial.py": {
808
+ "size": 7076
809
+ },
810
+ "pyro/distributions/transforms/power.py": {
811
+ "size": 2139
812
+ },
813
+ "pyro/distributions/transforms/radial.py": {
814
+ "size": 8711
815
+ },
816
+ "pyro/distributions/transforms/simplex_to_ordered.py": {
817
+ "size": 2527
818
+ },
819
+ "pyro/distributions/transforms/softplus.py": {
820
+ "size": 1665
821
+ },
822
+ "pyro/distributions/transforms/spline.py": {
823
+ "size": 24458
824
+ },
825
+ "pyro/distributions/transforms/spline_autoregressive.py": {
826
+ "size": 11370
827
+ },
828
+ "pyro/distributions/transforms/spline_coupling.py": {
829
+ "size": 6917
830
+ },
831
+ "pyro/distributions/transforms/sylvester.py": {
832
+ "size": 6318
833
+ },
834
+ "pyro/distributions/transforms/unit_cholesky.py": {
835
+ "size": 809
836
+ },
837
+ "pyro/distributions/transforms/utils.py": {
838
+ "size": 282
839
+ },
840
+ "pyro/distributions/unit.py": {
841
+ "size": 1886
842
+ },
843
+ "pyro/distributions/util.py": {
844
+ "size": 11913
845
+ },
846
+ "pyro/distributions/von_mises_3d.py": {
847
+ "size": 2694
848
+ },
849
+ "pyro/distributions/zero_inflated.py": {
850
+ "size": 6893
851
+ },
852
+ "pyro/generic.py": {
853
+ "size": 266
854
+ },
855
+ "pyro/infer/__init__.py": {
856
+ "size": 2195
857
+ },
858
+ "pyro/infer/abstract_infer.py": {
859
+ "size": 15986
860
+ },
861
+ "pyro/infer/autoguide/__init__.py": {
862
+ "size": 1618
863
+ },
864
+ "pyro/infer/autoguide/effect.py": {
865
+ "size": 19652
866
+ },
867
+ "pyro/infer/autoguide/gaussian.py": {
868
+ "size": 26015
869
+ },
870
+ "pyro/infer/autoguide/guides.py": {
871
+ "size": 49204
872
+ },
873
+ "pyro/infer/autoguide/initialization.py": {
874
+ "size": 8270
875
+ },
876
+ "pyro/infer/autoguide/structured.py": {
877
+ "size": 16327
878
+ },
879
+ "pyro/infer/autoguide/utils.py": {
880
+ "size": 3089
881
+ },
882
+ "pyro/infer/csis.py": {
883
+ "size": 7251
884
+ },
885
+ "pyro/infer/discrete.py": {
886
+ "size": 11547
887
+ },
888
+ "pyro/infer/elbo.py": {
889
+ "size": 9535
890
+ },
891
+ "pyro/infer/energy_distance.py": {
892
+ "size": 10044
893
+ },
894
+ "pyro/infer/enum.py": {
895
+ "size": 8063
896
+ },
897
+ "pyro/infer/importance.py": {
898
+ "size": 9786
899
+ },
900
+ "pyro/infer/inspect.py": {
901
+ "size": 23989
902
+ },
903
+ "pyro/infer/mcmc/__init__.py": {
904
+ "size": 490
905
+ },
906
+ "pyro/infer/mcmc/adaptation.py": {
907
+ "size": 23000
908
+ },
909
+ "pyro/infer/mcmc/api.py": {
910
+ "size": 29278
911
+ },
912
+ "pyro/infer/mcmc/hmc.py": {
913
+ "size": 18825
914
+ },
915
+ "pyro/infer/mcmc/logger.py": {
916
+ "size": 9270
917
+ },
918
+ "pyro/infer/mcmc/mcmc_kernel.py": {
919
+ "size": 2347
920
+ },
921
+ "pyro/infer/mcmc/nuts.py": {
922
+ "size": 21893
923
+ },
924
+ "pyro/infer/mcmc/rwkernel.py": {
925
+ "size": 4827
926
+ },
927
+ "pyro/infer/mcmc/util.py": {
928
+ "size": 33005
929
+ },
930
+ "pyro/infer/predictive.py": {
931
+ "size": 25794
932
+ },
933
+ "pyro/infer/renyi_elbo.py": {
934
+ "size": 9418
935
+ },
936
+ "pyro/infer/reparam/__init__.py": {
937
+ "size": 1239
938
+ },
939
+ "pyro/infer/reparam/conjugate.py": {
940
+ "size": 4315
941
+ },
942
+ "pyro/infer/reparam/discrete_cosine.py": {
943
+ "size": 2076
944
+ },
945
+ "pyro/infer/reparam/haar.py": {
946
+ "size": 1594
947
+ },
948
+ "pyro/infer/reparam/hmm.py": {
949
+ "size": 6406
950
+ },
951
+ "pyro/infer/reparam/loc_scale.py": {
952
+ "size": 3812
953
+ },
954
+ "pyro/infer/reparam/neutra.py": {
955
+ "size": 5549
956
+ },
957
+ "pyro/infer/reparam/projected_normal.py": {
958
+ "size": 1697
959
+ },
960
+ "pyro/infer/reparam/reparam.py": {
961
+ "size": 2505
962
+ },
963
+ "pyro/infer/reparam/softmax.py": {
964
+ "size": 1869
965
+ },
966
+ "pyro/infer/reparam/split.py": {
967
+ "size": 2642
968
+ },
969
+ "pyro/infer/reparam/stable.py": {
970
+ "size": 10548
971
+ },
972
+ "pyro/infer/reparam/strategies.py": {
973
+ "size": 7528
974
+ },
975
+ "pyro/infer/reparam/structured.py": {
976
+ "size": 4312
977
+ },
978
+ "pyro/infer/reparam/studentt.py": {
979
+ "size": 1477
980
+ },
981
+ "pyro/infer/reparam/transform.py": {
982
+ "size": 1789
983
+ },
984
+ "pyro/infer/reparam/unit_jacobian.py": {
985
+ "size": 3913
986
+ },
987
+ "pyro/infer/resampler.py": {
988
+ "size": 5720
989
+ },
990
+ "pyro/infer/rws.py": {
991
+ "size": 11139
992
+ },
993
+ "pyro/infer/smcfilter.py": {
994
+ "size": 8713
995
+ },
996
+ "pyro/infer/svgd.py": {
997
+ "size": 12959
998
+ },
999
+ "pyro/infer/svi.py": {
1000
+ "size": 5947
1001
+ },
1002
+ "pyro/infer/trace_elbo.py": {
1003
+ "size": 10334
1004
+ },
1005
+ "pyro/infer/trace_mean_field_elbo.py": {
1006
+ "size": 8302
1007
+ },
1008
+ "pyro/infer/trace_mmd.py": {
1009
+ "size": 10876
1010
+ },
1011
+ "pyro/infer/trace_tail_adaptive_elbo.py": {
1012
+ "size": 3367
1013
+ },
1014
+ "pyro/infer/traceenum_elbo.py": {
1015
+ "size": 23531
1016
+ },
1017
+ "pyro/infer/tracegraph_elbo.py": {
1018
+ "size": 16978
1019
+ },
1020
+ "pyro/infer/tracetmc_elbo.py": {
1021
+ "size": 8714
1022
+ },
1023
+ "pyro/infer/util.py": {
1024
+ "size": 13697
1025
+ },
1026
+ "pyro/logger.py": {
1027
+ "size": 463
1028
+ },
1029
+ "pyro/nn/__init__.py": {
1030
+ "size": 665
1031
+ },
1032
+ "pyro/nn/auto_reg_nn.py": {
1033
+ "size": 14482
1034
+ },
1035
+ "pyro/nn/dense_nn.py": {
1036
+ "size": 5553
1037
+ },
1038
+ "pyro/nn/module.py": {
1039
+ "size": 40033
1040
+ },
1041
+ "pyro/ops/__init__.py": {
1042
+ "size": 0
1043
+ },
1044
+ "pyro/ops/arrowhead.py": {
1045
+ "size": 4306
1046
+ },
1047
+ "pyro/ops/contract.py": {
1048
+ "size": 22550
1049
+ },
1050
+ "pyro/ops/dual_averaging.py": {
1051
+ "size": 3402
1052
+ },
1053
+ "pyro/ops/einsum/__init__.py": {
1054
+ "size": 1486
1055
+ },
1056
+ "pyro/ops/einsum/adjoint.py": {
1057
+ "size": 4971
1058
+ },
1059
+ "pyro/ops/einsum/torch_log.py": {
1060
+ "size": 2010
1061
+ },
1062
+ "pyro/ops/einsum/torch_map.py": {
1063
+ "size": 1952
1064
+ },
1065
+ "pyro/ops/einsum/torch_marginal.py": {
1066
+ "size": 2234
1067
+ },
1068
+ "pyro/ops/einsum/torch_sample.py": {
1069
+ "size": 2736
1070
+ },
1071
+ "pyro/ops/einsum/util.py": {
1072
+ "size": 1901
1073
+ },
1074
+ "pyro/ops/gamma_gaussian.py": {
1075
+ "size": 17941
1076
+ },
1077
+ "pyro/ops/gaussian.py": {
1078
+ "size": 28119
1079
+ },
1080
+ "pyro/ops/hessian.py": {
1081
+ "size": 673
1082
+ },
1083
+ "pyro/ops/indexing.py": {
1084
+ "size": 7458
1085
+ },
1086
+ "pyro/ops/integrator.py": {
1087
+ "size": 5119
1088
+ },
1089
+ "pyro/ops/jit.py": {
1090
+ "size": 5970
1091
+ },
1092
+ "pyro/ops/linalg.py": {
1093
+ "size": 3577
1094
+ },
1095
+ "pyro/ops/newton.py": {
1096
+ "size": 9520
1097
+ },
1098
+ "pyro/ops/packed.py": {
1099
+ "size": 6350
1100
+ },
1101
+ "pyro/ops/provenance.py": {
1102
+ "size": 5764
1103
+ },
1104
+ "pyro/ops/rings.py": {
1105
+ "size": 11388
1106
+ },
1107
+ "pyro/ops/special.py": {
1108
+ "size": 7046
1109
+ },
1110
+ "pyro/ops/ssm_gp.py": {
1111
+ "size": 6648
1112
+ },
1113
+ "pyro/ops/stats.py": {
1114
+ "size": 22039
1115
+ },
1116
+ "pyro/ops/streaming.py": {
1117
+ "size": 8903
1118
+ },
1119
+ "pyro/ops/tensor_utils.py": {
1120
+ "size": 15783
1121
+ },
1122
+ "pyro/ops/welford.py": {
1123
+ "size": 3405
1124
+ },
1125
+ "pyro/optim/__init__.py": {
1126
+ "size": 594
1127
+ },
1128
+ "pyro/optim/adagrad_rmsprop.py": {
1129
+ "size": 3060
1130
+ },
1131
+ "pyro/optim/clipped_adam.py": {
1132
+ "size": 3462
1133
+ },
1134
+ "pyro/optim/dct_adam.py": {
1135
+ "size": 7634
1136
+ },
1137
+ "pyro/optim/horovod.py": {
1138
+ "size": 1906
1139
+ },
1140
+ "pyro/optim/lr_scheduler.py": {
1141
+ "size": 2351
1142
+ },
1143
+ "pyro/optim/multi.py": {
1144
+ "size": 6391
1145
+ },
1146
+ "pyro/optim/optim.py": {
1147
+ "size": 10610
1148
+ },
1149
+ "pyro/optim/pytorch_optimizers.py": {
1150
+ "size": 1805
1151
+ },
1152
+ "pyro/params/__init__.py": {
1153
+ "size": 317
1154
+ },
1155
+ "pyro/params/param_store.py": {
1156
+ "size": 14507
1157
+ },
1158
+ "pyro/poutine/__init__.py": {
1159
+ "size": 922
1160
+ },
1161
+ "pyro/poutine/block_messenger.py": {
1162
+ "size": 5614
1163
+ },
1164
+ "pyro/poutine/broadcast_messenger.py": {
1165
+ "size": 3722
1166
+ },
1167
+ "pyro/poutine/collapse_messenger.py": {
1168
+ "size": 6395
1169
+ },
1170
+ "pyro/poutine/condition_messenger.py": {
1171
+ "size": 2367
1172
+ },
1173
+ "pyro/poutine/do_messenger.py": {
1174
+ "size": 3476
1175
+ },
1176
+ "pyro/poutine/enum_messenger.py": {
1177
+ "size": 10711
1178
+ },
1179
+ "pyro/poutine/escape_messenger.py": {
1180
+ "size": 1339
1181
+ },
1182
+ "pyro/poutine/guide.py": {
1183
+ "size": 6163
1184
+ },
1185
+ "pyro/poutine/handlers.py": {
1186
+ "size": 17835
1187
+ },
1188
+ "pyro/poutine/indep_messenger.py": {
1189
+ "size": 4435
1190
+ },
1191
+ "pyro/poutine/infer_config_messenger.py": {
1192
+ "size": 1997
1193
+ },
1194
+ "pyro/poutine/lift_messenger.py": {
1195
+ "size": 5224
1196
+ },
1197
+ "pyro/poutine/markov_messenger.py": {
1198
+ "size": 3658
1199
+ },
1200
+ "pyro/poutine/mask_messenger.py": {
1201
+ "size": 1394
1202
+ },
1203
+ "pyro/poutine/messenger.py": {
1204
+ "size": 9474
1205
+ },
1206
+ "pyro/poutine/plate_messenger.py": {
1207
+ "size": 3167
1208
+ },
1209
+ "pyro/poutine/reentrant_messenger.py": {
1210
+ "size": 1031
1211
+ },
1212
+ "pyro/poutine/reparam_messenger.py": {
1213
+ "size": 6175
1214
+ },
1215
+ "pyro/poutine/replay_messenger.py": {
1216
+ "size": 3310
1217
+ },
1218
+ "pyro/poutine/runtime.py": {
1219
+ "size": 16650
1220
+ },
1221
+ "pyro/poutine/scale_messenger.py": {
1222
+ "size": 1975
1223
+ },
1224
+ "pyro/poutine/seed_messenger.py": {
1225
+ "size": 1308
1226
+ },
1227
+ "pyro/poutine/subsample_messenger.py": {
1228
+ "size": 8509
1229
+ },
1230
+ "pyro/poutine/substitute_messenger.py": {
1231
+ "size": 3295
1232
+ },
1233
+ "pyro/poutine/trace_messenger.py": {
1234
+ "size": 7701
1235
+ },
1236
+ "pyro/poutine/trace_struct.py": {
1237
+ "size": 22785
1238
+ },
1239
+ "pyro/poutine/uncondition_messenger.py": {
1240
+ "size": 982
1241
+ },
1242
+ "pyro/poutine/util.py": {
1243
+ "size": 4790
1244
+ },
1245
+ "pyro/primitives.py": {
1246
+ "size": 24368
1247
+ },
1248
+ "pyro/settings.py": {
1249
+ "size": 5019
1250
+ },
1251
+ "pyro/util.py": {
1252
+ "size": 22051
1253
+ },
1254
+ "scripts/update_headers.py": {
1255
+ "size": 2276
1256
+ },
1257
+ "scripts/update_version.py": {
1258
+ "size": 1188
1259
+ },
1260
+ "setup.cfg": {
1261
+ "size": 2382
1262
+ },
1263
+ "setup.py": {
1264
+ "size": 4938
1265
+ },
1266
+ "tests/README.md": {
1267
+ "size": 1962
1268
+ },
1269
+ "tests/__init__.py": {
1270
+ "size": 282
1271
+ },
1272
+ "tests/common.py": {
1273
+ "size": 9455
1274
+ },
1275
+ "tests/conftest.py": {
1276
+ "size": 3380
1277
+ },
1278
+ "tests/contrib/__init__.py": {
1279
+ "size": 0
1280
+ },
1281
+ "tests/contrib/autoname/test_autoname.py": {
1282
+ "size": 9663
1283
+ },
1284
+ "tests/contrib/autoname/test_named.py": {
1285
+ "size": 3676
1286
+ },
1287
+ "tests/contrib/autoname/test_scoping.py": {
1288
+ "size": 4628
1289
+ },
1290
+ "tests/contrib/bnn/test_hidden_layer.py": {
1291
+ "size": 2100
1292
+ },
1293
+ "tests/contrib/cevae/test_cevae.py": {
1294
+ "size": 2368
1295
+ },
1296
+ "tests/contrib/conftest.py": {
1297
+ "size": 449
1298
+ },
1299
+ "tests/contrib/easyguide/test_easyguide.py": {
1300
+ "size": 8598
1301
+ },
1302
+ "tests/contrib/epidemiology/__init__.py": {
1303
+ "size": 0
1304
+ },
1305
+ "tests/contrib/epidemiology/test_distributions.py": {
1306
+ "size": 9012
1307
+ },
1308
+ "tests/contrib/epidemiology/test_models.py": {
1309
+ "size": 22313
1310
+ },
1311
+ "tests/contrib/epidemiology/test_quant.py": {
1312
+ "size": 925
1313
+ },
1314
+ "tests/contrib/epidemiology/test_util.py": {
1315
+ "size": 1492
1316
+ },
1317
+ "tests/contrib/forecast/__init__.py": {
1318
+ "size": 0
1319
+ },
1320
+ "tests/contrib/forecast/test_evaluate.py": {
1321
+ "size": 4477
1322
+ },
1323
+ "tests/contrib/forecast/test_forecaster.py": {
1324
+ "size": 11591
1325
+ },
1326
+ "tests/contrib/forecast/test_util.py": {
1327
+ "size": 5539
1328
+ },
1329
+ "tests/contrib/funsor/conftest.py": {
1330
+ "size": 602
1331
+ },
1332
+ "tests/contrib/funsor/test_enum_funsor.py": {
1333
+ "size": 71964
1334
+ },
1335
+ "tests/contrib/funsor/test_infer_discrete.py": {
1336
+ "size": 16722
1337
+ },
1338
+ "tests/contrib/funsor/test_named_handlers.py": {
1339
+ "size": 5329
1340
+ },
1341
+ "tests/contrib/funsor/test_pyroapi_funsor.py": {
1342
+ "size": 488
1343
+ },
1344
+ "tests/contrib/funsor/test_tmc.py": {
1345
+ "size": 7191
1346
+ },
1347
+ "tests/contrib/funsor/test_valid_models_enum.py": {
1348
+ "size": 17970
1349
+ },
1350
+ "tests/contrib/funsor/test_valid_models_plate.py": {
1351
+ "size": 7546
1352
+ },
1353
+ "tests/contrib/funsor/test_valid_models_sequential_plate.py": {
1354
+ "size": 4418
1355
+ },
1356
+ "tests/contrib/funsor/test_vectorized_markov.py": {
1357
+ "size": 30783
1358
+ },
1359
+ "tests/contrib/gp/__init__.py": {
1360
+ "size": 0
1361
+ },
1362
+ "tests/contrib/gp/test_conditional.py": {
1363
+ "size": 2750
1364
+ },
1365
+ "tests/contrib/gp/test_kernels.py": {
1366
+ "size": 4744
1367
+ },
1368
+ "tests/contrib/gp/test_likelihoods.py": {
1369
+ "size": 4731
1370
+ },
1371
+ "tests/contrib/gp/test_models.py": {
1372
+ "size": 15042
1373
+ },
1374
+ "tests/contrib/gp/test_parameterized.py": {
1375
+ "size": 4723
1376
+ },
1377
+ "tests/contrib/mue/test_dataloaders.py": {
1378
+ "size": 3607
1379
+ },
1380
+ "tests/contrib/mue/test_missingdatahmm.py": {
1381
+ "size": 18642
1382
+ },
1383
+ "tests/contrib/mue/test_models.py": {
1384
+ "size": 3213
1385
+ },
1386
+ "tests/contrib/mue/test_statearrangers.py": {
1387
+ "size": 10625
1388
+ },
1389
+ "tests/contrib/oed/test_ewma.py": {
1390
+ "size": 1464
1391
+ },
1392
+ "tests/contrib/oed/test_finite_spaces_eig.py": {
1393
+ "size": 7851
1394
+ },
1395
+ "tests/contrib/oed/test_glmm.py": {
1396
+ "size": 5729
1397
+ },
1398
+ "tests/contrib/oed/test_linear_models_eig.py": {
1399
+ "size": 9466
1400
+ },
1401
+ "tests/contrib/oed/test_xexpx.py": {
1402
+ "size": 470
1403
+ },
1404
+ "tests/contrib/randomvariable/test_random_variable.py": {
1405
+ "size": 1893
1406
+ },
1407
+ "tests/contrib/test_hessian.py": {
1408
+ "size": 853
1409
+ },
1410
+ "tests/contrib/test_minipyro.py": {
1411
+ "size": 8701
1412
+ },
1413
+ "tests/contrib/test_util.py": {
1414
+ "size": 3036
1415
+ },
1416
+ "tests/contrib/test_zuko.py": {
1417
+ "size": 1671
1418
+ },
1419
+ "tests/contrib/timeseries/test_gp.py": {
1420
+ "size": 5986
1421
+ },
1422
+ "tests/contrib/timeseries/test_lgssm.py": {
1423
+ "size": 3905
1424
+ },
1425
+ "tests/contrib/tracking/__init__.py": {
1426
+ "size": 0
1427
+ },
1428
+ "tests/contrib/tracking/test_assignment.py": {
1429
+ "size": 14126
1430
+ },
1431
+ "tests/contrib/tracking/test_distributions.py": {
1432
+ "size": 890
1433
+ },
1434
+ "tests/contrib/tracking/test_dynamic_models.py": {
1435
+ "size": 5020
1436
+ },
1437
+ "tests/contrib/tracking/test_ekf.py": {
1438
+ "size": 2792
1439
+ },
1440
+ "tests/contrib/tracking/test_em.py": {
1441
+ "size": 8636
1442
+ },
1443
+ "tests/contrib/tracking/test_hashing.py": {
1444
+ "size": 4601
1445
+ },
1446
+ "tests/contrib/tracking/test_measurements.py": {
1447
+ "size": 934
1448
+ },
1449
+ "tests/distributions/__init__.py": {
1450
+ "size": 0
1451
+ },
1452
+ "tests/distributions/conftest.py": {
1453
+ "size": 35808
1454
+ },
1455
+ "tests/distributions/dist_fixture.py": {
1456
+ "size": 6500
1457
+ },
1458
+ "tests/distributions/test_binomial.py": {
1459
+ "size": 2014
1460
+ },
1461
+ "tests/distributions/test_categorical.py": {
1462
+ "size": 3591
1463
+ },
1464
+ "tests/distributions/test_coalescent.py": {
1465
+ "size": 11355
1466
+ },
1467
+ "tests/distributions/test_conjugate.py": {
1468
+ "size": 4358
1469
+ },
1470
+ "tests/distributions/test_conjugate_update.py": {
1471
+ "size": 2061
1472
+ },
1473
+ "tests/distributions/test_constraints.py": {
1474
+ "size": 1082
1475
+ },
1476
+ "tests/distributions/test_cuda.py": {
1477
+ "size": 3189
1478
+ },
1479
+ "tests/distributions/test_delta.py": {
1480
+ "size": 2862
1481
+ },
1482
+ "tests/distributions/test_distributions.py": {
1483
+ "size": 16165
1484
+ },
1485
+ "tests/distributions/test_empirical.py": {
1486
+ "size": 7002
1487
+ },
1488
+ "tests/distributions/test_extended.py": {
1489
+ "size": 3462
1490
+ },
1491
+ "tests/distributions/test_gaussian_mixtures.py": {
1492
+ "size": 8768
1493
+ },
1494
+ "tests/distributions/test_grouped_normal_normal.py": {
1495
+ "size": 1565
1496
+ },
1497
+ "tests/distributions/test_haar.py": {
1498
+ "size": 399
1499
+ },
1500
+ "tests/distributions/test_hmm.py": {
1501
+ "size": 36873
1502
+ },
1503
+ "tests/distributions/test_ig.py": {
1504
+ "size": 1192
1505
+ },
1506
+ "tests/distributions/test_improper_uniform.py": {
1507
+ "size": 966
1508
+ },
1509
+ "tests/distributions/test_independent.py": {
1510
+ "size": 5135
1511
+ },
1512
+ "tests/distributions/test_kl.py": {
1513
+ "size": 3702
1514
+ },
1515
+ "tests/distributions/test_lkj.py": {
1516
+ "size": 4821
1517
+ },
1518
+ "tests/distributions/test_log_normal_negative_binomial.py": {
1519
+ "size": 1588
1520
+ },
1521
+ "tests/distributions/test_lowrank_mvn.py": {
1522
+ "size": 1451
1523
+ },
1524
+ "tests/distributions/test_mask.py": {
1525
+ "size": 5258
1526
+ },
1527
+ "tests/distributions/test_mixture.py": {
1528
+ "size": 5242
1529
+ },
1530
+ "tests/distributions/test_mvn.py": {
1531
+ "size": 1425
1532
+ },
1533
+ "tests/distributions/test_mvt.py": {
1534
+ "size": 5652
1535
+ },
1536
+ "tests/distributions/test_nanmasked.py": {
1537
+ "size": 3318
1538
+ },
1539
+ "tests/distributions/test_omt_mvn.py": {
1540
+ "size": 4649
1541
+ },
1542
+ "tests/distributions/test_one_hot_categorical.py": {
1543
+ "size": 3921
1544
+ },
1545
+ "tests/distributions/test_one_one_matching.py": {
1546
+ "size": 5643
1547
+ },
1548
+ "tests/distributions/test_one_two_matching.py": {
1549
+ "size": 9925
1550
+ },
1551
+ "tests/distributions/test_ordered_logistic.py": {
1552
+ "size": 4745
1553
+ },
1554
+ "tests/distributions/test_pickle.py": {
1555
+ "size": 3011
1556
+ },
1557
+ "tests/distributions/test_polya_gamma.py": {
1558
+ "size": 904
1559
+ },
1560
+ "tests/distributions/test_projected_normal.py": {
1561
+ "size": 826
1562
+ },
1563
+ "tests/distributions/test_rejector.py": {
1564
+ "size": 6748
1565
+ },
1566
+ "tests/distributions/test_relaxed_straight_through.py": {
1567
+ "size": 3847
1568
+ },
1569
+ "tests/distributions/test_reshape.py": {
1570
+ "size": 5906
1571
+ },
1572
+ "tests/distributions/test_shapes.py": {
1573
+ "size": 2509
1574
+ },
1575
+ "tests/distributions/test_sine_bivariate_von_mises.py": {
1576
+ "size": 4343
1577
+ },
1578
+ "tests/distributions/test_sine_skewed.py": {
1579
+ "size": 2967
1580
+ },
1581
+ "tests/distributions/test_spanning_tree.py": {
1582
+ "size": 7701
1583
+ },
1584
+ "tests/distributions/test_stable.py": {
1585
+ "size": 5262
1586
+ },
1587
+ "tests/distributions/test_stable_log_prob.py": {
1588
+ "size": 5282
1589
+ },
1590
+ "tests/distributions/test_tensor_type.py": {
1591
+ "size": 2032
1592
+ },
1593
+ "tests/distributions/test_torch_patch.py": {
1594
+ "size": 1025
1595
+ },
1596
+ "tests/distributions/test_transforms.py": {
1597
+ "size": 22417
1598
+ },
1599
+ "tests/distributions/test_unit.py": {
1600
+ "size": 966
1601
+ },
1602
+ "tests/distributions/test_util.py": {
1603
+ "size": 13215
1604
+ },
1605
+ "tests/distributions/test_von_mises.py": {
1606
+ "size": 5467
1607
+ },
1608
+ "tests/distributions/test_zero_inflated.py": {
1609
+ "size": 4929
1610
+ },
1611
+ "tests/distributions/testing/test_gof.py": {
1612
+ "size": 612
1613
+ },
1614
+ "tests/distributions/testing/test_special.py": {
1615
+ "size": 431
1616
+ },
1617
+ "tests/doctest_fixtures.py": {
1618
+ "size": 1075
1619
+ },
1620
+ "tests/infer/__init__.py": {
1621
+ "size": 0
1622
+ },
1623
+ "tests/infer/autoguide/__init__.py": {
1624
+ "size": 0
1625
+ },
1626
+ "tests/infer/autoguide/conftest.py": {
1627
+ "size": 442
1628
+ },
1629
+ "tests/infer/autoguide/test_gaussian.py": {
1630
+ "size": 29698
1631
+ },
1632
+ "tests/infer/autoguide/test_inference.py": {
1633
+ "size": 8100
1634
+ },
1635
+ "tests/infer/autoguide/test_mean_field_entropy.py": {
1636
+ "size": 1064
1637
+ },
1638
+ "tests/infer/conftest.py": {
1639
+ "size": 432
1640
+ },
1641
+ "tests/infer/mcmc/__init__.py": {
1642
+ "size": 0
1643
+ },
1644
+ "tests/infer/mcmc/test_adaptation.py": {
1645
+ "size": 2472
1646
+ },
1647
+ "tests/infer/mcmc/test_hmc.py": {
1648
+ "size": 11825
1649
+ },
1650
+ "tests/infer/mcmc/test_mcmc_api.py": {
1651
+ "size": 12719
1652
+ },
1653
+ "tests/infer/mcmc/test_mcmc_util.py": {
1654
+ "size": 4106
1655
+ },
1656
+ "tests/infer/mcmc/test_nuts.py": {
1657
+ "size": 20404
1658
+ },
1659
+ "tests/infer/mcmc/test_rwkernel.py": {
1660
+ "size": 1308
1661
+ },
1662
+ "tests/infer/mcmc/test_valid_models.py": {
1663
+ "size": 17096
1664
+ },
1665
+ "tests/infer/reparam/__init__.py": {
1666
+ "size": 0
1667
+ },
1668
+ "tests/infer/reparam/test_conjugate.py": {
1669
+ "size": 9154
1670
+ },
1671
+ "tests/infer/reparam/test_discrete_cosine.py": {
1672
+ "size": 4030
1673
+ },
1674
+ "tests/infer/reparam/test_haar.py": {
1675
+ "size": 6392
1676
+ },
1677
+ "tests/infer/reparam/test_hmm.py": {
1678
+ "size": 12130
1679
+ },
1680
+ "tests/infer/reparam/test_loc_scale.py": {
1681
+ "size": 4077
1682
+ },
1683
+ "tests/infer/reparam/test_neutra.py": {
1684
+ "size": 3101
1685
+ },
1686
+ "tests/infer/reparam/test_projected_normal.py": {
1687
+ "size": 2118
1688
+ },
1689
+ "tests/infer/reparam/test_softmax.py": {
1690
+ "size": 2305
1691
+ },
1692
+ "tests/infer/reparam/test_split.py": {
1693
+ "size": 3082
1694
+ },
1695
+ "tests/infer/reparam/test_stable.py": {
1696
+ "size": 6419
1697
+ },
1698
+ "tests/infer/reparam/test_strategies.py": {
1699
+ "size": 10119
1700
+ },
1701
+ "tests/infer/reparam/test_structured.py": {
1702
+ "size": 2029
1703
+ },
1704
+ "tests/infer/reparam/test_studentt.py": {
1705
+ "size": 3021
1706
+ },
1707
+ "tests/infer/reparam/test_transform.py": {
1708
+ "size": 2709
1709
+ },
1710
+ "tests/infer/reparam/test_unit_jacobian.py": {
1711
+ "size": 2597
1712
+ },
1713
+ "tests/infer/reparam/util.py": {
1714
+ "size": 1193
1715
+ },
1716
+ "tests/infer/test_abstract_infer.py": {
1717
+ "size": 2732
1718
+ },
1719
+ "tests/infer/test_autoguide.py": {
1720
+ "size": 51678
1721
+ },
1722
+ "tests/infer/test_compute_downstream_costs.py": {
1723
+ "size": 29962
1724
+ },
1725
+ "tests/infer/test_conjugate_gradients.py": {
1726
+ "size": 1616
1727
+ },
1728
+ "tests/infer/test_csis.py": {
1729
+ "size": 2468
1730
+ },
1731
+ "tests/infer/test_discrete.py": {
1732
+ "size": 14353
1733
+ },
1734
+ "tests/infer/test_elbo_mapdata.py": {
1735
+ "size": 4196
1736
+ },
1737
+ "tests/infer/test_enum.py": {
1738
+ "size": 145511
1739
+ },
1740
+ "tests/infer/test_gradient.py": {
1741
+ "size": 15384
1742
+ },
1743
+ "tests/infer/test_inference.py": {
1744
+ "size": 36696
1745
+ },
1746
+ "tests/infer/test_initialization.py": {
1747
+ "size": 1066
1748
+ },
1749
+ "tests/infer/test_inspect.py": {
1750
+ "size": 16351
1751
+ },
1752
+ "tests/infer/test_jit.py": {
1753
+ "size": 19363
1754
+ },
1755
+ "tests/infer/test_multi_sample_elbos.py": {
1756
+ "size": 1638
1757
+ },
1758
+ "tests/infer/test_predictive.py": {
1759
+ "size": 12494
1760
+ },
1761
+ "tests/infer/test_resampler.py": {
1762
+ "size": 1321
1763
+ },
1764
+ "tests/infer/test_sampling.py": {
1765
+ "size": 3094
1766
+ },
1767
+ "tests/infer/test_smcfilter.py": {
1768
+ "size": 8196
1769
+ },
1770
+ "tests/infer/test_svgd.py": {
1771
+ "size": 5251
1772
+ },
1773
+ "tests/infer/test_tmc.py": {
1774
+ "size": 10256
1775
+ },
1776
+ "tests/infer/test_util.py": {
1777
+ "size": 2397
1778
+ },
1779
+ "tests/infer/test_valid_models.py": {
1780
+ "size": 93251
1781
+ },
1782
+ "tests/integration_tests/__init__.py": {
1783
+ "size": 0
1784
+ },
1785
+ "tests/integration_tests/conftest.py": {
1786
+ "size": 451
1787
+ },
1788
+ "tests/integration_tests/test_conjugate_gaussian_models.py": {
1789
+ "size": 25477
1790
+ },
1791
+ "tests/integration_tests/test_tracegraph_elbo.py": {
1792
+ "size": 25003
1793
+ },
1794
+ "tests/nn/__init__.py": {
1795
+ "size": 0
1796
+ },
1797
+ "tests/nn/conftest.py": {
1798
+ "size": 429
1799
+ },
1800
+ "tests/nn/test_autoregressive.py": {
1801
+ "size": 5466
1802
+ },
1803
+ "tests/nn/test_module.py": {
1804
+ "size": 35007
1805
+ },
1806
+ "tests/ops/__init__.py": {
1807
+ "size": 0
1808
+ },
1809
+ "tests/ops/conftest.py": {
1810
+ "size": 430
1811
+ },
1812
+ "tests/ops/einsum/conftest.py": {
1813
+ "size": 437
1814
+ },
1815
+ "tests/ops/einsum/test_adjoint.py": {
1816
+ "size": 4418
1817
+ },
1818
+ "tests/ops/einsum/test_torch_log.py": {
1819
+ "size": 1562
1820
+ },
1821
+ "tests/ops/gamma_gaussian.py": {
1822
+ "size": 1763
1823
+ },
1824
+ "tests/ops/gaussian.py": {
1825
+ "size": 1675
1826
+ },
1827
+ "tests/ops/test_arrowhead.py": {
1828
+ "size": 1733
1829
+ },
1830
+ "tests/ops/test_contract.py": {
1831
+ "size": 26142
1832
+ },
1833
+ "tests/ops/test_gamma_gaussian.py": {
1834
+ "size": 12357
1835
+ },
1836
+ "tests/ops/test_gaussian.py": {
1837
+ "size": 23038
1838
+ },
1839
+ "tests/ops/test_indexing.py": {
1840
+ "size": 6117
1841
+ },
1842
+ "tests/ops/test_integrator.py": {
1843
+ "size": 4558
1844
+ },
1845
+ "tests/ops/test_jit.py": {
1846
+ "size": 1077
1847
+ },
1848
+ "tests/ops/test_linalg.py": {
1849
+ "size": 2352
1850
+ },
1851
+ "tests/ops/test_newton.py": {
1852
+ "size": 5028
1853
+ },
1854
+ "tests/ops/test_packed.py": {
1855
+ "size": 2259
1856
+ },
1857
+ "tests/ops/test_provenance.py": {
1858
+ "size": 1855
1859
+ },
1860
+ "tests/ops/test_special.py": {
1861
+ "size": 2760
1862
+ },
1863
+ "tests/ops/test_ssm_gp.py": {
1864
+ "size": 1153
1865
+ },
1866
+ "tests/ops/test_stats.py": {
1867
+ "size": 10996
1868
+ },
1869
+ "tests/ops/test_streaming.py": {
1870
+ "size": 3172
1871
+ },
1872
+ "tests/ops/test_tensor_utils.py": {
1873
+ "size": 6592
1874
+ },
1875
+ "tests/ops/test_welford.py": {
1876
+ "size": 3133
1877
+ },
1878
+ "tests/optim/__init__.py": {
1879
+ "size": 0
1880
+ },
1881
+ "tests/optim/conftest.py": {
1882
+ "size": 432
1883
+ },
1884
+ "tests/optim/test_multi.py": {
1885
+ "size": 2637
1886
+ },
1887
+ "tests/optim/test_optim.py": {
1888
+ "size": 14654
1889
+ },
1890
+ "tests/params/__init__.py": {
1891
+ "size": 0
1892
+ },
1893
+ "tests/params/conftest.py": {
1894
+ "size": 433
1895
+ },
1896
+ "tests/params/test_module.py": {
1897
+ "size": 2567
1898
+ },
1899
+ "tests/params/test_param.py": {
1900
+ "size": 8707
1901
+ },
1902
+ "tests/perf/__init__.py": {
1903
+ "size": 0
1904
+ },
1905
+ "tests/perf/conftest.py": {
1906
+ "size": 430
1907
+ },
1908
+ "tests/perf/test_benchmark.py": {
1909
+ "size": 6793
1910
+ },
1911
+ "tests/poutine/__init__.py": {
1912
+ "size": 0
1913
+ },
1914
+ "tests/poutine/conftest.py": {
1915
+ "size": 434
1916
+ },
1917
+ "tests/poutine/test_counterfactual.py": {
1918
+ "size": 3829
1919
+ },
1920
+ "tests/poutine/test_mapdata.py": {
1921
+ "size": 5407
1922
+ },
1923
+ "tests/poutine/test_nesting.py": {
1924
+ "size": 1068
1925
+ },
1926
+ "tests/poutine/test_poutines.py": {
1927
+ "size": 36326
1928
+ },
1929
+ "tests/poutine/test_properties.py": {
1930
+ "size": 3965
1931
+ },
1932
+ "tests/poutine/test_runtime.py": {
1933
+ "size": 1113
1934
+ },
1935
+ "tests/poutine/test_trace_struct.py": {
1936
+ "size": 1742
1937
+ },
1938
+ "tests/pyroapi/conftest.py": {
1939
+ "size": 234
1940
+ },
1941
+ "tests/pyroapi/test_pyroapi.py": {
1942
+ "size": 338
1943
+ },
1944
+ "tests/test_examples.py": {
1945
+ "size": 22086
1946
+ },
1947
+ "tests/test_generic.py": {
1948
+ "size": 3354
1949
+ },
1950
+ "tests/test_primitives.py": {
1951
+ "size": 1459
1952
+ },
1953
+ "tests/test_settings.py": {
1954
+ "size": 1420
1955
+ },
1956
+ "tests/test_util.py": {
1957
+ "size": 3150
1958
+ },
1959
+ "tutorial/README.md": {
1960
+ "size": 51
1961
+ },
1962
+ "tutorial/source/cleannb.py": {
1963
+ "size": 1002
1964
+ },
1965
+ "tutorial/source/conf.py": {
1966
+ "size": 5615
1967
+ },
1968
+ "tutorial/source/search_inference.py": {
1969
+ "size": 7589
1970
+ }
1971
+ },
1972
+ "processed_by": "zip_fallback",
1973
+ "success": true
1974
+ },
1975
+ "structure": {
1976
+ "packages": [
1977
+ "source.examples",
1978
+ "source.examples.contrib",
1979
+ "source.examples.cvae",
1980
+ "source.examples.mixed_hmm",
1981
+ "source.examples.scanvi",
1982
+ "source.profiler",
1983
+ "source.pyro",
1984
+ "source.pyro.contrib",
1985
+ "source.pyro.distributions",
1986
+ "source.pyro.infer",
1987
+ "source.pyro.nn",
1988
+ "source.pyro.ops",
1989
+ "source.pyro.optim",
1990
+ "source.pyro.params",
1991
+ "source.pyro.poutine",
1992
+ "source.tests",
1993
+ "source.tests.contrib",
1994
+ "source.tests.distributions",
1995
+ "source.tests.infer",
1996
+ "source.tests.integration_tests",
1997
+ "source.tests.nn",
1998
+ "source.tests.ops",
1999
+ "source.tests.optim",
2000
+ "source.tests.params",
2001
+ "source.tests.perf",
2002
+ "source.tests.poutine"
2003
+ ]
2004
+ },
2005
+ "dependencies": {
2006
+ "has_environment_yml": false,
2007
+ "has_requirements_txt": false,
2008
+ "pyproject": true,
2009
+ "setup_cfg": true,
2010
+ "setup_py": true
2011
+ },
2012
+ "entry_points": {
2013
+ "imports": [],
2014
+ "cli": [],
2015
+ "modules": []
2016
+ },
2017
+ "llm_analysis": {
2018
+ "core_modules": [
2019
+ {
2020
+ "package": "source.pyro",
2021
+ "module": "pyro",
2022
+ "functions": [
2023
+ "sample",
2024
+ "param",
2025
+ "plate",
2026
+ "factor",
2027
+ "deterministic"
2028
+ ],
2029
+ "classes": [],
2030
+ "description": "Core primitives for probabilistic programming in Pyro."
2031
+ },
2032
+ {
2033
+ "package": "source.pyro.poutine",
2034
+ "module": "poutine",
2035
+ "functions": [
2036
+ "trace",
2037
+ "replay",
2038
+ "condition",
2039
+ "block",
2040
+ "scale",
2041
+ "enum"
2042
+ ],
2043
+ "classes": [
2044
+ "Messenger"
2045
+ ],
2046
+ "description": "Effect handler system for intercepting and transforming probabilistic primitives."
2047
+ },
2048
+ {
2049
+ "package": "source.pyro.infer",
2050
+ "module": "infer",
2051
+ "functions": [
2052
+ "SVI",
2053
+ "MCMC",
2054
+ "Importance"
2055
+ ],
2056
+ "classes": [],
2057
+ "description": "Inference algorithms including SVI and MCMC methods."
2058
+ },
2059
+ {
2060
+ "package": "source.pyro.distributions",
2061
+ "module": "distributions",
2062
+ "functions": [],
2063
+ "classes": [
2064
+ "Delta",
2065
+ "HiddenMarkovModel",
2066
+ "Empirical"
2067
+ ],
2068
+ "description": "Extensions to PyTorch's distribution library with additional distributions and functionality."
2069
+ }
2070
+ ],
2071
+ "cli_commands": [],
2072
+ "import_strategy": {
2073
+ "primary": "import",
2074
+ "fallback": "blackbox",
2075
+ "confidence": 0.9
2076
+ },
2077
+ "dependencies": {
2078
+ "required": [
2079
+ "torch",
2080
+ "numpy"
2081
+ ],
2082
+ "optional": [
2083
+ "matplotlib",
2084
+ "scipy"
2085
+ ]
2086
+ },
2087
+ "risk_assessment": {
2088
+ "import_feasibility": 0.9,
2089
+ "intrusiveness_risk": "low",
2090
+ "complexity": "medium"
2091
+ }
2092
+ },
2093
+ "deepwiki_analysis": {
2094
+ "repo_url": "https://github.com/pyro-ppl/pyro",
2095
+ "repo_name": "pyro",
2096
+ "content": "pyro-ppl/pyro\nCore Primitives and Effect Handlers\nEffect Handlers\nTrace System\nDistributions\nDistribution Classes\nTransforms and Constraints\nSpecial Distributions\nDistribution Utilities\nInference Algorithms\nStochastic Variational Inference\nELBO Variants\nMCMC Methods\nImportance Sampling and Predictive\nModels and Guides\nThe Model/Guide Pattern\nParameter Management\nParameter Store\nExamples and Applications\nTutorial System\nBayesian Statistical Models\nDeep Generative Models\nSpecialized Applications\nDevelopment Infrastructure\nSetup and Installation\nTesting Framework\nSpecial Operations and Utilities\ndocs/requirements.txt\ndocs/source/conf.py\npyproject.toml\npyro/__init__.py\npyro/distributions/constraints.py\npyro/poutine/__init__.py\npyro/util.py\nThis page provides a high-level introduction to Pyro's architecture, design philosophy, and core components. It serves as an entry point for understanding how the system is structured and how its parts interact.\nFor detailed information about specific subsystems, see:\nCore primitives and effect handlers:Section 2\nDistribution system:Section 3\nInference algorithms:Section 4\nModel and guide patterns:Section 5\nParameter management:Section 6\nWhat is Pyro?\nPyro is a universal probabilistic programming language (PPL) built on PyTorch. It enables users to write generative models as Python programs and perform inference over them using a variety of algorithms including variational inference (SVI) and Markov chain Monte Carlo (MCMC).\nPackage Identity:\nName:pyro-pplsetup.py86\nDescription:\"A Python library for probabilistic modeling and inference\"setup.py88\nVersion:1.9.1+pyro/__init__.py31\nPython Requirements:>=3.8setup.py147\nCore Dependencies:\nSources:setup.py102-111pyro/__init__.py1-67\nDesign Philosophy\nPyro is built on four core principles that guide its architecture:\nUniversalAny computable distributionScalableMinimal overhead vs hand-written codeMinimalSmall core, powerful abstractionsFlexibleAutomation + manual controlPyro Core System\nUniversalAny computable distribution\nScalableMinimal overhead vs hand-written code\nMinimalSmall core, powerful abstractions\nFlexibleAutomation + manual control\nPyro Core System\nPyro can represent any computable probability distribution through its flexible programming model. Models are ordinary Python functions that can include loops, recursion, and arbitrary control flow.\nPyro is designed to scale to large datasets with minimal overhead. It builds directly on PyTorch's tensor operations and automatic differentiation, avoiding unnecessary abstractions.\nThe core system is implemented with a small set of composable abstractions. The effect handler system (poutine) provides the foundation for model manipulation without requiring extensive framework code.\nPyro provides high-level automation (e.g., automatic variational guides) while allowing experts to customize inference at any level through effect handlers and custom implementations.\nSources:README.md24-29\nSystem Architecture Overview\nPyro's architecture consists of several layered subsystems:\nParameter LayerDistribution LayerInference LayerEffect Handler Layer (Poutine)Primitive LayerUser LayerUser Model CodePython functions withpyro.sample, pyro.paramPyroModuleNeural network integrationExamples & TutorialsVAE, GP, HMM, etc.Primitive Operationspyro.samplepyro.parampyro.platepyro.factorMessage Runtime_PYRO_STACKapply_stack()Effect Handlerstrace, replaycondition, blockscale, enumSVIStochastic Variational InferenceMCMCHMC, NUTSAutoGuideAutomatic guide generationELBO VariantsTrace_ELBOTraceEnum_ELBOPyTorch Distributionstorch.distributions.*Pyro DistributionsDelta, HMM, etc.Constraints & TransformsParamStoreDictGlobal parameter storagePyroOptimWrapped PyTorch optimizers\nParameter Layer\nDistribution Layer\nInference Layer\nEffect Handler Layer (Poutine)\nPrimitive Layer\nUser Model CodePython functions withpyro.sample, pyro.param\nPyroModuleNeural network integration\nExamples & TutorialsVAE, GP, HMM, etc.\nPrimitive Operationspyro.samplepyro.parampyro.platepyro.factor\nMessage Runtime_PYRO_STACKapply_stack()\nEffect Handlerstrace, replaycondition, blockscale, enum\nSVIStochastic Variational Inference\nMCMCHMC, NUTS\nAutoGuideAutomatic guide generation\nELBO VariantsTrace_ELBOTraceEnum_ELBO\nPyTorch Distributionstorch.distributions.*\nPyro DistributionsDelta, HMM, etc.\nConstraints & Transforms\nParamStoreDictGlobal parameter storage\nPyroOptimWrapped PyTorch optimizers\nSources:pyro/__init__.py1-67pyro/poutine/__init__.py1-59\nCore Components and Code Entities\nPrimitives Module\nThe top-level module exports the fundamental primitives that users interact with:\npyro.sample\npyro.primitives\npyro.primitives\npyro.primitives\npyro.factor\npyro.primitives\npyro.deterministic\npyro.primitives\nAdditional utilities:\npyro.enable_validation()- Enable shape and distribution validationpyro/__init__.py12\npyro.enable_validation()\npyro.clear_param_store()- Reset global parameter storagepyro/__init__.py10\npyro.clear_param_store()\npyro.get_param_store()- Access the global parameter storepyro/__init__.py14\npyro.get_param_store()\npyro.set_rng_seed()- Set random number generator seedpyro/util.py37-45\npyro.set_rng_seed()\nSources:pyro/__init__.py8-26pyro/__init__.py39-66\nPoutine (Effect Handler) System\nPoutine is the effect handler system that intercepts and transforms probabilistic primitives:\nTrace Data StructureCore RuntimeHandler ExportstraceRecords executionreplayReplays recorded samplesconditionFixes observationsblockHides sites from handlersscaleScales log probabilitiesenumEnumerates discrete variablesreparamApplies reparameterization_PYRO_STACKGlobal message stackapply_stack()Message dispatcherMessengerBase handler classTraceExecution recordingMessageSite information dict\nTrace Data Structure\nCore Runtime\nHandler Exports\ntraceRecords execution\nreplayReplays recorded samples\nconditionFixes observations\nblockHides sites from handlers\nscaleScales log probabilities\nenumEnumerates discrete variables\nreparamApplies reparameterization\n_PYRO_STACKGlobal message stack\napply_stack()Message dispatcher\nMessengerBase handler class\nTraceExecution recording\nMessageSite information dict\nKey handler exports frompyro.poutine:\npyro.poutine\ntrace- Records model execution into a Trace objectpyro/poutine/__init__.py23\nreplay- Re-executes model with fixed sample valuespyro/poutine/__init__.py19\ncondition- Conditions model on observed datapyro/poutine/__init__.py8\nblock- Blocks primitives from outer handlerspyro/poutine/__init__.py5\nscale- Scales log probabilities (for subsampling)pyro/poutine/__init__.py20\nenum- Enumerates discrete latent variablespyro/poutine/__init__.py10\nSources:pyro/poutine/__init__.py1-59\nProgramming Model: From Code to Execution\nThis diagram shows how user code flows through Pyro's execution model:\n\"ParamStoreDict\"\"Distribution\"\"Effect Handlers\"\"_PYRO_STACK\"\"pyro.sample()\"\"User Code\"\"ParamStoreDict\"\"Distribution\"\"Effect Handlers\"\"_PYRO_STACK\"\"pyro.sample()\"\"User Code\"Message contains:name, fn, value, args, kwargsEach handler transforms messagePost-process (top-to-bottom)alt[If pyro.param() called]pyro.sample(\"x\", dist)Create messageProcess message (bottom-to-top)_process_message()Sample from distributionSample value_postprocess_message()Return processed messagevalueReturn samplepyro.param(\"theta\")Get/create parameterParameter tensorReturn parameter\nSources:pyro/__init__.py8-26pyro/poutine/__init__.py27-28\nParameter Management Architecture\nPyro maintains a global parameter store that synchronizes with PyTorch module parameters:\nOptimizationGlobal StorageUser Interfacepyro.param('theta', init)Get/create parameterPyroModule.x = PyroParam(...)Module-level parameterParamStoreDict_params: Dict[str, Tensor]_constraints: Dict[str, Constraint]pyro.get_param_store()Access singletonpyro.clear_param_store()Reset all parametersPyroOptimWraps torch.optimSVI.step()Optimization step\nOptimization\nGlobal Storage\nUser Interface\npyro.param('theta', init)Get/create parameter\nPyroModule.x = PyroParam(...)Module-level parameter\nParamStoreDict_params: Dict[str, Tensor]_constraints: Dict[str, Constraint]\npyro.get_param_store()Access singleton\npyro.clear_param_store()Reset all parameters\nPyroOptimWraps torch.optim\nSVI.step()Optimization step\nKey operations:\npyro.param(name, init_value, constraint=constraints.real)- Declare/retrieve parameter\npyro.param(name, init_value, constraint=constraints.real)\npyro.get_param_store()- Get the global ParamStoreDict instancepyro/__init__.py14\npyro.get_param_store()\npyro.clear_param_store()- Clear all parameterspyro/__init__.py10\npyro.clear_param_store()\nSources:pyro/__init__.py10-18pyro/__init__.py54\nDistribution System\nPyro extends PyTorch's distribution library with additional distributions and functionality:\nPyro-SpecificStandard DistributionsPyro ExtensionsPyTorch Basetorch.distributions.Distributiontorch.distributions.constraintsTorchDistributionMixinPyro compatibility layerpyro.distributions.constraintsAdditional constraintsNormal, Beta, Gamma, etc.Wrapped PyTorch distributionsDeltaDegenerate distributionHiddenMarkovModelDiscreteHMM, GaussianHMMEmpiricalSample-based distribution\nPyro-Specific\nStandard Distributions\nPyro Extensions\nPyTorch Base\ntorch.distributions.Distribution\ntorch.distributions.constraints\nTorchDistributionMixinPyro compatibility layer\npyro.distributions.constraintsAdditional constraints\nNormal, Beta, Gamma, etc.Wrapped PyTorch distributions\nDeltaDegenerate distribution\nHiddenMarkovModelDiscreteHMM, GaussianHMM\nEmpiricalSample-based distribution\nConstraint extensionsinpyro.distributions.constraints:\npyro.distributions.constraints\ninteger- Integer valuespyro/distributions/constraints.py152\nsphere- Points on Euclidean spherepyro/distributions/constraints.py155\ncorr_matrix- Correlation matricespyro/distributions/constraints.py151\ncorr_matrix\nordered_vector- Monotonically increasing vectorspyro/distributions/constraints.py153\nordered_vector\nAll PyTorch constraints viafrom torch.distributions.constraints import *pyro/distributions/constraints.py5\nfrom torch.distributions.constraints import *\nSources:pyro/distributions/constraints.py1-235\nInference Ecosystem\nPyro provides multiple inference algorithms that operate on the same model-guide abstraction:\npyro.infer.SVI\npyro.infer.MCMC\npyro.infer.MCMC\npyro.infer.Importance\nELBO variants for SVI:\nTrace_ELBO- Basic Monte Carlo ELBO estimator\nTraceEnum_ELBO- Enumerates discrete latent variables\nTraceEnum_ELBO\nTraceGraph_ELBO- Variance reduction via Rao-Blackwellization\nTraceGraph_ELBO\nRenyiELBO- Rényi divergence objective (α-divergence)\nAutomatic guides:",
2097
+ "model": "gpt-4o-2024-08-06",
2098
+ "source": "selenium",
2099
+ "success": true
2100
+ },
2101
+ "deepwiki_options": {
2102
+ "enabled": true,
2103
+ "model": "gpt-4o-2024-08-06"
2104
+ },
2105
+ "risk": {
2106
+ "import_feasibility": 0.9,
2107
+ "intrusiveness_risk": "low",
2108
+ "complexity": "medium"
2109
+ }
2110
+ }
pyro/mcp_output/diff_report.md ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Pyro Project Difference Report
2
+
3
+ **Repository:** Pyro
4
+ **Project Type:** Python Library
5
+ **Main Features:** Basic Functionality
6
+ **Report Date:** February 7, 2026
7
+ **Intrusiveness:** None
8
+ **New Files:** 8
9
+ **Modified Files:** 0
10
+ **Workflow Status:** Success
11
+ **Test Status:** Failed
12
+
13
+ ---
14
+
15
+ ## Project Overview
16
+
17
+ The Pyro project is a Python library designed to provide basic functionality for probabilistic programming. As of the latest update, the project has introduced new files but has not modified any existing ones. The workflow has been executed successfully, but the test suite has failed, indicating potential issues with the new additions.
18
+
19
+ ## Difference Analysis
20
+
21
+ ### New Files
22
+
23
+ The project has added 8 new files. These files likely introduce new features or components to the library. However, without modifications to existing files, it suggests that the new additions are standalone and do not alter the current functionality of the library.
24
+
25
+ ### Modified Files
26
+
27
+ There are no modified files in this update. This indicates that the existing codebase remains unchanged, and the focus has been on expanding the library's capabilities through new files.
28
+
29
+ ### Workflow and Test Status
30
+
31
+ - **Workflow Status:** The workflow has been successfully executed, indicating that the integration of new files did not disrupt the build or deployment processes.
32
+ - **Test Status:** The test suite has failed, suggesting that the new files may contain errors or that they do not integrate well with the existing codebase.
33
+
34
+ ## Technical Analysis
35
+
36
+ The introduction of new files without modifications to existing ones suggests an expansion of the library's capabilities. However, the failure in the test suite highlights potential issues:
37
+
38
+ - **Integration Issues:** The new files may not be fully integrated with the existing codebase, leading to test failures.
39
+ - **Incomplete Features:** The new features might be incomplete or not fully tested, resulting in errors during testing.
40
+ - **Dependency Conflicts:** There could be conflicts with existing dependencies or assumptions within the codebase.
41
+
42
+ ## Recommendations and Improvements
43
+
44
+ 1. **Review New Files:** Conduct a thorough review of the new files to ensure they meet the project's coding standards and integrate seamlessly with the existing codebase.
45
+ 2. **Enhance Testing:** Update the test suite to cover the new features and ensure comprehensive testing of all functionalities.
46
+ 3. **Debugging:** Identify and resolve the specific issues causing test failures. This may involve debugging the new files or adjusting the test cases.
47
+ 4. **Documentation:** Update the project documentation to include details about the new features and any changes in usage or dependencies.
48
+
49
+ ## Deployment Information
50
+
51
+ Given the successful workflow status, the new files have been integrated into the project without deployment issues. However, due to the test failures, it is advisable to hold off on deploying these changes to production until the issues are resolved.
52
+
53
+ ## Future Planning
54
+
55
+ - **Stabilization:** Focus on stabilizing the current release by addressing test failures and ensuring all new features are fully functional.
56
+ - **Feature Expansion:** Plan for future updates that expand on the new features, ensuring they are well-integrated and thoroughly tested.
57
+ - **Community Feedback:** Engage with the user community to gather feedback on the new features and identify areas for improvement.
58
+
59
+ ## Conclusion
60
+
61
+ The Pyro project has expanded its capabilities with the addition of new files. However, the test failures indicate that further work is needed to ensure these new features are stable and reliable. By addressing the identified issues and enhancing the testing framework, the project can continue to grow and provide valuable functionality to its users.
62
+
63
+ ---
pyro/mcp_output/mcp_plugin/__init__.py ADDED
File without changes
pyro/mcp_output/mcp_plugin/adapter.py ADDED
@@ -0,0 +1,211 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import sys
3
+
4
+ # Path settings
5
+ source_path = os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))), "source")
6
+ sys.path.insert(0, source_path)
7
+
8
+ # Import statements
9
+ try:
10
+ from pyro.infer import SVI, MCMC, Importance
11
+ from pyro.infer.elbo import Trace_ELBO, TraceEnum_ELBO, TraceGraph_ELBO, RenyiELBO
12
+ from pyro.distributions import Delta, HiddenMarkovModel, Empirical
13
+ from pyro.poutine import trace, replay, condition, block, scale, enum
14
+ from pyro import sample, param, plate, factor, deterministic
15
+ from pyro.util import set_rng_seed, clear_param_store, get_param_store
16
+ import torch
17
+ import numpy as np
18
+ except ImportError as e:
19
+ print(f"Import failed: {e}. Ensure all dependencies are installed.")
20
+ # Fallback mode
21
+ class Adapter:
22
+ def __init__(self):
23
+ self.mode = "blackbox"
24
+ print("Running in fallback mode. Limited functionality available.")
25
+
26
+ def status(self):
27
+ return {"status": "fallback", "message": "Limited functionality available due to import failure."}
28
+
29
+ else:
30
+ # Adapter class definition
31
+ class Adapter:
32
+ """
33
+ Adapter class to interface with the Pyro library, providing methods to utilize its core functionalities.
34
+ """
35
+
36
+ def __init__(self):
37
+ self.mode = "import"
38
+
39
+ # -------------------- Inference Methods --------------------
40
+
41
+ def create_svi(self, model, guide, optim, loss=Trace_ELBO()):
42
+ """
43
+ Create an instance of the SVI class.
44
+
45
+ :param model: The model function.
46
+ :param guide: The guide function.
47
+ :param optim: The optimizer.
48
+ :param loss: The loss function, default is Trace_ELBO.
49
+ :return: Dictionary with status and SVI instance or error message.
50
+ """
51
+ try:
52
+ svi_instance = SVI(model, guide, optim, loss)
53
+ return {"status": "success", "svi_instance": svi_instance}
54
+ except Exception as e:
55
+ return {"status": "error", "message": str(e)}
56
+
57
+ def create_mcmc(self, kernel, num_samples, warmup_steps):
58
+ """
59
+ Create an instance of the MCMC class.
60
+
61
+ :param kernel: The MCMC kernel.
62
+ :param num_samples: Number of samples to draw.
63
+ :param warmup_steps: Number of warmup steps.
64
+ :return: Dictionary with status and MCMC instance or error message.
65
+ """
66
+ try:
67
+ mcmc_instance = MCMC(kernel, num_samples, warmup_steps)
68
+ return {"status": "success", "mcmc_instance": mcmc_instance}
69
+ except Exception as e:
70
+ return {"status": "error", "message": str(e)}
71
+
72
+ def create_importance(self, model, guide, num_samples):
73
+ """
74
+ Create an instance of the Importance class.
75
+
76
+ :param model: The model function.
77
+ :param guide: The guide function.
78
+ :param num_samples: Number of samples for importance sampling.
79
+ :return: Dictionary with status and Importance instance or error message.
80
+ """
81
+ try:
82
+ importance_instance = Importance(model, guide, num_samples)
83
+ return {"status": "success", "importance_instance": importance_instance}
84
+ except Exception as e:
85
+ return {"status": "error", "message": str(e)}
86
+
87
+ # -------------------- Distribution Methods --------------------
88
+
89
+ def create_delta(self, v, log_density=0.0):
90
+ """
91
+ Create an instance of the Delta distribution.
92
+
93
+ :param v: The value of the distribution.
94
+ :param log_density: The log density, default is 0.0.
95
+ :return: Dictionary with status and Delta instance or error message.
96
+ """
97
+ try:
98
+ delta_instance = Delta(v, log_density)
99
+ return {"status": "success", "delta_instance": delta_instance}
100
+ except Exception as e:
101
+ return {"status": "error", "message": str(e)}
102
+
103
+ def create_hidden_markov_model(self, initial_dist, transition_dist, observation_dist):
104
+ """
105
+ Create an instance of the HiddenMarkovModel.
106
+
107
+ :param initial_dist: Initial distribution.
108
+ :param transition_dist: Transition distribution.
109
+ :param observation_dist: Observation distribution.
110
+ :return: Dictionary with status and HiddenMarkovModel instance or error message.
111
+ """
112
+ try:
113
+ hmm_instance = HiddenMarkovModel(initial_dist, transition_dist, observation_dist)
114
+ return {"status": "success", "hmm_instance": hmm_instance}
115
+ except Exception as e:
116
+ return {"status": "error", "message": str(e)}
117
+
118
+ def create_empirical(self, samples):
119
+ """
120
+ Create an instance of the Empirical distribution.
121
+
122
+ :param samples: Samples for the empirical distribution.
123
+ :return: Dictionary with status and Empirical instance or error message.
124
+ """
125
+ try:
126
+ empirical_instance = Empirical(samples)
127
+ return {"status": "success", "empirical_instance": empirical_instance}
128
+ except Exception as e:
129
+ return {"status": "error", "message": str(e)}
130
+
131
+ # -------------------- Poutine Methods --------------------
132
+
133
+ def apply_trace(self, fn):
134
+ """
135
+ Apply the trace poutine to a function.
136
+
137
+ :param fn: The function to trace.
138
+ :return: Dictionary with status and traced function or error message.
139
+ """
140
+ try:
141
+ traced_fn = trace(fn)
142
+ return {"status": "success", "traced_fn": traced_fn}
143
+ except Exception as e:
144
+ return {"status": "error", "message": str(e)}
145
+
146
+ def apply_replay(self, fn, guide_trace):
147
+ """
148
+ Apply the replay poutine to a function.
149
+
150
+ :param fn: The function to replay.
151
+ :param guide_trace: The guide trace for replay.
152
+ :return: Dictionary with status and replayed function or error message.
153
+ """
154
+ try:
155
+ replayed_fn = replay(fn, guide_trace)
156
+ return {"status": "success", "replayed_fn": replayed_fn}
157
+ except Exception as e:
158
+ return {"status": "error", "message": str(e)}
159
+
160
+ def apply_condition(self, fn, data):
161
+ """
162
+ Apply the condition poutine to a function.
163
+
164
+ :param fn: The function to condition.
165
+ :param data: The observed data.
166
+ :return: Dictionary with status and conditioned function or error message.
167
+ """
168
+ try:
169
+ conditioned_fn = condition(fn, data)
170
+ return {"status": "success", "conditioned_fn": conditioned_fn}
171
+ except Exception as e:
172
+ return {"status": "error", "message": str(e)}
173
+
174
+ # -------------------- Utility Methods --------------------
175
+
176
+ def set_random_seed(self, seed):
177
+ """
178
+ Set the random number generator seed.
179
+
180
+ :param seed: The seed value.
181
+ :return: Dictionary with status.
182
+ """
183
+ try:
184
+ set_rng_seed(seed)
185
+ return {"status": "success"}
186
+ except Exception as e:
187
+ return {"status": "error", "message": str(e)}
188
+
189
+ def clear_parameters(self):
190
+ """
191
+ Clear all parameters from the parameter store.
192
+
193
+ :return: Dictionary with status.
194
+ """
195
+ try:
196
+ clear_param_store()
197
+ return {"status": "success"}
198
+ except Exception as e:
199
+ return {"status": "error", "message": str(e)}
200
+
201
+ def get_parameters(self):
202
+ """
203
+ Get the global parameter store.
204
+
205
+ :return: Dictionary with status and parameter store or error message.
206
+ """
207
+ try:
208
+ param_store = get_param_store()
209
+ return {"status": "success", "param_store": param_store}
210
+ except Exception as e:
211
+ return {"status": "error", "message": str(e)}
pyro/mcp_output/mcp_plugin/main.py ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ MCP Service Auto-Wrapper - Auto-generated
3
+ """
4
+ from mcp_service import create_app
5
+
6
+ def main():
7
+ """Main entry point"""
8
+ app = create_app()
9
+ return app
10
+
11
+ if __name__ == "__main__":
12
+ app = main()
13
+ app.run()
pyro/mcp_output/mcp_plugin/mcp_service.py ADDED
@@ -0,0 +1,119 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import sys
3
+
4
+ # Add the local source directory to sys.path
5
+ source_path = os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))), "source")
6
+ if source_path not in sys.path:
7
+ sys.path.insert(0, source_path)
8
+
9
+ from fastmcp import FastMCP
10
+
11
+ # Import core modules from the local source directory
12
+ from pyro.infer import SVI, MCMC
13
+ from pyro.distributions import Delta, HiddenMarkovModel
14
+ from pyro.poutine import trace, replay, condition
15
+
16
+ # Create the FastMCP service application
17
+ mcp = FastMCP("pyro_service")
18
+
19
+ @mcp.tool(name="svi_tool", description="Perform Stochastic Variational Inference")
20
+ def svi_tool(model: callable, guide: callable, data: dict) -> dict:
21
+ """
22
+ Perform Stochastic Variational Inference using the provided model and guide.
23
+
24
+ Parameters:
25
+ - model: The probabilistic model function.
26
+ - guide: The variational guide function.
27
+ - data: A dictionary containing observed data.
28
+
29
+ Returns:
30
+ - A dictionary with success, result, and error fields.
31
+ """
32
+ try:
33
+ svi = SVI(model, guide, ...)
34
+ result = svi.run(data)
35
+ return {"success": True, "result": result, "error": None}
36
+ except Exception as e:
37
+ return {"success": False, "result": None, "error": str(e)}
38
+
39
+ @mcp.tool(name="mcmc_tool", description="Perform Markov Chain Monte Carlo")
40
+ def mcmc_tool(model: callable, num_samples: int) -> dict:
41
+ """
42
+ Perform Markov Chain Monte Carlo sampling using the provided model.
43
+
44
+ Parameters:
45
+ - model: The probabilistic model function.
46
+ - num_samples: The number of samples to draw.
47
+
48
+ Returns:
49
+ - A dictionary with success, result, and error fields.
50
+ """
51
+ try:
52
+ mcmc = MCMC(model, num_samples=num_samples)
53
+ result = mcmc.run()
54
+ return {"success": True, "result": result, "error": None}
55
+ except Exception as e:
56
+ return {"success": False, "result": None, "error": str(e)}
57
+
58
+ @mcp.tool(name="delta_distribution_tool", description="Create a Delta distribution")
59
+ def delta_distribution_tool(value: float) -> dict:
60
+ """
61
+ Create a Delta distribution with the specified value.
62
+
63
+ Parameters:
64
+ - value: The value for the Delta distribution.
65
+
66
+ Returns:
67
+ - A dictionary with success, result, and error fields.
68
+ """
69
+ try:
70
+ delta_dist = Delta(value)
71
+ return {"success": True, "result": delta_dist, "error": None}
72
+ except Exception as e:
73
+ return {"success": False, "result": None, "error": str(e)}
74
+
75
+ @mcp.tool(name="hmm_tool", description="Create a Hidden Markov Model")
76
+ def hmm_tool(transitions: list, emissions: list, initial: list) -> dict:
77
+ """
78
+ Create a Hidden Markov Model with the specified parameters.
79
+
80
+ Parameters:
81
+ - transitions: Transition probabilities.
82
+ - emissions: Emission probabilities.
83
+ - initial: Initial state probabilities.
84
+
85
+ Returns:
86
+ - A dictionary with success, result, and error fields.
87
+ """
88
+ try:
89
+ hmm = HiddenMarkovModel(transitions, emissions, initial)
90
+ return {"success": True, "result": hmm, "error": None}
91
+ except Exception as e:
92
+ return {"success": False, "result": None, "error": str(e)}
93
+
94
+ @mcp.tool(name="trace_tool", description="Trace a model execution")
95
+ def trace_tool(model: callable, data: dict) -> dict:
96
+ """
97
+ Trace the execution of a model with the provided data.
98
+
99
+ Parameters:
100
+ - model: The probabilistic model function.
101
+ - data: A dictionary containing observed data.
102
+
103
+ Returns:
104
+ - A dictionary with success, result, and error fields.
105
+ """
106
+ try:
107
+ traced = trace(model).get_trace(data)
108
+ return {"success": True, "result": traced, "error": None}
109
+ except Exception as e:
110
+ return {"success": False, "result": None, "error": str(e)}
111
+
112
+ def create_app() -> FastMCP:
113
+ """
114
+ Create and return the FastMCP application instance.
115
+
116
+ Returns:
117
+ - The FastMCP application instance.
118
+ """
119
+ return mcp
pyro/mcp_output/requirements.txt ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ fastmcp
2
+ fastapi
3
+ uvicorn[standard]
4
+ pydantic>=2.0.0
5
+ numpy>=1.7
6
+ opt_einsum>=2.3.2
7
+ pyro-api>=0.1.1
8
+ torch>=2.0
9
+ tqdm>=4.36
pyro/mcp_output/start_mcp.py ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ """
3
+ MCP Service Startup Entry
4
+ """
5
+ import sys
6
+ import os
7
+
8
+ project_root = os.path.dirname(os.path.abspath(__file__))
9
+ mcp_plugin_dir = os.path.join(project_root, "mcp_plugin")
10
+ if mcp_plugin_dir not in sys.path:
11
+ sys.path.insert(0, mcp_plugin_dir)
12
+
13
+ from mcp_service import create_app
14
+
15
+ def main():
16
+ """Start FastMCP service"""
17
+ app = create_app()
18
+ # Use environment variable to configure port, default 8000
19
+ port = int(os.environ.get("MCP_PORT", "8000"))
20
+
21
+ # Choose transport mode based on environment variable
22
+ transport = os.environ.get("MCP_TRANSPORT", "stdio")
23
+ if transport == "http":
24
+ app.run(transport="http", host="0.0.0.0", port=port)
25
+ else:
26
+ # Default to STDIO mode
27
+ app.run()
28
+
29
+ if __name__ == "__main__":
30
+ main()
pyro/mcp_output/workflow_summary.json ADDED
@@ -0,0 +1,219 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "repository": {
3
+ "name": "pyro",
4
+ "url": "https://github.com/pyro-ppl/pyro",
5
+ "local_path": "/export/zxcpu1/shiweijie/code/ghh/Code2MCP/workspace/pyro",
6
+ "description": "Python library",
7
+ "features": "Basic functionality",
8
+ "tech_stack": "Python",
9
+ "stars": 0,
10
+ "forks": 0,
11
+ "language": "Python",
12
+ "last_updated": "",
13
+ "complexity": "medium",
14
+ "intrusiveness_risk": "low"
15
+ },
16
+ "execution": {
17
+ "start_time": 1770447584.6202667,
18
+ "end_time": 1770447708.0682755,
19
+ "duration": 123.44800877571106,
20
+ "status": "success",
21
+ "workflow_status": "success",
22
+ "nodes_executed": [
23
+ "download",
24
+ "analysis",
25
+ "env",
26
+ "generate",
27
+ "run",
28
+ "review",
29
+ "finalize"
30
+ ],
31
+ "total_files_processed": 26,
32
+ "environment_type": "unknown",
33
+ "llm_calls": 0,
34
+ "deepwiki_calls": 0
35
+ },
36
+ "tests": {
37
+ "original_project": {
38
+ "passed": false,
39
+ "details": {},
40
+ "test_coverage": "100%",
41
+ "execution_time": 0,
42
+ "test_files": []
43
+ },
44
+ "mcp_plugin": {
45
+ "passed": true,
46
+ "details": {},
47
+ "service_health": "healthy",
48
+ "startup_time": 0,
49
+ "transport_mode": "stdio",
50
+ "fastmcp_version": "unknown",
51
+ "mcp_version": "unknown"
52
+ }
53
+ },
54
+ "analysis": {
55
+ "structure": {
56
+ "packages": [
57
+ "source.examples",
58
+ "source.examples.contrib",
59
+ "source.examples.cvae",
60
+ "source.examples.mixed_hmm",
61
+ "source.examples.scanvi",
62
+ "source.profiler",
63
+ "source.pyro",
64
+ "source.pyro.contrib",
65
+ "source.pyro.distributions",
66
+ "source.pyro.infer",
67
+ "source.pyro.nn",
68
+ "source.pyro.ops",
69
+ "source.pyro.optim",
70
+ "source.pyro.params",
71
+ "source.pyro.poutine",
72
+ "source.tests",
73
+ "source.tests.contrib",
74
+ "source.tests.distributions",
75
+ "source.tests.infer",
76
+ "source.tests.integration_tests",
77
+ "source.tests.nn",
78
+ "source.tests.ops",
79
+ "source.tests.optim",
80
+ "source.tests.params",
81
+ "source.tests.perf",
82
+ "source.tests.poutine"
83
+ ]
84
+ },
85
+ "dependencies": {
86
+ "has_environment_yml": false,
87
+ "has_requirements_txt": false,
88
+ "pyproject": true,
89
+ "setup_cfg": true,
90
+ "setup_py": true
91
+ },
92
+ "entry_points": {
93
+ "imports": [],
94
+ "cli": [],
95
+ "modules": []
96
+ },
97
+ "risk_assessment": {
98
+ "import_feasibility": 0.9,
99
+ "intrusiveness_risk": "low",
100
+ "complexity": "medium"
101
+ },
102
+ "deepwiki_analysis": {
103
+ "repo_url": "https://github.com/pyro-ppl/pyro",
104
+ "repo_name": "pyro",
105
+ "content": "pyro-ppl/pyro\nCore Primitives and Effect Handlers\nEffect Handlers\nTrace System\nDistributions\nDistribution Classes\nTransforms and Constraints\nSpecial Distributions\nDistribution Utilities\nInference Algorithms\nStochastic Variational Inference\nELBO Variants\nMCMC Methods\nImportance Sampling and Predictive\nModels and Guides\nThe Model/Guide Pattern\nParameter Management\nParameter Store\nExamples and Applications\nTutorial System\nBayesian Statistical Models\nDeep Generative Models\nSpecialized Applications\nDevelopment Infrastructure\nSetup and Installation\nTesting Framework\nSpecial Operations and Utilities\ndocs/requirements.txt\ndocs/source/conf.py\npyproject.toml\npyro/__init__.py\npyro/distributions/constraints.py\npyro/poutine/__init__.py\npyro/util.py\nThis page provides a high-level introduction to Pyro's architecture, design philosophy, and core components. It serves as an entry point for understanding how the system is structured and how its parts interact.\nFor detailed information about specific subsystems, see:\nCore primitives and effect handlers:Section 2\nDistribution system:Section 3\nInference algorithms:Section 4\nModel and guide patterns:Section 5\nParameter management:Section 6\nWhat is Pyro?\nPyro is a universal probabilistic programming language (PPL) built on PyTorch. It enables users to write generative models as Python programs and perform inference over them using a variety of algorithms including variational inference (SVI) and Markov chain Monte Carlo (MCMC).\nPackage Identity:\nName:pyro-pplsetup.py86\nDescription:\"A Python library for probabilistic modeling and inference\"setup.py88\nVersion:1.9.1+pyro/__init__.py31\nPython Requirements:>=3.8setup.py147\nCore Dependencies:\nSources:setup.py102-111pyro/__init__.py1-67\nDesign Philosophy\nPyro is built on four core principles that guide its architecture:\nUniversalAny computable distributionScalableMinimal overhead vs hand-written codeMinimalSmall core, powerful abstractionsFlexibleAutomation + manual controlPyro Core System\nUniversalAny computable distribution\nScalableMinimal overhead vs hand-written code\nMinimalSmall core, powerful abstractions\nFlexibleAutomation + manual control\nPyro Core System\nPyro can represent any computable probability distribution through its flexible programming model. Models are ordinary Python functions that can include loops, recursion, and arbitrary control flow.\nPyro is designed to scale to large datasets with minimal overhead. It builds directly on PyTorch's tensor operations and automatic differentiation, avoiding unnecessary abstractions.\nThe core system is implemented with a small set of composable abstractions. The effect handler system (poutine) provides the foundation for model manipulation without requiring extensive framework code.\nPyro provides high-level automation (e.g., automatic variational guides) while allowing experts to customize inference at any level through effect handlers and custom implementations.\nSources:README.md24-29\nSystem Architecture Overview\nPyro's architecture consists of several layered subsystems:\nParameter LayerDistribution LayerInference LayerEffect Handler Layer (Poutine)Primitive LayerUser LayerUser Model CodePython functions withpyro.sample, pyro.paramPyroModuleNeural network integrationExamples & TutorialsVAE, GP, HMM, etc.Primitive Operationspyro.samplepyro.parampyro.platepyro.factorMessage Runtime_PYRO_STACKapply_stack()Effect Handlerstrace, replaycondition, blockscale, enumSVIStochastic Variational InferenceMCMCHMC, NUTSAutoGuideAutomatic guide generationELBO VariantsTrace_ELBOTraceEnum_ELBOPyTorch Distributionstorch.distributions.*Pyro DistributionsDelta, HMM, etc.Constraints & TransformsParamStoreDictGlobal parameter storagePyroOptimWrapped PyTorch optimizers\nParameter Layer\nDistribution Layer\nInference Layer\nEffect Handler Layer (Poutine)\nPrimitive Layer\nUser Model CodePython functions withpyro.sample, pyro.param\nPyroModuleNeural network integration\nExamples & TutorialsVAE, GP, HMM, etc.\nPrimitive Operationspyro.samplepyro.parampyro.platepyro.factor\nMessage Runtime_PYRO_STACKapply_stack()\nEffect Handlerstrace, replaycondition, blockscale, enum\nSVIStochastic Variational Inference\nMCMCHMC, NUTS\nAutoGuideAutomatic guide generation\nELBO VariantsTrace_ELBOTraceEnum_ELBO\nPyTorch Distributionstorch.distributions.*\nPyro DistributionsDelta, HMM, etc.\nConstraints & Transforms\nParamStoreDictGlobal parameter storage\nPyroOptimWrapped PyTorch optimizers\nSources:pyro/__init__.py1-67pyro/poutine/__init__.py1-59\nCore Components and Code Entities\nPrimitives Module\nThe top-level module exports the fundamental primitives that users interact with:\npyro.sample\npyro.primitives\npyro.primitives\npyro.primitives\npyro.factor\npyro.primitives\npyro.deterministic\npyro.primitives\nAdditional utilities:\npyro.enable_validation()- Enable shape and distribution validationpyro/__init__.py12\npyro.enable_validation()\npyro.clear_param_store()- Reset global parameter storagepyro/__init__.py10\npyro.clear_param_store()\npyro.get_param_store()- Access the global parameter storepyro/__init__.py14\npyro.get_param_store()\npyro.set_rng_seed()- Set random number generator seedpyro/util.py37-45\npyro.set_rng_seed()\nSources:pyro/__init__.py8-26pyro/__init__.py39-66\nPoutine (Effect Handler) System\nPoutine is the effect handler system that intercepts and transforms probabilistic primitives:\nTrace Data StructureCore RuntimeHandler ExportstraceRecords executionreplayReplays recorded samplesconditionFixes observationsblockHides sites from handlersscaleScales log probabilitiesenumEnumerates discrete variablesreparamApplies reparameterization_PYRO_STACKGlobal message stackapply_stack()Message dispatcherMessengerBase handler classTraceExecution recordingMessageSite information dict\nTrace Data Structure\nCore Runtime\nHandler Exports\ntraceRecords execution\nreplayReplays recorded samples\nconditionFixes observations\nblockHides sites from handlers\nscaleScales log probabilities\nenumEnumerates discrete variables\nreparamApplies reparameterization\n_PYRO_STACKGlobal message stack\napply_stack()Message dispatcher\nMessengerBase handler class\nTraceExecution recording\nMessageSite information dict\nKey handler exports frompyro.poutine:\npyro.poutine\ntrace- Records model execution into a Trace objectpyro/poutine/__init__.py23\nreplay- Re-executes model with fixed sample valuespyro/poutine/__init__.py19\ncondition- Conditions model on observed datapyro/poutine/__init__.py8\nblock- Blocks primitives from outer handlerspyro/poutine/__init__.py5\nscale- Scales log probabilities (for subsampling)pyro/poutine/__init__.py20\nenum- Enumerates discrete latent variablespyro/poutine/__init__.py10\nSources:pyro/poutine/__init__.py1-59\nProgramming Model: From Code to Execution\nThis diagram shows how user code flows through Pyro's execution model:\n\"ParamStoreDict\"\"Distribution\"\"Effect Handlers\"\"_PYRO_STACK\"\"pyro.sample()\"\"User Code\"\"ParamStoreDict\"\"Distribution\"\"Effect Handlers\"\"_PYRO_STACK\"\"pyro.sample()\"\"User Code\"Message contains:name, fn, value, args, kwargsEach handler transforms messagePost-process (top-to-bottom)alt[If pyro.param() called]pyro.sample(\"x\", dist)Create messageProcess message (bottom-to-top)_process_message()Sample from distributionSample value_postprocess_message()Return processed messagevalueReturn samplepyro.param(\"theta\")Get/create parameterParameter tensorReturn parameter\nSources:pyro/__init__.py8-26pyro/poutine/__init__.py27-28\nParameter Management Architecture\nPyro maintains a global parameter store that synchronizes with PyTorch module parameters:\nOptimizationGlobal StorageUser Interfacepyro.param('theta', init)Get/create parameterPyroModule.x = PyroParam(...)Module-level parameterParamStoreDict_params: Dict[str, Tensor]_constraints: Dict[str, Constraint]pyro.get_param_store()Access singletonpyro.clear_param_store()Reset all parametersPyroOptimWraps torch.optimSVI.step()Optimization step\nOptimization\nGlobal Storage\nUser Interface\npyro.param('theta', init)Get/create parameter\nPyroModule.x = PyroParam(...)Module-level parameter\nParamStoreDict_params: Dict[str, Tensor]_constraints: Dict[str, Constraint]\npyro.get_param_store()Access singleton\npyro.clear_param_store()Reset all parameters\nPyroOptimWraps torch.optim\nSVI.step()Optimization step\nKey operations:\npyro.param(name, init_value, constraint=constraints.real)- Declare/retrieve parameter\npyro.param(name, init_value, constraint=constraints.real)\npyro.get_param_store()- Get the global ParamStoreDict instancepyro/__init__.py14\npyro.get_param_store()\npyro.clear_param_store()- Clear all parameterspyro/__init__.py10\npyro.clear_param_store()\nSources:pyro/__init__.py10-18pyro/__init__.py54\nDistribution System\nPyro extends PyTorch's distribution library with additional distributions and functionality:\nPyro-SpecificStandard DistributionsPyro ExtensionsPyTorch Basetorch.distributions.Distributiontorch.distributions.constraintsTorchDistributionMixinPyro compatibility layerpyro.distributions.constraintsAdditional constraintsNormal, Beta, Gamma, etc.Wrapped PyTorch distributionsDeltaDegenerate distributionHiddenMarkovModelDiscreteHMM, GaussianHMMEmpiricalSample-based distribution\nPyro-Specific\nStandard Distributions\nPyro Extensions\nPyTorch Base\ntorch.distributions.Distribution\ntorch.distributions.constraints\nTorchDistributionMixinPyro compatibility layer\npyro.distributions.constraintsAdditional constraints\nNormal, Beta, Gamma, etc.Wrapped PyTorch distributions\nDeltaDegenerate distribution\nHiddenMarkovModelDiscreteHMM, GaussianHMM\nEmpiricalSample-based distribution\nConstraint extensionsinpyro.distributions.constraints:\npyro.distributions.constraints\ninteger- Integer valuespyro/distributions/constraints.py152\nsphere- Points on Euclidean spherepyro/distributions/constraints.py155\ncorr_matrix- Correlation matricespyro/distributions/constraints.py151\ncorr_matrix\nordered_vector- Monotonically increasing vectorspyro/distributions/constraints.py153\nordered_vector\nAll PyTorch constraints viafrom torch.distributions.constraints import *pyro/distributions/constraints.py5\nfrom torch.distributions.constraints import *\nSources:pyro/distributions/constraints.py1-235\nInference Ecosystem\nPyro provides multiple inference algorithms that operate on the same model-guide abstraction:\npyro.infer.SVI\npyro.infer.MCMC\npyro.infer.MCMC\npyro.infer.Importance\nELBO variants for SVI:\nTrace_ELBO- Basic Monte Carlo ELBO estimator\nTraceEnum_ELBO- Enumerates discrete latent variables\nTraceEnum_ELBO\nTraceGraph_ELBO- Variance reduction via Rao-Blackwellization\nTraceGraph_ELBO\nRenyiELBO- Rényi divergence objective (α-divergence)\nAutomatic guides:",
106
+ "model": "gpt-4o-2024-08-06",
107
+ "source": "selenium",
108
+ "success": true
109
+ },
110
+ "code_complexity": {
111
+ "cyclomatic_complexity": "medium",
112
+ "cognitive_complexity": "medium",
113
+ "maintainability_index": 75
114
+ },
115
+ "security_analysis": {
116
+ "vulnerabilities_found": 0,
117
+ "security_score": 85,
118
+ "recommendations": []
119
+ }
120
+ },
121
+ "plugin_generation": {
122
+ "files_created": [
123
+ "mcp_output/start_mcp.py",
124
+ "mcp_output/mcp_plugin/__init__.py",
125
+ "mcp_output/mcp_plugin/mcp_service.py",
126
+ "mcp_output/mcp_plugin/adapter.py",
127
+ "mcp_output/mcp_plugin/main.py",
128
+ "mcp_output/requirements.txt",
129
+ "mcp_output/README_MCP.md"
130
+ ],
131
+ "main_entry": "start_mcp.py",
132
+ "requirements": [
133
+ "fastmcp>=0.1.0",
134
+ "pydantic>=2.0.0"
135
+ ],
136
+ "readme_path": "/export/zxcpu1/shiweijie/code/ghh/Code2MCP/workspace/pyro/mcp_output/README_MCP.md",
137
+ "adapter_mode": "import",
138
+ "total_lines_of_code": 0,
139
+ "generated_files_size": 0,
140
+ "tool_endpoints": 0,
141
+ "supported_features": [
142
+ "Basic functionality"
143
+ ],
144
+ "generated_tools": [
145
+ "Basic tools",
146
+ "Health check tools",
147
+ "Version info tools"
148
+ ]
149
+ },
150
+ "code_review": {},
151
+ "errors": [],
152
+ "warnings": [],
153
+ "recommendations": [
154
+ "Improve test coverage by adding more unit tests for critical modules",
155
+ "streamline the import strategy to reduce complexity",
156
+ "enhance documentation for better understanding of core components",
157
+ "optimize the size of large files for better performance",
158
+ "ensure all dependencies are clearly defined and up-to-date",
159
+ "implement continuous integration to automate testing and deployment",
160
+ "refactor code to improve readability and maintainability",
161
+ "consider adding more examples and tutorials to demonstrate usage",
162
+ "review and update the README file to provide a comprehensive overview of the project",
163
+ "conduct regular code reviews to maintain code quality."
164
+ ],
165
+ "performance_metrics": {
166
+ "memory_usage_mb": 0,
167
+ "cpu_usage_percent": 0,
168
+ "response_time_ms": 0,
169
+ "throughput_requests_per_second": 0
170
+ },
171
+ "deployment_info": {
172
+ "supported_platforms": [
173
+ "Linux",
174
+ "Windows",
175
+ "macOS"
176
+ ],
177
+ "python_versions": [
178
+ "3.8",
179
+ "3.9",
180
+ "3.10",
181
+ "3.11",
182
+ "3.12"
183
+ ],
184
+ "deployment_methods": [
185
+ "Docker",
186
+ "pip",
187
+ "conda"
188
+ ],
189
+ "monitoring_support": true,
190
+ "logging_configuration": "structured"
191
+ },
192
+ "execution_analysis": {
193
+ "success_factors": [
194
+ "Comprehensive node execution covering download, analysis, environment setup, generation, and review",
195
+ "Successful MCP plugin generation with healthy service status"
196
+ ],
197
+ "failure_reasons": [],
198
+ "overall_assessment": "excellent",
199
+ "node_performance": {
200
+ "download_time": "Efficient download process completed successfully",
201
+ "analysis_time": "Thorough analysis completed within expected timeframe",
202
+ "generation_time": "Code generation executed smoothly without delays",
203
+ "test_time": "Testing phase completed quickly, but original project tests did not pass"
204
+ },
205
+ "resource_usage": {
206
+ "memory_efficiency": "Memory usage data not available",
207
+ "cpu_efficiency": "CPU usage data not available",
208
+ "disk_usage": "Disk usage data not available"
209
+ }
210
+ },
211
+ "technical_quality": {
212
+ "code_quality_score": 85,
213
+ "architecture_score": 90,
214
+ "performance_score": 80,
215
+ "maintainability_score": 75,
216
+ "security_score": 85,
217
+ "scalability_score": 80
218
+ }
219
+ }
pyro/source/.codecov.yml ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright Contributors to the Pyro project.
2
+ #
3
+ # SPDX-License-Identifier: Apache-2.0
4
+
5
+ ignore:
6
+ - "pyro/docutil.py"
7
+ - "pyro/logger.py"
8
+
9
+ coverage:
10
+ range: 60..95
11
+ round: nearest
12
+ precision: 2
13
+
14
+ comment: false
pyro/source/.coveragerc ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright Contributors to the Pyro project.
2
+ #
3
+ # SPDX-License-Identifier: Apache-2.0
4
+
5
+ [report]
6
+ omit =
7
+ pyro/docutil.py
8
+ pyro/logger.py
9
+ exclude_lines =
10
+ pragma: no cover
11
+ def backward
12
+ raise AssertionError
13
+ raise NotImplementedError
14
+ raise ValueError
15
+ except NotImplementedError
16
+ except ImportError
17
+ except KeyError
18
+ except TypeError
19
+ warnings\.warn.*
20
+ warn_if.*
21
+ if __name__ == .__main__.:
pyro/source/.readthedocs.yml ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright Contributors to the Pyro project.
2
+ #
3
+ # SPDX-License-Identifier: Apache-2.0
4
+
5
+ # Required
6
+ version: 2
7
+
8
+ build:
9
+ os: ubuntu-20.04
10
+ tools:
11
+ python: "3.8"
12
+
13
+ # Build documentation in the docs/ directory with Sphinx
14
+ sphinx:
15
+ configuration: docs/source/conf.py
16
+
17
+ # Optionally build your docs in additional formats such as PDF and ePub
18
+ # formats: all
19
+
20
+ # Optionally set the version of Python and requirements required to build your docs
21
+ python:
22
+ install:
23
+ - requirements: docs/requirements.txt
pyro/source/CODE_OF_CONDUCT.md ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ <!--
3
+ Copyright Contributors to the Pyro project.
4
+
5
+ SPDX-License-Identifier: Apache-2.0
6
+ -->
7
+
8
+ # Contributor Covenant Code of Conduct
9
+
10
+ ## Our Pledge
11
+
12
+ In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
13
+
14
+ ## Our Standards
15
+
16
+ Examples of behavior that contributes to creating a positive environment include:
17
+
18
+ * Using welcoming and inclusive language
19
+ * Being respectful of differing viewpoints and experiences
20
+ * Gracefully accepting constructive criticism
21
+ * Focusing on what is best for the community
22
+ * Showing empathy towards other community members
23
+
24
+ Examples of unacceptable behavior by participants include:
25
+
26
+ * The use of sexualized language or imagery and unwelcome sexual attention or advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic address, without explicit permission
30
+ * Other conduct which could reasonably be considered inappropriate in a professional setting
31
+
32
+ ## Our Responsibilities
33
+
34
+ Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
35
+
36
+ Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
37
+
38
+ ## Scope
39
+
40
+ This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
41
+
42
+ ## Enforcement
43
+
44
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at fritz.obermeyer@gmail.com or fehiepsi@gmail.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
45
+
46
+ Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
47
+
48
+ ## Attribution
49
+
50
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
51
+
52
+ [homepage]: http://contributor-covenant.org
53
+ [version]: http://contributor-covenant.org/version/1/4/
pyro/source/CONTRIBUTING.md ADDED
@@ -0,0 +1,133 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!--
2
+ Copyright Contributors to the Pyro project.
3
+
4
+ SPDX-License-Identifier: Apache-2.0
5
+ -->
6
+
7
+ # Development
8
+
9
+ Please follow our established coding style including variable names, module imports, and function definitions.
10
+ The Pyro codebase follows the [PEP8 style guide](https://www.python.org/dev/peps/pep-0008/)
11
+ (which you can check with `make lint`) and follows
12
+ [`isort`](https://github.com/timothycrosley/isort) import order (which you can enforce with `make format`).
13
+ When creating new files please add a license header; this can be done automatically via `make license` or simply `make format`.
14
+
15
+ # Setup
16
+
17
+ First install [PyTorch](http://pytorch.org/).
18
+
19
+ Then, install all the dev dependencies for Pyro.
20
+ ```sh
21
+ make install
22
+ ```
23
+ or explicitly
24
+ ```sh
25
+ pip install -e .[dev]
26
+ ```
27
+
28
+ # Testing
29
+
30
+ Before submitting a pull request, please autoformat code and ensure that unit tests pass locally
31
+ ```sh
32
+ make format # runs isort
33
+ make test # linting and unit tests
34
+ ```
35
+
36
+ If you've modified core pyro code, examples, or tutorials, you can run more comprehensive tests locally (after first adding any new files to the appropriate `tests/` script)
37
+ ```sh
38
+ make test-examples # test examples/
39
+ make integration-test # longer-running tests (may take hours)
40
+ make test-cuda # runs unit tests in cuda mode
41
+ ```
42
+
43
+ To run all tests locally in parallel, use the `pytest-xdist` package
44
+ ```sh
45
+ pip install pytest-xdist
46
+ pytest -vs -n auto
47
+ ```
48
+
49
+ To run a single test from the command line
50
+ ```sh
51
+ pytest -vs {path_to_test}::{test_name}
52
+ # or in cuda mode
53
+ CUDA_TEST=1 PYRO_DTYPE=float64 PYRO_DEVICE=cuda pytest -vs {path_to_test}::{test_name}
54
+ ```
55
+
56
+ To ensure documentation builds correctly, run
57
+ ```sh
58
+ make docs
59
+ ```
60
+
61
+ ## Testing Tutorials
62
+
63
+ We run some tutorials on travis to avoid bit rot.
64
+ Before submitting a new tutorial, please run `make scrub` from
65
+ the top-level pyro directory in order to scrub the metadata in
66
+ the notebooks.
67
+ To enable a tutorial for testing
68
+
69
+ 1. Add a line `smoke_test = ('CI' in os.environ)` to your tutorial. Our test
70
+ scripts only test tutorials that contain the string `smoke_test`.
71
+ 2. Each time you do something expensive for many iterations, set the number
72
+ of iterations like this:
73
+ ```py
74
+ for epoch in range(200 if not smoke_test else 1):
75
+ ...
76
+ ```
77
+
78
+ You can test locally by running `make test-tutorials`.
79
+
80
+ # Profiling
81
+
82
+ The profiler module contains scripts to support profiling different
83
+ Pyro modules, as well as test for performance regression.
84
+
85
+ To run the profiling utilities, ensure that all dependencies for profiling are satisfied,
86
+ by running `make install`, or more specifically, `pip install -e .[profile]`.
87
+
88
+ There are some generic test cases available in the `profiler` module. Currently, this supports
89
+ only the `distributions` library, but we will be adding test cases for inference methods
90
+ soon.
91
+
92
+ #### Some useful invocations
93
+
94
+ To get help on the parameters that the profiling script takes, run:
95
+
96
+ ```sh
97
+ python -m profiler.distributions --help
98
+ ```
99
+
100
+ To run the profiler on all the distributions, simply run:
101
+
102
+ ```sh
103
+ python -m profiler.distributions
104
+ ```
105
+
106
+ To run the profiler on a few distributions by varying the batch size, run:
107
+
108
+ ```sh
109
+ python -m profiler.distributions --dist bernoulli normal --batch_sizes 1000 100000
110
+ ```
111
+
112
+ To get more details on the potential sources of slowdown, use the `cProfile` tool
113
+ as follows:
114
+
115
+ ```sh
116
+ python -m profiler.distributions --dist bernoulli --tool cprofile
117
+ ```
118
+
119
+ # Submitting
120
+
121
+ For larger changes, please open an issue for discussion before submitting a pull request.
122
+ For relevant design questions to consider, see past
123
+ [design documents](https://github.com/pyro-ppl/pyro/wiki/Design-Docs).
124
+
125
+ In your pull request description on github, please note:
126
+ - Proposed changes
127
+ - Links to related issues/PRs
128
+ - New and existing tests
129
+
130
+ Before submitting, please run `make format`, `make lint`, and running tests as described above.
131
+
132
+ For speculative changes meant for early-stage review, include `[WIP]` in the PR's title.
133
+ (One of the maintainers will add the `WIP` tag.)
pyro/source/LICENSE.md ADDED
@@ -0,0 +1,202 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
pyro/source/LICENSES/Apache-2.0.txt ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
10
+
11
+ "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
12
+
13
+ "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
14
+
15
+ "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
16
+
17
+ "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
18
+
19
+ "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
20
+
21
+ "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
22
+
23
+ "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
24
+
25
+ "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
26
+
27
+ "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
28
+
29
+ 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
30
+
31
+ 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
32
+
33
+ 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
34
+
35
+ (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and
36
+
37
+ (b) You must cause any modified files to carry prominent notices stating that You changed the files; and
38
+
39
+ (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
40
+
41
+ (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
42
+
43
+ You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
44
+
45
+ 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
46
+
47
+ 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
48
+
49
+ 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
50
+
51
+ 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
52
+
53
+ 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
54
+
55
+ END OF TERMS AND CONDITIONS
56
+
57
+ APPENDIX: How to apply the Apache License to your work.
58
+
59
+ To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives.
60
+
61
+ Copyright [yyyy] [name of copyright owner]
62
+
63
+ Licensed under the Apache License, Version 2.0 (the "License");
64
+ you may not use this file except in compliance with the License.
65
+ You may obtain a copy of the License at
66
+
67
+ http://www.apache.org/licenses/LICENSE-2.0
68
+
69
+ Unless required by applicable law or agreed to in writing, software
70
+ distributed under the License is distributed on an "AS IS" BASIS,
71
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
72
+ See the License for the specific language governing permissions and
73
+ limitations under the License.
pyro/source/LICENSES/BSD-3-Clause.txt ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Copyright (c) <year> <owner>.
2
+
3
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
4
+
5
+ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
6
+
7
+ 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
8
+
9
+ 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
10
+
11
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
pyro/source/LICENSES/MIT.txt ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ MIT License
2
+
3
+ Copyright (c) <year> <copyright holders>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
pyro/source/MANIFEST.in ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ include LICENSE.md MANIFEST.in
2
+ recursive-include pyro *.cpp
pyro/source/Makefile ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .PHONY: all install docs lint format test integration-test clean FORCE
2
+
3
+ all: docs test
4
+
5
+ install: FORCE
6
+ pip install -e .[dev,profile] --config-settings editable_mode=strict
7
+
8
+ uninstall: FORCE
9
+ pip uninstall pyro-ppl
10
+
11
+ docs: FORCE
12
+ $(MAKE) -C docs html
13
+
14
+ apidoc: FORCE
15
+ $(MAKE) -C docs apidoc
16
+
17
+ tutorial: FORCE
18
+ $(MAKE) -C tutorial html
19
+
20
+ lint: FORCE
21
+ ruff check .
22
+ black --check *.py pyro examples tests scripts profiler
23
+ python scripts/update_headers.py --check
24
+ mypy --install-types --non-interactive pyro scripts tests
25
+
26
+ license: FORCE
27
+ python scripts/update_headers.py
28
+
29
+ format: license FORCE
30
+ ruff check --fix .
31
+ black *.py pyro examples tests scripts profiler
32
+
33
+ version: FORCE
34
+ python scripts/update_version.py
35
+
36
+ scrub: FORCE
37
+ find tutorial -name "*.ipynb" | xargs python -m nbstripout --keep-output --keep-count
38
+ find tutorial -name "*.ipynb" | xargs python tutorial/source/cleannb.py
39
+
40
+ doctest: FORCE
41
+ # We skip testing pyro.distributions.torch wrapper classes because
42
+ # they include torch docstrings which are tested upstream.
43
+ python -m pytest -p tests.doctest_fixtures --doctest-modules -o filterwarnings=ignore pyro --ignore=pyro/distributions/torch.py
44
+
45
+ perf-test: FORCE
46
+ bash scripts/perf_test.sh ${ref}
47
+
48
+ profile: ref=dev
49
+
50
+ profile: FORCE
51
+ bash scripts/profile_model.sh ${ref} ${models}
52
+
53
+ test: lint docs doctest FORCE
54
+ pytest -vx -n auto --stage unit
55
+
56
+ test-examples: lint FORCE
57
+ pytest -vx --stage test_examples
58
+
59
+ test-tutorials: lint FORCE
60
+ grep -l smoke_test tutorial/source/*.ipynb | xargs grep -L 'smoke_test = False' \
61
+ | CI=1 xargs pytest -vx --nbval-lax --current-env
62
+
63
+ integration-test: lint FORCE
64
+ pytest -vx -n auto --stage integration
65
+
66
+ test-all: lint FORCE
67
+ pytest -vx -n auto
68
+ CI=1 grep -l smoke_test tutorial/source/*.ipynb \
69
+ | xargs pytest -vx --nbval-lax
70
+
71
+ test-cuda: lint FORCE
72
+ CUDA_TEST=1 PYRO_DTYPE=float64 PYRO_DEVICE=cuda pytest -vx --stage unit
73
+ CUDA_TEST=1 pytest -vx tests/test_examples.py::test_cuda
74
+
75
+ test-cuda-lax: lint FORCE
76
+ CUDA_TEST=1 PYRO_DTYPE=float64 PYRO_DEVICE=cuda pytest -vx --stage unit --lax
77
+ CUDA_TEST=1 pytest -vx tests/test_examples.py::test_cuda
78
+
79
+ test-jit: FORCE
80
+ @echo See jit.log
81
+ pytest -v -n auto --tb=short --runxfail tests/infer/test_jit.py tests/test_examples.py::test_jit | tee jit.log
82
+ pytest -v -n auto --tb=short --runxfail tests/infer/mcmc/test_hmc.py tests/infer/mcmc/test_nuts.py \
83
+ -k JIT=True | tee -a jit.log
84
+
85
+ test-funsor: lint FORCE
86
+ pytest -vx -n auto --stage funsor
87
+
88
+ clean: FORCE
89
+ git clean -dfx -e pyro_ppl.egg-info
90
+
91
+ FORCE:
pyro/source/README.md ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!--
2
+ Copyright Contributors to the Pyro project.
3
+
4
+ SPDX-License-Identifier: Apache-2.0
5
+ -->
6
+
7
+ <div align="center">
8
+ <a href="http://pyro.ai"> <img width="220px" height="220px" src="docs/source/_static/img/pyro_logo_with_text.png"></a>
9
+ </div>
10
+
11
+ -----------------------------------------
12
+
13
+ [![Build Status](https://github.com/pyro-ppl/pyro/workflows/CI/badge.svg)](https://github.com/pyro-ppl/pyro/actions)
14
+ [![Coverage Status](https://coveralls.io/repos/github/pyro-ppl/pyro/badge.svg?branch=dev)](https://coveralls.io/github/pyro-ppl/pyro?branch=dev)
15
+ [![Latest Version](https://badge.fury.io/py/pyro-ppl.svg)](https://pypi.python.org/pypi/pyro-ppl)
16
+ [![Documentation Status](https://readthedocs.org/projects/pyro-ppl/badge/?version=dev)](http://pyro-ppl.readthedocs.io/en/stable/?badge=dev)
17
+ [![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/3056/badge)](https://bestpractices.coreinfrastructure.org/projects/3056)
18
+
19
+ [Getting Started](http://pyro.ai/examples) |
20
+ [Documentation](http://docs.pyro.ai/) |
21
+ [Community](http://forum.pyro.ai/) |
22
+ [Contributing](https://github.com/pyro-ppl/pyro/blob/master/CONTRIBUTING.md)
23
+
24
+ Pyro is a flexible, scalable deep probabilistic programming library built on PyTorch. Notably, it was designed with these principles in mind:
25
+
26
+ - **Universal**: Pyro is a universal PPL - it can represent any computable probability distribution.
27
+ - **Scalable**: Pyro scales to large data sets with little overhead compared to hand-written code.
28
+ - **Minimal**: Pyro is agile and maintainable. It is implemented with a small core of powerful, composable abstractions.
29
+ - **Flexible**: Pyro aims for automation when you want it, control when you need it. This is accomplished through high-level abstractions to express generative and inference models, while allowing experts easy-access to customize inference.
30
+
31
+ Pyro was originally developed at Uber AI and is now actively maintained by community contributors, including a dedicated team at the [Broad Institute](https://www.broadinstitute.org/).
32
+ In 2019, Pyro [became](https://www.linuxfoundation.org/press-release/2019/02/pyro-probabilistic-programming-language-becomes-newest-lf-deep-learning-project/) a project of the Linux Foundation, a neutral space for collaboration on open source software, open standards, open data, and open hardware.
33
+
34
+ For more information about the high level motivation for Pyro, check out our [launch blog post](http://eng.uber.com/pyro).
35
+ For additional blog posts, check out work on [experimental design](https://eng.uber.com/oed-pyro-release/) and
36
+ [time-to-event modeling](https://eng.uber.com/modeling-censored-time-to-event-data-using-pyro/) in Pyro.
37
+
38
+ ## Installing
39
+
40
+ ### Installing a stable Pyro release
41
+
42
+ **Install using pip:**
43
+ ```sh
44
+ pip install pyro-ppl
45
+ ```
46
+
47
+ **Install from source:**
48
+ ```sh
49
+ git clone git@github.com:pyro-ppl/pyro.git
50
+ cd pyro
51
+ git checkout master # master is pinned to the latest release
52
+ pip install .
53
+ ```
54
+
55
+ **Install with extra packages:**
56
+
57
+ To install the dependencies required to run the probabilistic models included in the `examples`/`tutorials` directories, please use the following command:
58
+ ```sh
59
+ pip install pyro-ppl[extras]
60
+ ```
61
+ Make sure that the models come from the same release version of the [Pyro source code](https://github.com/pyro-ppl/pyro/releases) as you have installed.
62
+
63
+ ### Installing Pyro dev branch
64
+
65
+ For recent features you can install Pyro from source.
66
+
67
+ **Install Pyro using pip:**
68
+
69
+ ```sh
70
+ pip install git+https://github.com/pyro-ppl/pyro.git
71
+ ```
72
+ or, with the `extras` dependency to run the probabilistic models included in the `examples`/`tutorials` directories:
73
+ ```sh
74
+ pip install git+https://github.com/pyro-ppl/pyro.git#egg=project[extras]
75
+ ```
76
+
77
+ **Install Pyro from source:**
78
+
79
+ ```sh
80
+ git clone https://github.com/pyro-ppl/pyro
81
+ cd pyro
82
+ pip install . # pip install .[extras] for running models in examples/tutorials
83
+ ```
84
+
85
+ ## Running Pyro from a Docker Container
86
+
87
+ Refer to the instructions [here](docker/README.md).
88
+
89
+ ## Citation
90
+ If you use Pyro, please consider citing:
91
+ ```
92
+ @article{bingham2019pyro,
93
+ author = {Eli Bingham and
94
+ Jonathan P. Chen and
95
+ Martin Jankowiak and
96
+ Fritz Obermeyer and
97
+ Neeraj Pradhan and
98
+ Theofanis Karaletsos and
99
+ Rohit Singh and
100
+ Paul A. Szerlip and
101
+ Paul Horsfall and
102
+ Noah D. Goodman},
103
+ title = {Pyro: Deep Universal Probabilistic Programming},
104
+ journal = {J. Mach. Learn. Res.},
105
+ volume = {20},
106
+ pages = {28:1--28:6},
107
+ year = {2019},
108
+ url = {http://jmlr.org/papers/v20/18-403.html}
109
+ }
110
+ ```
pyro/source/RELEASE-MANAGEMENT.md ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!--
2
+ Copyright Contributors to the Pyro project.
3
+
4
+ SPDX-License-Identifier: Apache-2.0
5
+ -->
6
+
7
+ # Pyro release management
8
+
9
+ This describes the process by which versions of Pyro are officially released to the public.
10
+
11
+ ## Versioning
12
+
13
+ Releases are versioned according to the `version_prefix` constant in [pyro/__init__.py](pyro/__init__.py).
14
+ Pyro releases follow semantic versioning with the following caveats:
15
+
16
+ - Behavior of documented APIs will remain stable across minor releases, except for bug fixes and features marked EXPERIMENTAL or DEPRECATED.
17
+ - Serialization formats will remain stable across patch releases, but may change across minor releases (e.g. if you save a model in 1.0.0, it will be safe to load it in 1.0.1, but not in 1.1.0).
18
+ - Undocumented APIs, features marked EXPERIMENTAL or DEPRECATED, and anything in `pyro.contrib` may change at any time (though we aim for stability).
19
+ - All deprecated features throw a `FutureWarning` and specify possible work-arounds. Features marked as deprecated will not be maintained, and are likely to be removed in a future release.
20
+ - If you want more stability for a particular feature, [contribute](https://github.com/pyro-ppl/pyro/blob/dev/CONTRIBUTING.md) a unit test.
21
+
22
+ ## Release process
23
+
24
+ Pyro is released at irregular cadence, typically about 4 times per year.
25
+
26
+ Releases are managed by:
27
+ - [Fritz Obermeyer](https://github.com/fritzo)
28
+ - [Neeraj Pradhan](https://github.com/neerajprad)
29
+ - [JP Chen](https://github.com/jpchen)
30
+
31
+ Releases and release notes are published to [github](https://github.com/pyro-ppl/pyro/releases).
32
+ Documentation for is published to [readthedocs](https://docs.pyro.ai).
33
+ Release builds are published to [pypi](https://pypi.org/project/pyro-ppl/).
pyro/source/__init__.py ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ """
3
+ pyro Project Package Initialization File
4
+ """
pyro/source/docker/Dockerfile ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright Contributors to the Pyro project.
2
+ #
3
+ # SPDX-License-Identifier: Apache-2.0
4
+
5
+ ARG base_img=ubuntu:24.04
6
+ FROM ${base_img}
7
+
8
+ # Optional args
9
+ ARG python_version=3
10
+ ARG pyro_branch=release
11
+ ARG pytorch_whl=cpu
12
+ ARG pytorch_branch=release
13
+ ARG uid=1000
14
+ ARG gid=1000
15
+ ARG ostype=Linux
16
+ ARG pyro_git_url=https://github.com/pyro-ppl/pyro.git
17
+ ARG trust_hosts=no
18
+
19
+ # Configurable settings
20
+ ENV USER_NAME pyromancer
21
+ ENV CONDA_DIR /opt/conda
22
+ ENV WORK_DIR /home/${USER_NAME}/workspace
23
+ ENV PATH ${CONDA_DIR}/bin:${PATH}
24
+
25
+ # Install linux utils
26
+ RUN apt-get update && apt-get install -y --no-install-recommends \
27
+ build-essential \
28
+ cmake \
29
+ git \
30
+ wget \
31
+ ca-certificates && \
32
+ rm -rf /var/lib/apt/lists/*
33
+
34
+ # Change to default user
35
+ RUN bash -c 'if [ ${ostype} == Linux ]; then groupadd -r --gid ${gid} ${USER_NAME}; fi && \
36
+ useradd -r --create-home --shell /bin/bash --uid ${uid} --gid ${gid} ${USER_NAME}' && \
37
+ mkdir -p ${CONDA_DIR} ${WORK_DIR} && chown ${USER_NAME} ${CONDA_DIR} ${WORK_DIR}
38
+ USER ${USER_NAME}
39
+
40
+ # Install conda
41
+ RUN if [ ${trust_hosts} = yes ] ; then WGET_ARGS="--no-check-certificate" ; fi && \
42
+ wget ${WGET_ARGS} -O ~/miniconda.sh \
43
+ https://repo.anaconda.com/miniconda/Miniconda${python_version%%.*}-latest-Linux-x86_64.sh && \
44
+ bash ~/miniconda.sh -f -b -p ${CONDA_DIR} && \
45
+ rm ~/miniconda.sh
46
+
47
+ # Trust conda and pip hosts if needed
48
+ RUN if [ ${trust_hosts} = yes ] ; \
49
+ then \
50
+ pip config set global.trusted-host "pypi.org files.pythonhosted.org download.pytorch.org" && \
51
+ conda config --set ssl_verify False ; \
52
+ fi
53
+
54
+ # Update python version
55
+ RUN conda install python=${python_version}
56
+
57
+ # Move to home directory; and copy the install script
58
+ WORKDIR ${WORK_DIR}
59
+ COPY install.sh ${WORK_DIR}/install.sh
60
+
61
+ # Install python 2/3, PyTorch and Pyro
62
+ RUN cd ${WORK_DIR} && conda update -n base conda -c defaults && bash install.sh
63
+
64
+ # Run Jupyter notebook
65
+ # (Ref: http://jupyter-notebook.readthedocs.io/en/latest/public_server.html#docker-cmd)
66
+ EXPOSE 8888
67
+ CMD ["jupyter", "notebook", "--port=8888", "--no-browser", "--ip=0.0.0.0"]
pyro/source/docker/Makefile ADDED
@@ -0,0 +1,163 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright Contributors to the Pyro project.
2
+ #
3
+ # SPDX-License-Identifier: Apache-2.0
4
+
5
+ .PHONY: help create-host-workspace build build-gpu run run-gpu notebook notebook-gpu
6
+
7
+ DOCKER_FILE=Dockerfile
8
+ BASE_IMG=ubuntu:24.04
9
+ BASE_CUDA_IMG=nvidia/cuda:12.6.3-cudnn-runtime-ubuntu24.04
10
+ DOCKER_CMD=docker
11
+ HOST_WORK_DIR=${HOME}/pyro_docker
12
+ UID=999
13
+ GID=999
14
+ OSTYPE=$(shell uname)
15
+ USER=pyromancer
16
+ DOCKER_WORK_DIR=/home/${USER}/workspace/shared
17
+ pyro_git_url=https://github.com/pyro-ppl/pyro.git
18
+
19
+ # Optional args
20
+ python_version?=3.12
21
+ pytorch_branch?=release
22
+ pyro_branch?=release
23
+ cmd?=bash
24
+ trust_hosts?="no"
25
+
26
+ # Determine name of docker image
27
+ build run notebook: img_prefix=pyro-cpu
28
+ build-gpu run-gpu notebook-gpu: img_prefix=pyro-gpu
29
+ build run lab: img_prefix=pyro-cpu
30
+ build-gpu run-gpu lab-gpu: img_prefix=pyro-gpu
31
+
32
+ ifeq ($(img), )
33
+ IMG_NAME=${img_prefix}-${pyro_branch}-${pytorch_branch}-${python_version}
34
+ else
35
+ IMG_NAME=${img}
36
+ endif
37
+
38
+ help:
39
+ @fgrep -h "##" ${MAKEFILE_LIST} | fgrep -v fgrep | sed -e 's/##//'
40
+
41
+ ##
42
+ ##Available targets:
43
+ ##
44
+
45
+ build: ##
46
+ ## Build a docker image for running Pyro on a CPU.
47
+ ## Args:
48
+ ## python_version: version of python to use. default - python 3.12
49
+ ## pytorch_branch: whether to build PyTorch from conda or from source
50
+ ## (git branch specified by pytorch_branch)
51
+ ## default - latest pytorch version on the torch python package index
52
+ ## pyro_branch: whether to use the released Pyro wheel or a git branch.
53
+ ## default - latest pyro-ppl wheel on pypi
54
+ ## trust_hosts: If set to yes hosts SSL ceritificates will be trusted
55
+ ## (might be needed when running begind a firewall)
56
+ ## default - Verify hosts SSL certificates
57
+ ##
58
+ ${DOCKER_CMD} build -t ${IMG_NAME} \
59
+ --build-arg base_img=${BASE_IMG} \
60
+ --build-arg uid=${UID} \
61
+ --build-arg gid=${GID} \
62
+ --build-arg ostype=${OSTYPE} \
63
+ --build-arg python_version=${python_version} \
64
+ --build-arg pytorch_branch=${pytorch_branch} \
65
+ --build-arg pyro_git_url=${pyro_git_url} \
66
+ --build-arg pyro_branch=${pyro_branch} \
67
+ --build-arg trust_hosts=${trust_hosts} -f ${DOCKER_FILE} .
68
+
69
+ build-gpu: ##
70
+ ## Build a docker image for running Pyro on a GPU.
71
+ ## Args:
72
+ ## python_version: version of python to use. default - python 3.12
73
+ ## pytorch_branch: whether to build PyTorch from conda or from source
74
+ ## (git branch specified by pytorch_branch)
75
+ ## default - latest pytorch version on the torch python package index
76
+ ## pyro_branch: whether to use the released Pyro wheel or a git branch.
77
+ ## default - latest pyro-ppl wheel on pypi
78
+ ## trust_hosts: If set to yes hosts SSL ceritificates will be trusted
79
+ ## (might be needed when running begind a firewall)
80
+ ## default - Verify hosts SSL certificates
81
+ ##
82
+ ${DOCKER_CMD} build -t ${IMG_NAME} \
83
+ --build-arg base_img=${BASE_CUDA_IMG} \
84
+ --build-arg uid=${UID} \
85
+ --build-arg gid=${GID} \
86
+ --build-arg ostype=${OSTYPE} \
87
+ --build-arg pytorch_whl=cu126 \
88
+ --build-arg python_version=${python_version} \
89
+ --build-arg pytorch_branch=${pytorch_branch} \
90
+ --build-arg pyro_git_url=${pyro_git_url} \
91
+ --build-arg pyro_branch=${pyro_branch} \
92
+ --build-arg trust_hosts=${trust_hosts} -f ${DOCKER_FILE} .
93
+
94
+ create-host-workspace: ##
95
+ ## Create shared volume on the host for sharing files with the container.
96
+ ##
97
+ mkdir -p ${HOST_WORK_DIR}
98
+
99
+ run: create-host-workspace
100
+ run: ##
101
+ ## Start a Pyro CPU docker instance, and run the command `cmd`.
102
+ ## Args:
103
+ ## img: use image name given by `img`.
104
+ ## cmd: command invoked on running a docker instance.
105
+ ## default - bash
106
+ ##
107
+ docker run --init -it --user ${USER} \
108
+ -v ${HOST_WORK_DIR}:${DOCKER_WORK_DIR} \
109
+ ${IMG_NAME} ${cmd}
110
+
111
+ run-gpu: create-host-workspace
112
+ run-gpu: ##
113
+ ## Start a Pyro GPU docker instance, and run the command `cmd`.
114
+ ## Args:
115
+ ## img: use image name given by `img`.
116
+ ## cmd: command invoked on running a docker instance.
117
+ ## default - bash
118
+ ##
119
+ docker run --init --gpus=all -it --user ${USER} \
120
+ -v ${HOST_WORK_DIR}:${DOCKER_WORK_DIR} \
121
+ ${IMG_NAME} ${cmd}
122
+
123
+ notebook: create-host-workspace
124
+ notebook: ##
125
+ ## Start a jupyter notebook on the Pyro CPU docker container.
126
+ ## Args:
127
+ ## img: use image name given by `img`.
128
+ ##
129
+ docker run --init -it -p 8888:8888 --user ${USER} \
130
+ -v ${HOST_WORK_DIR}:${DOCKER_WORK_DIR} \
131
+ ${IMG_NAME}
132
+
133
+ notebook-gpu: create-host-workspace
134
+ notebook-gpu: ##
135
+ ## Start a jupyter notebook on the Pyro GPU docker container.
136
+ ## Args:
137
+ ## img: use image name given by `img`.
138
+ ##
139
+ docker run --gpus=all --init -it -p 8888:8888 --user ${USER} \
140
+ -v ${HOST_WORK_DIR}:${DOCKER_WORK_DIR} \
141
+ ${IMG_NAME}
142
+
143
+ notebook: create-host-workspace
144
+ lab: ##
145
+ ## Start jupyterlab on the Pyro CPU docker container.
146
+ ## Args:
147
+ ## img: use image name given by `img`.
148
+ ##
149
+ docker run --init -it -p 8888:8888 --user ${USER} \
150
+ -v ${HOST_WORK_DIR}:${DOCKER_WORK_DIR} \
151
+ ${IMG_NAME} jupyter lab --port=8888 --no-browser --ip=0.0.0.0
152
+
153
+ lab-gpu: create-host-workspace
154
+ lab-gpu: ##
155
+ ## Start jupyterlab on the Pyro GPU docker container.
156
+ ## Args:
157
+ ## img: use image name given by `img`.
158
+ ##
159
+ docker run --gpus=all --init -it -p 8888:8888 --user ${USER} \
160
+ -v ${HOST_WORK_DIR}:${DOCKER_WORK_DIR} \
161
+ ${IMG_NAME} jupyter lab --port=8888 --no-browser --ip=0.0.0.0
162
+
163
+
pyro/source/docker/README.md ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!--
2
+ Copyright Contributors to the Pyro project.
3
+
4
+ SPDX-License-Identifier: Apache-2.0
5
+ -->
6
+
7
+ ## Using Pyro Docker
8
+
9
+ Some utilities for building docker images and running Pyro inside a Docker container are
10
+ included in the `docker` directory. This includes a Dockerfile to build PyTorch and Pyro,
11
+ with some common recipes included in the Makefile.
12
+
13
+ Dependencies for building the docker images:
14
+ - **docker** (>= version 17.05)
15
+ - **nvidia-docker** Refer to the [readme](https://github.com/NVIDIA/nvidia-docker) for
16
+ installation.
17
+
18
+
19
+ ### Building Images
20
+
21
+ The Makefile can be used to build CPU and CUDA images for Pyro and PyTorch. Some common
22
+ options are as follows:
23
+
24
+ 1. **Source:** Uses the latest released package (conda package for PyTorch and PyPi wheel
25
+ for Pyro) by default. However, both Pyro and PyTorch can be built from source from the
26
+ master branch or any other arbitrary branch specified by `pytorch_branch` and
27
+ `pyro_branch`.
28
+ 2. **CPU / CUDA:** `make build` or `make build-gpu` can be used to specify whether the CPU
29
+ or the CUDA image is to be built. For building the CUDA image, *nvidia-docker* is
30
+ required.
31
+ 3. **Python Version:** Python version can be specified via the argument `python_version`.
32
+
33
+ For example, the `make` command to build an image that uses Pyro's `dev` branch over
34
+ PyTorch's `master` branch, using python 3.6 to run on a GPU, is as follows:
35
+
36
+ ```sh
37
+ make build-gpu pyro_branch=dev pytorch_branch=master python_version=3.6
38
+ ```
39
+
40
+ This will build an image named `pyro-gpu-dev-3.6`. To spin up a docker container from this
41
+ image, and run jupyter notebook on this, use the following `make` command:
42
+
43
+ ```sh
44
+ make notebook-gpu img=pyro-gpu-dev-3.6
45
+ ```
46
+
47
+ For help on the `make` commands available, run `make help`.
48
+
49
+ **NOTE (Mac Users)**: Please increase the memory available to the Docker application
50
+ via *Preferences --> Advanced* from 2GB (default) to at least 4GB prior to building the
51
+ docker image (specially for building PyTorch from source).
52
+
53
+ ### Running the Docker container
54
+
55
+ Once the image is built, the docker container can be started via `make run`, or
56
+ `make run-gpu`. By default this starts a *bash* shell. One could start an *ipython*
57
+ shell instead by running `make run cmd=ipython`. The image to be used can be
58
+ specified via the argument `img`.
59
+
60
+ To run a *jupyter notebook* use `make notebook`, or `make notebook-gpu`. This will
61
+ start a jupyter notebook server which can be accessed from the browser using the link
62
+ mentioned in the terminal.
63
+
64
+ Note that there is a shared volume between the container and the host system, with the
65
+ location `$DOCKER_WORK_DIR` on the container, and `$HOST_WORK_DIR` on the local system.
66
+ These variables can be configured in the `Makefile`.
pyro/source/docker/install.sh ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+
3
+ # Copyright Contributors to the Pyro project.
4
+ #
5
+ # SPDX-License-Identifier: Apache-2.0
6
+
7
+ set -xe
8
+
9
+ pip install --upgrade pip
10
+ pip install notebook ipywidgets matplotlib
11
+
12
+ # 1. Install PyTorch
13
+ # Use conda package if pytorch_branch = 'release'.
14
+ # Else, install from source, using git branch `pytorch_branch`
15
+
16
+ pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/${pytorch_whl}
17
+ if [ ${pytorch_branch} != "release" ]
18
+ then
19
+ git clone --recursive https://github.com/pytorch/pytorch.git
20
+ pushd pytorch && git checkout ${pytorch_branch}
21
+ pip uninstall -y torch
22
+ conda install cmake ninja
23
+ pip install -r requirements.txt
24
+ pip install mkl-static mkl-include
25
+ if [ ${pytorch_whl} != "cpu" ]
26
+ then
27
+ conda install -c pytorch magma-cuda${pytorch_whl:2}
28
+ fi
29
+ pip install -e .
30
+ popd
31
+ fi
32
+
33
+
34
+ # 2. Install Pyro
35
+ # Use pypi wheel if pyro_branch = 'release'.
36
+ # Else, install from source, using git branch `pyro_branch`
37
+ if [ ${pyro_branch} = "release" ]
38
+ then
39
+ pip install pyro-ppl
40
+ else
41
+ git clone ${pyro_git_url}
42
+ (cd pyro && git checkout ${pyro_branch} && pip install -e .[dev])
43
+ fi
pyro/source/docs/Makefile ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright Contributors to the Pyro project.
2
+ #
3
+ # SPDX-License-Identifier: Apache-2.0
4
+
5
+ # Minimal makefile for Sphinx documentation
6
+ #
7
+
8
+ # You can set these variables from the command line.
9
+ SPHINXOPTS ?= -E -W
10
+ SPHINXBUILD = python -msphinx
11
+ APIDOC = sphinx-apidoc
12
+ SPHINXPROJ = Pyro
13
+ SOURCEDIR = source
14
+ PROJECTDIR = ../pyro
15
+ BUILDDIR = build
16
+
17
+ # Put it first so that "make" without argument is like "make help".
18
+ help:
19
+ @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
20
+
21
+ .PHONY: help Makefile
22
+
23
+ apidoc:
24
+ $(APIDOC) -o "$(SOURCEDIR)" "$(PROJECTDIR)"
25
+ # Catch-all target: route all unknown targets to Sphinx using the new
26
+ # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
27
+ %: Makefile
28
+ @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
pyro/source/docs/README.md ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!--
2
+ Copyright Contributors to the Pyro project.
3
+
4
+ SPDX-License-Identifier: Apache-2.0
5
+ -->
6
+
7
+ # Documentation #
8
+ Pyro Documentation is supported by [Sphinx](http://www.sphinx-doc.org/en/stable/).
9
+ To build the docs, run from the toplevel directory:
10
+ ```
11
+ make docs
12
+ ```
13
+
14
+ ## Installation ##
15
+ ```
16
+ pip install -r requirements.txt
17
+ ```
18
+
19
+ Note that you will need to install [graphviz](https://www.graphviz.org/) separately.
20
+
21
+ ## Workflow ##
22
+ To change the documentation, update the `*.rst` files in `source`.
23
+
24
+ To build the docstrings, `sphinx-apidoc [options] -o <output_path> <module_path> [exclude_pattern, ...]`
25
+
26
+ To build the html pages, `make html`
pyro/source/docs/requirements.txt ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright Contributors to the Pyro project.
2
+ #
3
+ # SPDX-License-Identifier: Apache-2.0
4
+
5
+ sphinx==4.2.0
6
+ sphinx-rtd-theme==1.0.0
7
+ graphviz>=0.8
8
+ numpy>=1.7
9
+ observations>=0.1.4
10
+ opt_einsum>=2.3.2
11
+ pyro-api>=0.1.1
12
+ tqdm>=4.36
13
+ funsor[torch]
14
+ setuptools
15
+ sphinx_copybutton
pyro/source/docs/source/_static/css/pyro.css ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright Contributors to the Pyro project.
3
+ *
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+
7
+ @import url("theme.css");
8
+
9
+ .wy-side-nav-search {
10
+ background-color: #565656;
11
+ }
12
+
13
+ .wy-side-nav-search a {
14
+ margin: 0
15
+ }
16
+
17
+ .wy-side-nav-search > div.version {
18
+ color: #f26822;
19
+ }
20
+
21
+ .wy-nav-top {
22
+ background: #404040;
23
+ }
24
+
25
+ .wy-menu-vertical li.on a, .wy-menu-vertical li.current>a {
26
+ background: #ccc;
27
+ }
28
+
29
+ .wy-side-nav-search input[type=text] {
30
+ border-color: #313131;
31
+ }
32
+
33
+ .wy-side-nav-search>a img.logo, .wy-side-nav-search .wy-dropdown>a img.logo {
34
+ max-width: 60%;
35
+ }
pyro/source/docs/source/_static/img/favicon/android-icon-144x144.png ADDED
pyro/source/docs/source/_static/img/favicon/android-icon-192x192.png ADDED
pyro/source/docs/source/_static/img/favicon/android-icon-36x36.png ADDED
pyro/source/docs/source/_static/img/favicon/android-icon-48x48.png ADDED
pyro/source/docs/source/_static/img/favicon/android-icon-72x72.png ADDED
pyro/source/docs/source/_static/img/favicon/android-icon-96x96.png ADDED
pyro/source/docs/source/_static/img/favicon/apple-icon-114x114.png ADDED
pyro/source/docs/source/_static/img/favicon/apple-icon-120x120.png ADDED
pyro/source/docs/source/_static/img/favicon/apple-icon-144x144.png ADDED
pyro/source/docs/source/_static/img/favicon/apple-icon-152x152.png ADDED
pyro/source/docs/source/_static/img/favicon/apple-icon-180x180.png ADDED
pyro/source/docs/source/_static/img/favicon/apple-icon-57x57.png ADDED
pyro/source/docs/source/_static/img/favicon/apple-icon-60x60.png ADDED
pyro/source/docs/source/_static/img/favicon/apple-icon-72x72.png ADDED