Skip to content

Commit 7328ff8

Browse files
fix: Address PR review comments on code generation pipeline
- Add GroundTruthNode and MetricsNode imports/exports to pytorch/__init__.py - Add MetricsNode import/export to tensorflow/__init__.py - Add missing `import torch` to config.py.jinja2 template - Fix special node exclusion inconsistency in base_orchestrator.py (add loss, metrics, groundtruth to both _generate_code_specs and _generate_forward_pass filters) - Fix special node exclusion inconsistency in validation.py (add metrics, groundtruth alongside loss) - Remove torch, torchmetrics, tensorflow from backend requirements.txt (these belong only in generated project requirements) - Remove output handle from loss nodes in BlockNode.tsx to match LossNode definition (terminal node with no outputs) - Add GroundTruthNode export to TensorFlow index.ts for consistency with PyTorch Co-authored-by: Aaditya Jindal <RETR0-OS@users.noreply.github.com>
1 parent 720f77a commit 7328ff8

8 files changed

Lines changed: 12 additions & 22 deletions

File tree

project/block_manager/services/codegen/base_orchestrator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ def _generate_code_specs(
129129

130130
processable_nodes = [
131131
n for n in sorted_nodes
132-
if get_node_type(n) not in ('input', 'dataloader', 'output')
132+
if get_node_type(n) not in ('input', 'dataloader', 'output', 'loss', 'metrics', 'groundtruth')
133133
]
134134

135135
for node in processable_nodes:
@@ -193,7 +193,7 @@ def _generate_forward_pass(
193193

194194
processable_nodes = [
195195
n for n in sorted_nodes
196-
if get_node_type(n) not in ('output',)
196+
if get_node_type(n) not in ('output', 'loss', 'metrics', 'groundtruth')
197197
]
198198

199199
for node in processable_nodes:

project/block_manager/services/nodes/pytorch/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
from .concat import ConcatNode
1919
from .add import AddNode
2020
from .loss import LossNode
21+
from .groundtruth import GroundTruthNode
22+
from .metrics import MetricsNode
2123

2224
__all__ = [
2325
'LinearNode',
@@ -38,5 +40,7 @@
3840
'ConcatNode',
3941
'AddNode',
4042
'LossNode',
43+
'GroundTruthNode',
44+
'MetricsNode',
4145
]
4246

project/block_manager/services/nodes/templates/pytorch/files/config.py.jinja2

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ Generated by VisionForge
44
Architecture Complexity: {{ complexity }} ({{ layer_count }} layers)
55
"""
66

7+
import torch
8+
79
# Training Configuration
810
BATCH_SIZE = {{ batch_size }} # Adjusted for {{ complexity.lower() }} network
911
LEARNING_RATE = {{ learning_rate }} # {% if has_attention %}Reduced for attention layers{% else %}Standard for architecture{% endif %}

project/block_manager/services/nodes/tensorflow/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
from .concat import ConcatNode
1919
from .add import AddNode
2020
from .loss import LossNode
21+
from .metrics import MetricsNode
2122

2223
__all__ = [
2324
'LinearNode',
@@ -38,4 +39,5 @@
3839
'ConcatNode',
3940
'AddNode',
4041
'LossNode',
42+
'MetricsNode',
4143
]

project/block_manager/services/validation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ def _validate_shape_compatibility(self):
318318
config = node.get('data', {}).get('config', {})
319319

320320
# Skip nodes that don't have shape requirements
321-
if node_type in ('input', 'output', 'dataloader', 'loss'):
321+
if node_type in ('input', 'output', 'dataloader', 'loss', 'metrics', 'groundtruth'):
322322
continue
323323

324324
incoming = edge_map.get(node_id, [])

project/frontend/src/components/BlockNode.tsx

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -507,22 +507,6 @@ const BlockNode = memo(({ data, selected, id }: BlockNodeProps) => {
507507
})
508508
})()}
509509

510-
{/* Single output handle for loss value */}
511-
<Handle
512-
type="source"
513-
position={Position.Right}
514-
className="w-3 h-3 !bg-red-500 transition-all"
515-
style={{
516-
right: -6,
517-
zIndex: 10
518-
}}
519-
/>
520-
{selected && (
521-
<div
522-
className="absolute right-0 top-1/2 -translate-y-1/2 translate-x-1/2 w-6 h-6 rounded-full border-2 border-red-500 bg-red-500/20 animate-pulse pointer-events-none"
523-
style={{ right: -6 }}
524-
/>
525-
)}
526510
</>
527511
) : data.blockType === 'metrics' ? (
528512
<>

project/frontend/src/lib/nodes/definitions/tensorflow/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
export { InputNode } from '../pytorch/input'
1010
export { DataLoaderNode } from '../pytorch/dataloader'
11+
export { GroundTruthNode } from '../pytorch/groundtruth'
1112
export { OutputNode } from '../pytorch/output'
1213
export { LossNode } from '../pytorch/loss'
1314
export { MetricsNode } from './metrics'

project/requirements.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@ pillow>=11.0.0
2727

2828
# Numerical Computing
2929
numpy>=2.2.0
30-
torch>=2.0.0
31-
torchmetrics>=1.0.0
32-
tensorflow>=2.14.0
3330

3431
# Security & Rate Limiting
3532
django-ratelimit>=4.1.0

0 commit comments

Comments
 (0)