feat(spatial): 近贴合进训练——间隙族内抽 0 或 1-2,族级捷径失效
This commit is contained in:
1 parent
1e862e577a
commit
6f6410554a
4 files changed
+51
-12
No files matched your search
@@ -23,7 +23,8 @@
|
|||||||
"dof.c6",
|
"dof.c6",
|
||||||
"dof.c6r",
|
"dof.c6r",
|
||||||
"dof.c6d",
|
"dof.c6d",
|
||||||
"dof.set"
|
"dof.set",
|
||||||
|
"area.near"
|
||||||
],
|
],
|
||||||
"val_families": [
|
"val_families": [
|
||||||
"area.sup2h",
|
"area.sup2h",
|
||||||
|
|||||||
@@ -23,7 +23,8 @@
|
|||||||
"dof.c6",
|
"dof.c6",
|
||||||
"dof.c6r",
|
"dof.c6r",
|
||||||
"dof.c6d",
|
"dof.c6d",
|
||||||
"dof.set"
|
"dof.set",
|
||||||
|
"area.near"
|
||||||
],
|
],
|
||||||
"val_families": [
|
"val_families": [
|
||||||
"area.sup2h",
|
"area.sup2h",
|
||||||
|
|||||||
@@ -1,12 +1,41 @@
|
|||||||
{
|
{
|
||||||
"seed": 0,
|
"seed": 0,
|
||||||
"model": { "d": 64, "n_layer": 2, "n_head": 4, "dropout": 0.0, "max_entities": 32 },
|
"model": {
|
||||||
|
"d": 64,
|
||||||
|
"n_layer": 2,
|
||||||
|
"n_head": 4,
|
||||||
|
"dropout": 0.0,
|
||||||
|
"max_entities": 32
|
||||||
|
},
|
||||||
"data": {
|
"data": {
|
||||||
"train_families": ["cond.p1", "area.sup2", "dof.c6"],
|
"train_families": [
|
||||||
"val_families": ["cond.p3", "area.sup3", "dof.c6r"],
|
"cond.p1",
|
||||||
"test_families": ["cond.p1h", "cond.p3h", "area.sup2h", "dof.c6h"]
|
"area.sup2",
|
||||||
|
"dof.c6",
|
||||||
|
"area.near"
|
||||||
|
],
|
||||||
|
"val_families": [
|
||||||
|
"cond.p3",
|
||||||
|
"area.sup3",
|
||||||
|
"dof.c6r"
|
||||||
|
],
|
||||||
|
"test_families": [
|
||||||
|
"cond.p1h",
|
||||||
|
"cond.p3h",
|
||||||
|
"area.sup2h",
|
||||||
|
"dof.c6h"
|
||||||
|
],
|
||||||
|
"availability": "declared"
|
||||||
|
},
|
||||||
|
"optim": {
|
||||||
|
"lr": 0.003,
|
||||||
|
"weight_decay": 0.01,
|
||||||
|
"steps": 2,
|
||||||
|
"batch": 16,
|
||||||
|
"log_every": 1
|
||||||
|
},
|
||||||
|
"eval": {
|
||||||
|
"n": 12
|
||||||
},
|
},
|
||||||
"optim": { "lr": 0.003, "weight_decay": 0.01, "steps": 2, "batch": 16, "log_every": 1 },
|
|
||||||
"eval": { "n": 12 },
|
|
||||||
"out_dir": "out_spatial/smoke"
|
"out_dir": "out_spatial/smoke"
|
||||||
}
|
}
|
||||||
+12
-4
@@ -35,6 +35,7 @@ FAMILIES = {
|
|||||||
"area.gap1": {"domain": "stability", "n_blocks": 2, "hidden": 0, "clearance": 1},
|
"area.gap1": {"domain": "stability", "n_blocks": 2, "hidden": 0, "clearance": 1},
|
||||||
"area.gap2": {"domain": "stability", "n_blocks": 2, "hidden": 0, "clearance": 2},
|
"area.gap2": {"domain": "stability", "n_blocks": 2, "hidden": 0, "clearance": 2},
|
||||||
"area.gap4": {"domain": "stability", "n_blocks": 2, "hidden": 0, "clearance": 4},
|
"area.gap4": {"domain": "stability", "n_blocks": 2, "hidden": 0, "clearance": 4},
|
||||||
|
"area.near": {"domain": "stability", "n_blocks": 2, "hidden": 0, "near": 1},
|
||||||
"dof.c6": {"domain": "freedom", "n_cons": 6, "hidden": 0},
|
"dof.c6": {"domain": "freedom", "n_cons": 6, "hidden": 0},
|
||||||
"dof.c6r": {"domain": "freedom", "n_cons": 7, "hidden": 0},
|
"dof.c6r": {"domain": "freedom", "n_cons": 7, "hidden": 0},
|
||||||
"dof.c6h": {"domain": "freedom", "n_cons": 6, "hidden": 1},
|
"dof.c6h": {"domain": "freedom", "n_cons": 6, "hidden": 1},
|
||||||
@@ -150,7 +151,7 @@ def _build_connection(rng, n_paths: int, hidden: int):
|
|||||||
|
|
||||||
|
|
||||||
def _build_stability(rng, n_blocks: int, hidden: int, free: int = 0, notch: int = 0,
|
def _build_stability(rng, n_blocks: int, hidden: int, free: int = 0, notch: int = 0,
|
||||||
clearance: int = 0):
|
clearance: int = 0, near: int = 0):
|
||||||
if free:
|
if free:
|
||||||
# the minimal pair against area.sup2h: here T has exactly one contact and
|
# the minimal pair against area.sup2h: here T has exactly one contact and
|
||||||
# that contact leads to a block which itself hangs in the air. Nothing
|
# that contact leads to a block which itself hangs in the air. Nothing
|
||||||
@@ -181,7 +182,13 @@ def _build_stability(rng, n_blocks: int, hidden: int, free: int = 0, notch: int
|
|||||||
# grid unit is 0.25mm). At 0 the two surfaces touch exactly; at 1 they are
|
# grid unit is 0.25mm). At 0 the two surfaces touch exactly; at 1 they are
|
||||||
# 0.25mm apart, which is the regime real assemblies live in and the regime a
|
# 0.25mm apart, which is the regime real assemblies live in and the regime a
|
||||||
# distance tolerance actually has to decide.
|
# distance tolerance actually has to decide.
|
||||||
cl = int(clearance)
|
# ``near`` draws the clearance inside one family: 0 sometimes, 1-2 units
|
||||||
|
# otherwise. That is the whole point -- with a fixed clearance the family is
|
||||||
|
# single-answer (constant rules score 1.000) and with a per-family fixed
|
||||||
|
# clearance the model can key on the family instead of on contact. Here the
|
||||||
|
# same question, same scene, same edge count differ only in whether the two
|
||||||
|
# faces coincide, so the only thing that can separate them is contact.
|
||||||
|
cl = int(clearance) if not near else int(rng.choice((0, 0, 0, 1, 2)))
|
||||||
ents = [Entity("G", "ground", attrs={"plane": 0}),
|
ents = [Entity("G", "ground", attrs={"plane": 0}),
|
||||||
Entity("P", "block", attrs={"box": [40, 40, 0, 60, 60, 20]}),
|
Entity("P", "block", attrs={"box": [40, 40, 0, 60, 60, 20]}),
|
||||||
Entity("T", "block", attrs={"box": [42 + dx, 42 + dy, 20 + cl,
|
Entity("T", "block", attrs={"box": [42 + dx, 42 + dy, 20 + cl,
|
||||||
@@ -228,7 +235,7 @@ def _build_stability(rng, n_blocks: int, hidden: int, free: int = 0, notch: int
|
|||||||
# that removes P, so "removed something" no longer implies "answer false"
|
# that removes P, so "removed something" no longer implies "answer false"
|
||||||
query = Query(kind="stability", a="T")
|
query = Query(kind="stability", a="T")
|
||||||
r = rng.random()
|
r = rng.random()
|
||||||
if clearance:
|
if clearance or near:
|
||||||
return ents, edges, query, vis_edges, vis_ents, layers, ["front", "iso"], {"length": "mm", "per_unit": 1}
|
return ents, edges, query, vis_edges, vis_ents, layers, ["front", "iso"], {"length": "mm", "per_unit": 1}
|
||||||
if not hidden:
|
if not hidden:
|
||||||
harmless = top or "D"
|
harmless = top or "D"
|
||||||
@@ -300,7 +307,8 @@ _BUILDERS = {
|
|||||||
"connection": lambda rng, spec: _build_connection(rng, spec["n_paths"], spec["hidden"]),
|
"connection": lambda rng, spec: _build_connection(rng, spec["n_paths"], spec["hidden"]),
|
||||||
"stability": lambda rng, spec: _build_stability(rng, spec["n_blocks"], spec["hidden"],
|
"stability": lambda rng, spec: _build_stability(rng, spec["n_blocks"], spec["hidden"],
|
||||||
spec.get("free", 0), spec.get("notch", 0),
|
spec.get("free", 0), spec.get("notch", 0),
|
||||||
spec.get("clearance", 0)),
|
spec.get("clearance", 0),
|
||||||
|
spec.get("near", 0)),
|
||||||
"freedom": lambda rng, spec: _build_freedom(rng, spec["n_cons"], spec["hidden"],
|
"freedom": lambda rng, spec: _build_freedom(rng, spec["n_cons"], spec["hidden"],
|
||||||
spec.get("no_edit", 0), spec.get("notch", 0)),
|
spec.get("no_edit", 0), spec.get("notch", 0)),
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user