Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
18c420d56a | ||
|
|
aa79bc02fb |
+1
-1
Submodule custom_models updated: 87c64278ba...cda6cfd34e
@@ -15,4 +15,4 @@ dependencies:
|
|||||||
# copies env yamls into .snakemake/conda/, where relative paths
|
# copies env yamls into .snakemake/conda/, where relative paths
|
||||||
# break. Bump the ref together with the `custom_models` submodule
|
# break. Bump the ref together with the `custom_models` submodule
|
||||||
# pointer (git submodule update --remote custom_models).
|
# pointer (git submodule update --remote custom_models).
|
||||||
- git+ssh://git@git.tk-ai.eu/Tom/eDNA_Stream_E01_custom_models.git@87c6427
|
- git+ssh://git@git.tk-ai.eu/Tom/eDNA_Stream_E01_custom_models.git@cda6cfd
|
||||||
|
|||||||
@@ -14,4 +14,4 @@ dependencies:
|
|||||||
# copies env yamls into .snakemake/conda/, where relative paths
|
# copies env yamls into .snakemake/conda/, where relative paths
|
||||||
# break. Bump the ref together with the `custom_models` submodule
|
# break. Bump the ref together with the `custom_models` submodule
|
||||||
# pointer (git submodule update --remote custom_models).
|
# pointer (git submodule update --remote custom_models).
|
||||||
- git+ssh://git@git.tk-ai.eu/Tom/eDNA_Stream_E01_custom_models.git@87c6427
|
- git+ssh://git@git.tk-ai.eu/Tom/eDNA_Stream_E01_custom_models.git@cda6cfd
|
||||||
|
|||||||
@@ -123,6 +123,31 @@ def train_run_id(w):
|
|||||||
return f"{w.arch}_{fmt_budget(w.budget)}_s{w.stride}_g{n}{spec['suffix']}"
|
return f"{w.arch}_{fmt_budget(w.budget)}_s{w.stride}_g{n}{spec['suffix']}"
|
||||||
|
|
||||||
|
|
||||||
|
# Effective optimiser batch stays the spec's 256; --grad-accum splits it into
|
||||||
|
# micro-batches that fit the 16 GB RTX 4060 Ti. Values from measured bf16
|
||||||
|
# fwd+bwd peaks (2026-11-04, this machine): peak(32) per point scaled with a
|
||||||
|
# 1.3 safety factor to keep every run under ~8 GiB. Unknown combinations fall
|
||||||
|
# back to 32 micro-steps of 8 (safe for the largest lattice shapes).
|
||||||
|
GRAD_ACCUM = {
|
||||||
|
("cnn", "1000000", "4"): 4,
|
||||||
|
("cnn", "1000000", "8"): 1,
|
||||||
|
("cnn", "5000000", "4"): 8,
|
||||||
|
("cnn", "5000000", "8"): 4,
|
||||||
|
("cnn", "20000000", "4"): 16,
|
||||||
|
("cnn", "20000000", "8"): 8,
|
||||||
|
("linatt", "1000000", "4"): 4,
|
||||||
|
("linatt", "1000000", "8"): 1,
|
||||||
|
("linatt", "5000000", "4"): 16,
|
||||||
|
("linatt", "5000000", "8"): 8,
|
||||||
|
("linatt", "20000000", "4"): 32,
|
||||||
|
("linatt", "20000000", "8"): 16,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def train_grad_accum(w):
|
||||||
|
return GRAD_ACCUM.get((str(w.arch), str(w.budget), str(w.stride)), 32)
|
||||||
|
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
# labels + signal stores
|
# labels + signal stores
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
@@ -205,6 +230,10 @@ rule build_store_windows_ablation:
|
|||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
# training (Stage-A ladder, control, Stage-B variants)
|
# training (Stage-A ladder, control, Stage-B variants)
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
# TORCH_DISABLE_NATIVE_JIT=1: torch 2.13 dispatches some matmul/einsum
|
||||||
|
# backwards to Triton-compiled native ops that cannot build in this conda env
|
||||||
|
# (no CUDA headers) -> fall back to cuBLAS. expandable_segments fights
|
||||||
|
# fragmentation on the 16 GB card.
|
||||||
rule train_probe:
|
rule train_probe:
|
||||||
input:
|
input:
|
||||||
store=lambda w: train_spec(w)["store"],
|
store=lambda w: train_spec(w)["store"],
|
||||||
@@ -220,17 +249,20 @@ rule train_probe:
|
|||||||
stage=lambda w: train_spec(w)["stage"],
|
stage=lambda w: train_spec(w)["stage"],
|
||||||
flags=lambda w: train_spec(w)["flags"],
|
flags=lambda w: train_spec(w)["flags"],
|
||||||
genera_flag=lambda w: train_spec(w)["genera_flag"],
|
genera_flag=lambda w: train_spec(w)["genera_flag"],
|
||||||
|
grad_accum=train_grad_accum,
|
||||||
threads: 8
|
threads: 8
|
||||||
resources:
|
resources:
|
||||||
gpu=1
|
gpu=1
|
||||||
conda: config["torch_env"]
|
conda: config["torch_env"]
|
||||||
shell:
|
shell:
|
||||||
"""
|
"""
|
||||||
|
TORCH_DISABLE_NATIVE_JIT=1 PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True \
|
||||||
python -m custom_models train \
|
python -m custom_models train \
|
||||||
--arch {wildcards.arch} \
|
--arch {wildcards.arch} \
|
||||||
--budget {wildcards.budget} \
|
--budget {wildcards.budget} \
|
||||||
--stride {wildcards.stride} \
|
--stride {wildcards.stride} \
|
||||||
--budget-tol {config[budget_tolerance]} \
|
--budget-tol {config[budget_tolerance]} \
|
||||||
|
--grad-accum {params.grad_accum} \
|
||||||
{params.flags} {params.genera_flag} \
|
{params.flags} {params.genera_flag} \
|
||||||
--store {input.store} \
|
--store {input.store} \
|
||||||
--out-dir {params.run_dir} \
|
--out-dir {params.run_dir} \
|
||||||
@@ -257,6 +289,7 @@ rule test_probe:
|
|||||||
conda: config["torch_env"]
|
conda: config["torch_env"]
|
||||||
shell:
|
shell:
|
||||||
"""
|
"""
|
||||||
|
TORCH_DISABLE_NATIVE_JIT=1 PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True \
|
||||||
python -m custom_models test \
|
python -m custom_models test \
|
||||||
--run-dir {params.run_dir} \
|
--run-dir {params.run_dir} \
|
||||||
--trap-store {input.trap_store} \
|
--trap-store {input.trap_store} \
|
||||||
|
|||||||
Reference in New Issue
Block a user