Files
giant/giant/model/network.py
T
lars c984d0a19d
CI / Sync project version with tag (hand-pushed tags only) (pull_request) Has been skipped
CI / Publish package to Gitea package registry (pull_request) Has been skipped
CI / Format (ruff format) (pull_request) Successful in 53s
CI / Type check (ty) (pull_request) Successful in 57s
CI / Lint (ruff check) (pull_request) Successful in 41s
CI / Tests (pull_request) Successful in 8m20s
CI / Release (bump, changelog, badges, tag) on merge to master (pull_request) Has been skipped
chore: bump uv.lock and fix ruff 0.16 default-rule lint findings
uv.lock was stale (ty 0.0.50 -> 0.0.78, ruff 0.15 -> 0.16, polars, numpy,
typer, wandb, pytest, and others), all within existing pyproject.toml
bounds. ruff 0.16 widened its default rule selection, taking this repo
from 0 to 274 lint errors under the same config; --fix handled most of
it (import sorting, Optional[X] -> X | None, ...), and the remainder
(unused unpacked variables, dict()-as-literal, subprocess.run without
explicit check=, a couple of intentional broad excepts/naive datetimes)
were fixed or annotated by hand. Also fixes a real type-narrowing gap
ty 0.0.78 caught in test_config_consumed_keys.py's `or`-combined
isinstance check.

torch stays pinned to 2.3.x (deliberate, see CLAUDE.md); pyarrow's <25
ceiling is left as a separate decision.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TMdZFqXXig7i3XkirSUxef
2026-09-04 14:09:29 +02:00

143 lines
3.2 KiB
Python

"""Re-export shim.
`network.py` used to hold every network-related class in one 1742-line file.
It's now split by concern into `giant/model/{layers,encoders,routers,trunks,
history,models,_legacy,builders}.py` (issues.md Issue 8); this module just
re-exports the public surface so every existing `from giant.model.network
import X` call site keeps working unchanged.
"""
from giant.model._legacy import _migrate_legacy_model_config, migrate_legacy_state_dict
from giant.model.builders import build_critics, build_models
from giant.model.encoders import ConditionEncoder
from giant.model.history import (
HISTORY_REGISTRY,
AttentionHistory,
HistoryEncoder,
MarkovHistory,
NoHistory,
_CausalAttnBlock,
build_history,
register_history,
)
from giant.model.layers import (
BLOCK_REGISTRY,
AdaLNResBlock,
ContextAdapter,
FilmResBlock,
ResBlock,
SinusoidalEmbedding,
_make_axis_mlp,
build_block,
build_mlp_head,
register_block,
)
from giant.model.models import (
CriticModel,
Stage1Model,
Stage2Autoregressive,
Stage2OneShot,
StageModel,
resolve_type_n_classes,
stage2_trunk_sec_dim,
stage2_type_dim,
)
from giant.model.objectives import (
OBJECTIVE_REGISTRY,
DdpmObjective,
FlowObjective,
Objective,
WganObjective,
build_objective,
register_objective,
)
from giant.model.routers import (
ROUTER_REGISTRY,
ComposedRouter,
EnergyRouter,
NoneRouter,
PdgRouter,
ProcessRouter,
Router,
_build_router_from_cfg,
_check_router_conditioning_compat,
_parse_composed_axes,
build_composed_router,
build_router,
register_router,
)
from giant.model.trunks import (
TRUNK_REGISTRY,
ExpertTrunk,
LinearTrunk,
RoutedTrunk,
Trunk,
_route_forward,
build_expert_body,
build_trunk,
register_trunk,
)
__all__ = [
"BLOCK_REGISTRY",
"HISTORY_REGISTRY",
"OBJECTIVE_REGISTRY",
"ROUTER_REGISTRY",
"TRUNK_REGISTRY",
"AdaLNResBlock",
"AttentionHistory",
"ComposedRouter",
"ConditionEncoder",
"ContextAdapter",
"CriticModel",
"DdpmObjective",
"EnergyRouter",
"ExpertTrunk",
"FilmResBlock",
"FlowObjective",
"HistoryEncoder",
"LinearTrunk",
"MarkovHistory",
"NoHistory",
"NoneRouter",
"Objective",
"PdgRouter",
"ProcessRouter",
"ResBlock",
"RoutedTrunk",
"Router",
"SinusoidalEmbedding",
"Stage1Model",
"Stage2Autoregressive",
"Stage2OneShot",
"StageModel",
"Trunk",
"WganObjective",
"_CausalAttnBlock",
"_build_router_from_cfg",
"_check_router_conditioning_compat",
"_make_axis_mlp",
"_migrate_legacy_model_config",
"_parse_composed_axes",
"_route_forward",
"build_block",
"build_composed_router",
"build_critics",
"build_expert_body",
"build_history",
"build_mlp_head",
"build_models",
"build_objective",
"build_router",
"build_trunk",
"migrate_legacy_state_dict",
"register_block",
"register_history",
"register_objective",
"register_router",
"register_trunk",
"resolve_type_n_classes",
"stage2_trunk_sec_dim",
"stage2_type_dim",
]