darabos commited on
Commit
e326fb7
·
1 Parent(s): 39c4ace

Address review.

Browse files
examples/Model definition.lynxkite.json CHANGED
@@ -166,7 +166,7 @@
166
  ],
167
  "params": [
168
  {
169
- "default": null,
170
  "name": "type",
171
  "type": {
172
  "enum": [
 
166
  ],
167
  "params": [
168
  {
169
+ "default": "ReLU",
170
  "name": "type",
171
  "type": {
172
  "enum": [
lynxkite-app/web/src/workspace/nodes/NodeWithParams.tsx CHANGED
@@ -10,7 +10,7 @@ export type UpdateOptions = { delay?: number };
10
 
11
  export function NodeWithParams(props: any) {
12
  const reactFlow = useReactFlow();
13
- const metaParams = props.data.meta?.value?.params;
14
  const [collapsed, setCollapsed] = React.useState(props.collapsed);
15
 
16
  function setParam(name: string, newValue: any, opts: UpdateOptions) {
 
10
 
11
  export function NodeWithParams(props: any) {
12
  const reactFlow = useReactFlow();
13
+ const metaParams = props.data.meta?.value?.params ?? [];
14
  const [collapsed, setCollapsed] = React.useState(props.collapsed);
15
 
16
  function setParam(name: string, newValue: any, opts: UpdateOptions) {
lynxkite-core/src/lynxkite/core/executors/one_by_one.py CHANGED
@@ -57,7 +57,7 @@ def get_stages(ws, catalog: ops.Catalog):
57
  inputs.setdefault(edge.target, []).append(edge.source)
58
  node = nodes[edge.target]
59
  op = catalog[node.data.title]
60
- if op.get_input(edge.targetHandle).position in "top or bottom":
61
  batch_inputs.setdefault(edge.target, []).append(edge.source)
62
  stages = []
63
  for bt, bss in batch_inputs.items():
@@ -94,7 +94,7 @@ async def await_if_needed(obj):
94
  return obj
95
 
96
 
97
- async def execute(ws: workspace.Workspace, catalog, cache=None):
98
  nodes = {n.id: n for n in ws.nodes}
99
  contexts = {n.id: Context(node=n) for n in ws.nodes}
100
  edges = {n.id: [] for n in ws.nodes}
@@ -109,7 +109,7 @@ async def execute(ws: workspace.Workspace, catalog, cache=None):
109
  continue
110
  node.publish_error(None)
111
  # Start tasks for nodes that have no non-batch inputs.
112
- if all([i.position in "top or bottom" for i in op.inputs]):
113
  tasks[node.id] = [NO_INPUT]
114
  batch_inputs = {}
115
  # Run the rest until we run out of tasks.
@@ -132,7 +132,7 @@ async def execute(ws: workspace.Workspace, catalog, cache=None):
132
  try:
133
  inputs = []
134
  for i in op.inputs:
135
- if i.position in "top or bottom":
136
  assert (n, i.name) in batch_inputs, f"{i.name} is missing"
137
  inputs.append(batch_inputs[(n, i.name)])
138
  else:
@@ -164,7 +164,7 @@ async def execute(ws: workspace.Workspace, catalog, cache=None):
164
  for edge in edges[node.id]:
165
  t = nodes[edge.target]
166
  op = catalog[t.data.title]
167
- if op.get_input(edge.targetHandle).position in "top or bottom":
168
  batch_inputs.setdefault((edge.target, edge.targetHandle), []).extend(
169
  results
170
  )
 
57
  inputs.setdefault(edge.target, []).append(edge.source)
58
  node = nodes[edge.target]
59
  op = catalog[node.data.title]
60
+ if op.get_input(edge.targetHandle).position.is_vertical():
61
  batch_inputs.setdefault(edge.target, []).append(edge.source)
62
  stages = []
63
  for bt, bss in batch_inputs.items():
 
94
  return obj
95
 
96
 
97
+ async def execute(ws: workspace.Workspace, catalog: ops.Catalog, cache=None):
98
  nodes = {n.id: n for n in ws.nodes}
99
  contexts = {n.id: Context(node=n) for n in ws.nodes}
100
  edges = {n.id: [] for n in ws.nodes}
 
109
  continue
110
  node.publish_error(None)
111
  # Start tasks for nodes that have no non-batch inputs.
112
+ if all([i.position.is_vertical() for i in op.inputs]):
113
  tasks[node.id] = [NO_INPUT]
114
  batch_inputs = {}
115
  # Run the rest until we run out of tasks.
 
132
  try:
133
  inputs = []
134
  for i in op.inputs:
135
+ if i.position.is_vertical():
136
  assert (n, i.name) in batch_inputs, f"{i.name} is missing"
137
  inputs.append(batch_inputs[(n, i.name)])
138
  else:
 
164
  for edge in edges[node.id]:
165
  t = nodes[edge.target]
166
  op = catalog[t.data.title]
167
+ if op.get_input(edge.targetHandle).position.is_vertical():
168
  batch_inputs.setdefault((edge.target, edge.targetHandle), []).extend(
169
  results
170
  )
lynxkite-core/src/lynxkite/core/workspace.py CHANGED
@@ -173,6 +173,7 @@ class Workspace(BaseConfig):
173
  if op:
174
  if data.meta != op:
175
  data.meta = op
 
176
  if hasattr(node, "_crdt"):
177
  # Go through JSON to simplify the types. CRDT can't handle enums.
178
  node._crdt["data"]["meta"] = json.loads(op.model_dump_json())
 
173
  if op:
174
  if data.meta != op:
175
  data.meta = op
176
+ # If the node is connected to a CRDT, update that too.
177
  if hasattr(node, "_crdt"):
178
  # Go through JSON to simplify the types. CRDT can't handle enums.
179
  node._crdt["data"]["meta"] = json.loads(op.model_dump_json())