Portuguese
mamba
mamba-3
ssm
muon
muonclip
qk-clip
adamw
optimizer
nope
hybrid-architecture
activation-checkpointing
3d-vision-language
depth-perception
point-cloud
diffusion
stable-diffusion
mixture-of-experts
kohonen
som-attention
random-forest
deep-neural-network
knowledge-distillation
bidirectional-distillation
engram-memory
multimodal
multi-token-prediction
dpo
rlhf
hh-rlhf
pcgrad
long-context
lra-qvit
engineer-agent
integral-state
cython
jev-classifiers
gumbel-softmax
quantization
riemannian-optimization
stiefel-manifold
cython-kernels
gradient-accumulation
vector-quantization
grayscale-detection
joint-perception
self-regulation
signal-table
abmo
ciar
growing-som
pt-br
KHTST v21 — fonte única do IPC (Rust removido por DRY; layout com _Static_assert compile-time + auditoria import-time); Newton-Schulz com normalização espectral CERTIFICADA (min(sqrt(|A|inf)/1.2, |X|F), janela invariante 1.255 provada, nunca pior que v20, Teos 33.3-33.6); imagem adaptativa (letterbox+LANCZOS+janela saliente+upscale limitado, Teos 33.7-33.10); hot-paths Cython (conv causal fundida com gradiente analítico exato, ganho 2.3-7.6x; top-k parcial do roteador, Teos 33.11-33.13); tabela v17 de 18 sinais FECHADA no treinador com 8 produtores reais (Teo 33.14); A/B/C/D pareado real 48 passos (ganhos 1.10-1.12x, leitura honesta); doc 33 + PLANO/RELATORIO/README; suíte v21 40/40, regressão v1-v20 zero, verificar_tudo 49✓; deprecados removidos
20672ab verified Download src/khtst/ipc/__init__.py from PowerMachine/khtst-multimodal-ptbr: direct link, hf CLI and curl.
- Browser
- Download file 2.46 kB
-
https://huggingface.co/PowerMachine/khtst-multimodal-ptbr/resolve/main/src/khtst/ipc/__init__.py
- Command line
-
hf download hf://PowerMachine/khtst-multimodal-ptbr/src/khtst/ipc/__init__.py
-
curl -L -o __init__.py https://huggingface.co/PowerMachine/khtst-multimodal-ptbr/resolve/main/src/khtst/ipc/__init__.py
2.46 kB
| # -*- coding: utf-8 -*- | |
| """KHTST IPC — comunicação Modelo→Modelo (v18, doc 30 §4; v21 doc 33 §1). | |
| Cython PRIORITÁRIO: `khtst_ipc.KHTSTCanal` (compilado, atomics C11/GCC, | |
| nogil) — fallback puro-Python honesto (`_fallback.KHTSTCanal`) quando o | |
| .so não está compilado. | |
| v21 (doc 33 §1, Teos 33.1/33.2 — requisito de refatoração 1): o crate Rust | |
| foi REMOVIDO (3ª implementação redundante do mesmo ABI — DRY) e o layout | |
| ganhou FONTE ÚNICA (`khtst/ipc/layout.py`) com DUAS camadas de verificação: | |
| 1. compile-time — `_Static_assert`s da struct espelho no .pyx (não | |
| compila se o layout diverge); | |
| 2. import-time — a auditoria abaixo compara o binário com a fonte | |
| única; um .so velho falha com erro explícito em vez de corromper | |
| frames silenciosamente. | |
| Uso mínimo (mesmo processo): | |
| from khtst.ipc import KHTSTCanal | |
| c1 = KHTSTCanal(b"demo", 4 * 1024 * 1024) | |
| c2 = KHTSTCanal.anexar(c1.fd, 4 * 1024 * 1024) | |
| c1.escrever(b"olá"); print(c2.ler()) | |
| Entre processos: `enviar_fd`/`receber_fd` (SCM_RIGHTS) — ver | |
| scripts/21_teste_ipc.py (demo completo servidor×cliente com frames). | |
| """ | |
| from __future__ import annotations | |
| import os | |
| __all__ = ["KHTSTCanal", "MOTOR_IPC", "framing", "layout"] | |
| MOTOR_IPC = "fallback" | |
| try: # Cython prioritário (requisito) | |
| try: | |
| from khtst.ipc import khtst_ipc as _ext # build como pacote | |
| except ImportError: | |
| import khtst_ipc as _ext # build top-level | |
| # v21 Teo 33.2 — auditoria FONTE ÚNICA ↔ binário (fatal no import) | |
| from khtst.ipc import layout as _layout | |
| _layout.auditar_ext(_ext) | |
| KHTSTCanal = _ext.KHTSTCanal | |
| MOTOR_IPC = "cython" | |
| except Exception as e: # pragma: no cover — clone frio | |
| _erro_cython = repr(e) | |
| try: | |
| from khtst.ipc._fallback import KHTSTCanal # noqa: F401 | |
| except Exception: | |
| raise ImportError( | |
| "khtst.ipc: nem o módulo Cython (khtst_ipc.so) nem o fallback " | |
| "estão disponíveis — compile com: python setup.py build_ext " | |
| f"--inplace (erro original: {_erro_cython})") | |
| from khtst.ipc import framing # noqa: E402,F401 | |
| from khtst.ipc import layout # noqa: E402,F401 | |
| # FD exposto p/ o padrão de uso anexar(c1.fd, ...) | |
| try: | |
| KHTSTCanal.fd = property(lambda self: self._fd) | |
| except Exception: # pragma: no cover | |
| pass | |