hytorch 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- hytorch-0.1.0/.github/workflows/ci.yml +29 -0
- hytorch-0.1.0/.github/workflows/publish.yml +35 -0
- hytorch-0.1.0/.gitignore +19 -0
- hytorch-0.1.0/AGENTS.md +131 -0
- hytorch-0.1.0/CHANGELOG.md +16 -0
- hytorch-0.1.0/CONTRIBUTING.md +104 -0
- hytorch-0.1.0/GLOSSARY.md +47 -0
- hytorch-0.1.0/LICENSE +201 -0
- hytorch-0.1.0/PKG-INFO +254 -0
- hytorch-0.1.0/README.md +231 -0
- hytorch-0.1.0/SECURITY.md +27 -0
- hytorch-0.1.0/SPEC.md +266 -0
- hytorch-0.1.0/assets/hytorch-logo-dark.png +0 -0
- hytorch-0.1.0/assets/hytorch-logo-dark.svg +51 -0
- hytorch-0.1.0/assets/hytorch-logo-light.png +0 -0
- hytorch-0.1.0/assets/hytorch-logo-light.svg +51 -0
- hytorch-0.1.0/example/README.md +5 -0
- hytorch-0.1.0/example/terminal_bench/Dockerfile +25 -0
- hytorch-0.1.0/example/terminal_bench/README.md +26 -0
- hytorch-0.1.0/example/terminal_bench/__init__.py +1 -0
- hytorch-0.1.0/example/terminal_bench/benchmark.py +241 -0
- hytorch-0.1.0/example/terminal_bench/train.py +307 -0
- hytorch-0.1.0/hytorch/__init__.py +29 -0
- hytorch-0.1.0/hytorch/_autofeed.py +55 -0
- hytorch-0.1.0/hytorch/_context.py +45 -0
- hytorch-0.1.0/hytorch/_environment.py +166 -0
- hytorch-0.1.0/hytorch/_git.py +355 -0
- hytorch-0.1.0/hytorch/_inference.py +38 -0
- hytorch-0.1.0/hytorch/_random.py +24 -0
- hytorch-0.1.0/hytorch/_scheduler.py +116 -0
- hytorch-0.1.0/hytorch/backward.py +68 -0
- hytorch-0.1.0/hytorch/graph.py +240 -0
- hytorch-0.1.0/hytorch/harness.py +239 -0
- hytorch-0.1.0/hytorch/linear.py +340 -0
- hytorch-0.1.0/hytorch/mn/__init__.py +8 -0
- hytorch-0.1.0/hytorch/mn/init.py +84 -0
- hytorch-0.1.0/hytorch/optim/__init__.py +6 -0
- hytorch-0.1.0/hytorch/optim/dfm.py +432 -0
- hytorch-0.1.0/hytorch/optim/optimizer.py +57 -0
- hytorch-0.1.0/hytorch/parameter.py +344 -0
- hytorch-0.1.0/hytorch/pi_harness.py +868 -0
- hytorch-0.1.0/hytorch/runtime/Dockerfile +11 -0
- hytorch-0.1.0/hytorch/runtime/hytorch-pi.mjs +242 -0
- hytorch-0.1.0/hytorch/runtime/package.json +9 -0
- hytorch-0.1.0/hytorch/space.py +167 -0
- hytorch-0.1.0/pyproject.toml +52 -0
- hytorch-0.1.0/tests/conftest.py +80 -0
- hytorch-0.1.0/tests/test_backward.py +271 -0
- hytorch-0.1.0/tests/test_environment.py +95 -0
- hytorch-0.1.0/tests/test_git.py +121 -0
- hytorch-0.1.0/tests/test_graph.py +213 -0
- hytorch-0.1.0/tests/test_linear.py +223 -0
- hytorch-0.1.0/tests/test_pi.py +333 -0
- hytorch-0.1.0/uv.lock +673 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
push:
|
|
6
|
+
branches: [main]
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
test:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
strategy:
|
|
15
|
+
fail-fast: false
|
|
16
|
+
matrix:
|
|
17
|
+
python-version: ["3.11", "3.12", "3.13"]
|
|
18
|
+
|
|
19
|
+
steps:
|
|
20
|
+
- uses: actions/checkout@v7
|
|
21
|
+
- uses: astral-sh/setup-uv@v9.0.0
|
|
22
|
+
with:
|
|
23
|
+
python-version: ${{ matrix.python-version }}
|
|
24
|
+
enable-cache: true
|
|
25
|
+
- run: uv sync --locked
|
|
26
|
+
- run: uv run ruff check .
|
|
27
|
+
- run: uv run ruff format --check .
|
|
28
|
+
- run: uv run pytest -q
|
|
29
|
+
- run: uv build
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
name: Publish
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
|
|
7
|
+
permissions:
|
|
8
|
+
contents: read
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
build:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
steps:
|
|
14
|
+
- uses: actions/checkout@v7
|
|
15
|
+
- uses: astral-sh/setup-uv@v9.0.0
|
|
16
|
+
- run: uv build
|
|
17
|
+
- uses: actions/upload-artifact@v7.0.1
|
|
18
|
+
with:
|
|
19
|
+
name: python-package-distributions
|
|
20
|
+
path: dist/
|
|
21
|
+
|
|
22
|
+
publish:
|
|
23
|
+
needs: build
|
|
24
|
+
runs-on: ubuntu-latest
|
|
25
|
+
environment:
|
|
26
|
+
name: pypi
|
|
27
|
+
url: https://pypi.org/p/hytorch
|
|
28
|
+
permissions:
|
|
29
|
+
id-token: write
|
|
30
|
+
steps:
|
|
31
|
+
- uses: actions/download-artifact@v8.0.1
|
|
32
|
+
with:
|
|
33
|
+
name: python-package-distributions
|
|
34
|
+
path: dist/
|
|
35
|
+
- uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # v1.14.2
|
hytorch-0.1.0/.gitignore
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
.DS_Store
|
|
2
|
+
*.log
|
|
3
|
+
__pycache__/
|
|
4
|
+
*.py[cod]
|
|
5
|
+
|
|
6
|
+
# Local build output
|
|
7
|
+
/bin/
|
|
8
|
+
/dist/
|
|
9
|
+
|
|
10
|
+
# Local development environments
|
|
11
|
+
/.venv/
|
|
12
|
+
.hytorch.env
|
|
13
|
+
|
|
14
|
+
# Editor-local state
|
|
15
|
+
/.vscode/*.local.json
|
|
16
|
+
|
|
17
|
+
# Runtime model workspace stores
|
|
18
|
+
/hytorch/workspaces/
|
|
19
|
+
/example/terminal_bench/results/
|
hytorch-0.1.0/AGENTS.md
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
# HyTorch Development
|
|
2
|
+
|
|
3
|
+
HyTorch is a Python library, package `hytorch`, for building and training
|
|
4
|
+
agent meta-networks with PyTorch-shaped composition. Values are Git-backed
|
|
5
|
+
statespaces, agents are neurons, directory-backed workspaces are Parameters,
|
|
6
|
+
directional feedback replaces gradients, and workspace mutations become Git
|
|
7
|
+
commits.
|
|
8
|
+
`SPEC.md` is the canonical design.
|
|
9
|
+
|
|
10
|
+
There is no CLI product surface. HyTorch is imported as a library.
|
|
11
|
+
|
|
12
|
+
## Documentation
|
|
13
|
+
|
|
14
|
+
Use standard Markdown that does not require MathJax, KaTeX, or another
|
|
15
|
+
renderer extension. Do not use LaTeX math delimiters such as `\(`, `\)`,
|
|
16
|
+
`\[`, `\]`, `$`, or `$$`. Write equations with regular Markdown and Unicode
|
|
17
|
+
characters, for example: `Yᵢ = Agent(Xᵢ; Wᵢ)`.
|
|
18
|
+
|
|
19
|
+
## PyTorch correspondence
|
|
20
|
+
|
|
21
|
+
Inspect current official PyTorch documentation and source before inventing a
|
|
22
|
+
public API. Match both its syntax and its ownership/composition logic where a
|
|
23
|
+
real text-agent equivalent exists.
|
|
24
|
+
|
|
25
|
+
| PyTorch | HyTorch |
|
|
26
|
+
|---|---|
|
|
27
|
+
| `torch.tensor(...)` | `hytorch.space(...)` |
|
|
28
|
+
| `Tensor` | statespace `Space` |
|
|
29
|
+
| `torch.nn` | `hytorch.mn` |
|
|
30
|
+
| neuron | agent |
|
|
31
|
+
| `nn.Module` | `mn.Module` |
|
|
32
|
+
| `nn.Parameter` | `mn.Parameter` |
|
|
33
|
+
| `nn.Linear` | `mn.Linear` |
|
|
34
|
+
| `torch.nn.init` | `hytorch.mn.init` |
|
|
35
|
+
| `torch.manual_seed` | `hytorch.manual_seed` |
|
|
36
|
+
| gradient `Tensor` | directional feedback |
|
|
37
|
+
| `.grad` | `.feed` |
|
|
38
|
+
| `optimizer.zero_grad()` | `optimizer.zero_feed()` |
|
|
39
|
+
| `torch.optim` | `hytorch.optim` |
|
|
40
|
+
| learning rate | mutation temperature `temp` |
|
|
41
|
+
| applied parameter update | committed Git mutation |
|
|
42
|
+
|
|
43
|
+
`Module.__setattr__` registers Parameters and child Modules. Registration owns
|
|
44
|
+
state; calls in `forward()` dynamically define topology. `model.parameters()`
|
|
45
|
+
is the only normal input to an optimizer.
|
|
46
|
+
|
|
47
|
+
`mn.Linear(in_features, out_features, bias=...)` owns one monolithic `weight`
|
|
48
|
+
workspace per output agent. Its physical shape is `(out_features,)`. Each
|
|
49
|
+
output receives every input statespace, so the logical graph remains dense.
|
|
50
|
+
The `bias` initializes the mutable `AGENTS.md` in each output workspace.
|
|
51
|
+
|
|
52
|
+
## Node state
|
|
53
|
+
|
|
54
|
+
Every executed output agent receives two sibling directory trees:
|
|
55
|
+
|
|
56
|
+
```text
|
|
57
|
+
node/
|
|
58
|
+
statespace/ # activation X becomes Y; writable during forward
|
|
59
|
+
workspace/ # persistent Parameter W; writable only during optimization
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Forward gives every output agent an independent, writable `statespace/.git`
|
|
63
|
+
with one fetched local ref per input. The agent chooses the merge order,
|
|
64
|
+
resolves conflicts, edits the statespace, and commits before it finishes. It
|
|
65
|
+
uses a sparse,
|
|
66
|
+
read-only `workspace/` checkout that contains the global model history.
|
|
67
|
+
`loss.backward()` resumes the session with the permissions reversed. The agent
|
|
68
|
+
commits workspace changes directly on the global candidate lineage and returns
|
|
69
|
+
one directional feedback string per input. `DFM.step()` promotes the completed
|
|
70
|
+
candidate model branch.
|
|
71
|
+
|
|
72
|
+
`mn.Linear.reset_parameters()` delegates to `hytorch.mn.init`, just as
|
|
73
|
+
`torch.nn.Linear` delegates to `torch.nn.init`. Each workspace starts with an
|
|
74
|
+
`AGENTS.md` that contains seeded, randomly sampled, general phrases from
|
|
75
|
+
`mn.init.DEFAULT_PRIORS`. It can later contain arbitrary code, tools, examples,
|
|
76
|
+
and data.
|
|
77
|
+
|
|
78
|
+
Forward returns the complete committed statespace, never a special answer file.
|
|
79
|
+
Do not inject Space contents into the agent prompt. Mount complete directory
|
|
80
|
+
trees. `zero_feed()` clears accumulated feedback and discards an unpromoted
|
|
81
|
+
candidate branch. It never deletes canonical Git history.
|
|
82
|
+
|
|
83
|
+
## Git semantics
|
|
84
|
+
|
|
85
|
+
Each Space owns its statespace repository and forward history. The private,
|
|
86
|
+
global model workspace store records initialization and optimizer generations.
|
|
87
|
+
Feedback is transient text.
|
|
88
|
+
Workspace diffs are concrete mutations. DFM is evolutionary: it advances to
|
|
89
|
+
every valid child mutation and does not roll back because one immediate result
|
|
90
|
+
is worse.
|
|
91
|
+
|
|
92
|
+
Backward runs dependency-ready nodes with distinct workspace paths in
|
|
93
|
+
parallel. Each node commits against one global candidate revision. HyTorch
|
|
94
|
+
merges these commits into the global model history. Nodes that share a
|
|
95
|
+
workspace path run in sequence.
|
|
96
|
+
|
|
97
|
+
## Harnesses
|
|
98
|
+
|
|
99
|
+
`hytorch.harness.Harness` is the execution base class. Built-ins are
|
|
100
|
+
`hytorch.harness.pi`, `codex`, and `claude_code`; only Pi executes in v0. Pi
|
|
101
|
+
uses OpenAI through the operator's Codex login or `OPENAI_API_KEY`, with
|
|
102
|
+
`gpt-5.6-terra` as the default model.
|
|
103
|
+
|
|
104
|
+
One executed graph uses one harness. `model.to(harness)` moves the complete
|
|
105
|
+
model before a new forward pass. Docker remains external deployment
|
|
106
|
+
configuration. HyTorch uses the standard active Docker context and accepts
|
|
107
|
+
`HYTORCH_PI_IMAGE` as an image override. Agent variables come from
|
|
108
|
+
`.hytorch.env`, the global HyTorch secrets file, or `HYTORCH_ENV_FILE`. Never
|
|
109
|
+
load the ordinary project `.env` automatically.
|
|
110
|
+
|
|
111
|
+
## Layout
|
|
112
|
+
|
|
113
|
+
- `hytorch/mn/` — meta-network namespace and initialization functions.
|
|
114
|
+
- `hytorch/graph.py` — Module registration and dynamic execution boundary.
|
|
115
|
+
- `hytorch/parameter.py` — directory-backed workspace Parameters and their Git store.
|
|
116
|
+
- `hytorch/linear.py` — dense parallel agent layer.
|
|
117
|
+
- `hytorch/backward.py` — Loss and feed-Space propagation.
|
|
118
|
+
- `hytorch/optim/` — Optimizer base and DFM.
|
|
119
|
+
- `hytorch/space.py` — Space and lowercase `space` factory.
|
|
120
|
+
- `hytorch/runtime/` — Dockerized Pi runtime.
|
|
121
|
+
- `example/` — Terminal-Bench training and evaluation example.
|
|
122
|
+
- `tests/` — offline unit tests plus an opt-in real Pi integration test.
|
|
123
|
+
|
|
124
|
+
## Commands
|
|
125
|
+
|
|
126
|
+
```sh
|
|
127
|
+
uv sync
|
|
128
|
+
uv run pytest
|
|
129
|
+
HYTORCH_PI_TEST=1 uv run pytest tests/test_pi.py -v -s
|
|
130
|
+
uv run python -m example.terminal_bench.train --epochs 2
|
|
131
|
+
```
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to HyTorch will be recorded in this file.
|
|
4
|
+
|
|
5
|
+
The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|
6
|
+
HyTorch uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [0.1.0] - 2026-08-05
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- Initial Python library for Git-backed agent meta-networks.
|
|
13
|
+
- PyTorch-shaped `Space`, `Module`, `Parameter`, `Linear`, `Loss`, and `DFM`
|
|
14
|
+
APIs.
|
|
15
|
+
- Dockerized Pi harness with local and remote Docker context support.
|
|
16
|
+
- Offline unit tests and an opt-in real Pi integration test.
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# Contributing to HyTorch
|
|
2
|
+
|
|
3
|
+
HyTorch is an early-stage research library. Contributions that make its core
|
|
4
|
+
model smaller, clearer, safer, or easier to test are welcome.
|
|
5
|
+
|
|
6
|
+
## Before you start
|
|
7
|
+
|
|
8
|
+
Read [SPEC.md](SPEC.md). It defines the required behavior. Open an issue before
|
|
9
|
+
you make a large API or architecture change. This helps maintain one coherent
|
|
10
|
+
PyTorch-shaped design.
|
|
11
|
+
|
|
12
|
+
HyTorch follows PyTorch syntax and ownership rules when a direct text-agent
|
|
13
|
+
equivalent exists. Link to the relevant current PyTorch documentation or source
|
|
14
|
+
when you propose a new public API.
|
|
15
|
+
|
|
16
|
+
## Development setup
|
|
17
|
+
|
|
18
|
+
Install [uv](https://docs.astral.sh/uv/), clone the repository, and run:
|
|
19
|
+
|
|
20
|
+
```sh
|
|
21
|
+
uv sync
|
|
22
|
+
uv run pytest
|
|
23
|
+
uv run ruff check .
|
|
24
|
+
uv run ruff format --check .
|
|
25
|
+
uv build
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
The default test suite is offline. It does not call an agent provider.
|
|
29
|
+
|
|
30
|
+
## Real Pi integration test
|
|
31
|
+
|
|
32
|
+
The real Pi test uses Docker and can consume paid model tokens. Run it only
|
|
33
|
+
when you intend to make an external model call:
|
|
34
|
+
|
|
35
|
+
```sh
|
|
36
|
+
HYTORCH_PI_TEST=1 uv run pytest tests/test_pi.py -v -s
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Pi uses the operator's Codex login by default. To use an OpenAI API key, export
|
|
40
|
+
`OPENAI_API_KEY` and set `HYTORCH_PI_PROVIDER=openai`.
|
|
41
|
+
|
|
42
|
+
## Pull requests
|
|
43
|
+
|
|
44
|
+
Keep each pull request focused. Add tests for behavior changes. Update
|
|
45
|
+
`README.md`, `SPEC.md`, and `GLOSSARY.md` when a public concept changes. Do not
|
|
46
|
+
commit credentials, `.hytorch.env`, generated model workspaces, or agent
|
|
47
|
+
session data.
|
|
48
|
+
|
|
49
|
+
Use short commit subjects in the imperative form. Explain design decisions and
|
|
50
|
+
test results in the pull request description.
|
|
51
|
+
|
|
52
|
+
## Release process
|
|
53
|
+
|
|
54
|
+
HyTorch publishes to PyPI through GitHub Trusted Publishing. A push to `main`
|
|
55
|
+
runs CI but does not publish a package. Publishing starts only when a maintainer
|
|
56
|
+
publishes a GitHub Release.
|
|
57
|
+
|
|
58
|
+
For the first release, configure a pending publisher in the PyPI account:
|
|
59
|
+
|
|
60
|
+
- Project name: `hytorch`
|
|
61
|
+
- Owner: `safranchik`
|
|
62
|
+
- Repository: `hytorch`
|
|
63
|
+
- Workflow: `publish.yml`
|
|
64
|
+
- Environment: `pypi`
|
|
65
|
+
|
|
66
|
+
For each release:
|
|
67
|
+
|
|
68
|
+
1. Update the version in `pyproject.toml` and `hytorch/__init__.py`.
|
|
69
|
+
2. Add the dated release entry to `CHANGELOG.md`.
|
|
70
|
+
3. Run the complete release checks:
|
|
71
|
+
|
|
72
|
+
```sh
|
|
73
|
+
uv lock --check
|
|
74
|
+
uv run ruff check .
|
|
75
|
+
uv run ruff format --check .
|
|
76
|
+
uv run pytest -q
|
|
77
|
+
uv build
|
|
78
|
+
uvx --from twine twine check dist/*
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
4. Push the release commit to `main` and wait for all CI jobs to pass.
|
|
82
|
+
5. Create and push an annotated version tag:
|
|
83
|
+
|
|
84
|
+
```sh
|
|
85
|
+
git tag -a v0.1.0 -m "HyTorch 0.1.0"
|
|
86
|
+
git push origin v0.1.0
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
6. Publish the matching GitHub Release:
|
|
90
|
+
|
|
91
|
+
```sh
|
|
92
|
+
gh release create v0.1.0 \
|
|
93
|
+
--title "HyTorch 0.1.0" \
|
|
94
|
+
--generate-notes
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
The `Publish` workflow builds the source distribution and wheel in an
|
|
98
|
+
unprivileged job. A separate job obtains a short-lived PyPI credential through
|
|
99
|
+
OpenID Connect and uploads the artifacts. The workflow stores no PyPI token.
|
|
100
|
+
|
|
101
|
+
After publication, confirm that the version appears on PyPI and install it in a
|
|
102
|
+
clean environment. PyPI release files are immutable. If an uploaded release is
|
|
103
|
+
wrong, fix the problem and publish a new version. Do not replace an existing
|
|
104
|
+
version or move its Git tag.
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# HyTorch Glossary
|
|
2
|
+
|
|
3
|
+
| PyTorch | HyTorch | Meaning |
|
|
4
|
+
|---|---|---|
|
|
5
|
+
| `torch` | `hytorch` | Top-level package |
|
|
6
|
+
| `torch.tensor(data, ...)` | `hytorch.space(data, ...)` | Construct a runtime value |
|
|
7
|
+
| `Tensor` | `Space` | Git-backed statespace value |
|
|
8
|
+
| feature width | `SpaceBatch` length | Ordered number of Spaces between layers |
|
|
9
|
+
| `dtype` | `mtype` | Numeric representation versus agent model type |
|
|
10
|
+
| `device` | `harness` | CPU/CUDA versus agent runtime placement |
|
|
11
|
+
| `requires_grad` | `requires_feed` | Whether an activation retains backward provenance |
|
|
12
|
+
| `torch.nn` | `hytorch.mn` | Neural-network versus meta-network namespace |
|
|
13
|
+
| neuron | agent | One output computation unit |
|
|
14
|
+
| `nn.Module` | `mn.Module` | Registered owner with dynamic `forward()` topology |
|
|
15
|
+
| `nn.Parameter` | `mn.Parameter` | Registered trainable workspace |
|
|
16
|
+
| `model.parameters()` | `model.parameters()` | Iterator passed to an optimizer |
|
|
17
|
+
| `nn.Linear(m, n)` | `mn.Linear(m, n)` | Dense mapping from `m` inputs to `n` agents |
|
|
18
|
+
| `Linear.weight` | `Linear.weight` | Shape `(out_features,)`; one workspace per agent |
|
|
19
|
+
| `Linear.bias` | workspace `AGENTS.md` initializer | Initial mutable direction for each output agent |
|
|
20
|
+
| parameter value | workspace directory | Persistent instructions, code, tools, examples, and data |
|
|
21
|
+
| `torch.nn.init` | `hytorch.mn.init` | In-place workspace initialization |
|
|
22
|
+
| `torch.manual_seed` | `hytorch.manual_seed` | Seed workspace prior initialization |
|
|
23
|
+
| autograd tape | retained execution graph | Dynamic forward provenance and saved sessions |
|
|
24
|
+
| gradient direction | feedback string | Imperative direction for behavior change |
|
|
25
|
+
| `.grad` | `.feed` | Accumulated downstream directions for one workspace |
|
|
26
|
+
| loss tensor | `Loss` | Output Space plus terminal directional feedback |
|
|
27
|
+
| `loss.backward()` | `loss.backward()` | Update candidates and propagate per-input feedback |
|
|
28
|
+
| `optimizer.zero_grad()` | `optimizer.zero_feed()` | Clear feedback and discard an unpromoted candidate |
|
|
29
|
+
| `torch.optim.Optimizer` | `hytorch.optim.Optimizer` | Own Parameters and update transaction state |
|
|
30
|
+
| `torch.optim.SGD` | `hytorch.optim.DFM` | Gradient descent versus directional feedback mutation |
|
|
31
|
+
| `optimizer.step()` | `optimizer.step()` | Promote the completed candidate model branch |
|
|
32
|
+
| learning rate `lr` | mutation temperature `temp` | Semantic update scale and sampling temperature |
|
|
33
|
+
| optimizer budget | `max_tokens` | Backward agent output-token limit |
|
|
34
|
+
| parameter delta | candidate workspace mutation | Proposed change made during backward |
|
|
35
|
+
| updated parameter storage | promoted global Git commit | Canonical model generation after `step()` |
|
|
36
|
+
| saved forward activations | statespace commit and harness session | Context resumed during backward |
|
|
37
|
+
| `state_dict()` | model workspace Git repository | Serialization target; API not yet implemented |
|
|
38
|
+
|
|
39
|
+
The canonical training form is:
|
|
40
|
+
|
|
41
|
+
```python
|
|
42
|
+
optimizer.zero_feed()
|
|
43
|
+
output = model(input)
|
|
44
|
+
loss = loss_fn(output, target)
|
|
45
|
+
loss.backward()
|
|
46
|
+
optimizer.step()
|
|
47
|
+
```
|
hytorch-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
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,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 HyTorch contributors
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|