import React, { useState } from 'react'; import { Card, CardContent, CardHeader } from '@/components/ui/card'; import { Input } from '@/components/ui/input'; import { NumberInput } from '@/components/ui/number-input'; import { Label } from '@/components/ui/label'; import { Switch } from '@/components/ui/switch'; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from '@/components/ui/select'; import { Separator } from '@/components/ui/separator'; import { ChevronDown, ChevronRight } from 'lucide-react'; import { ConfigComponentProps } from '../types'; const SectionHeading: React.FC<{ children: React.ReactNode }> = ({ children }) => (

{children}

); const AdvancedCard: React.FC = ({ config, updateConfig }) => { const [expanded, setExpanded] = useState(false); return ( setExpanded((v) => !v)} onKeyDown={(e) => { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); setExpanded((v) => !v); } }} className="cursor-pointer select-none flex flex-row items-center justify-between" > Advanced {expanded ? ( ) : ( )} {expanded ? 'Hide' : 'Show'} {expanded && ( {/* Policy */}
Policy
updateConfig('policy_use_amp', checked)} />
{/* Training */}
Training
updateConfig('seed', v)} className="bg-slate-900 border-slate-600 text-white rounded-lg" />
{ if (v !== undefined) updateConfig('num_workers', v); }} className="bg-slate-900 border-slate-600 text-white rounded-lg" />
{/* Optimizer */}
Optimizer
updateConfig('optimizer_lr', v)} placeholder="Use policy default" className="bg-slate-900 border-slate-600 text-white rounded-lg" />
updateConfig('optimizer_weight_decay', v)} placeholder="Use policy default" className="bg-slate-900 border-slate-600 text-white rounded-lg" />
updateConfig('optimizer_grad_clip_norm', v)} placeholder="Use policy default" className="bg-slate-900 border-slate-600 text-white rounded-lg" />
{/* Logging & Checkpointing */}
Logging & Checkpointing
{ if (v !== undefined) updateConfig('log_freq', v); }} className="bg-slate-900 border-slate-600 text-white rounded-lg" />
{ if (v !== undefined) updateConfig('save_freq', v); }} className="bg-slate-900 border-slate-600 text-white rounded-lg" />
updateConfig('save_checkpoint', checked)} />
updateConfig('resume', checked)} />
{config.wandb_enable && ( <>
Weights & Biases
updateConfig('wandb_entity', e.target.value || undefined) } placeholder="your-username" className="bg-slate-900 border-slate-600 text-white rounded-lg" />
updateConfig('wandb_notes', e.target.value || undefined) } placeholder="Training run notes..." className="bg-slate-900 border-slate-600 text-white rounded-lg" />
updateConfig('wandb_disable_artifact', checked) } />
)} {!config.wandb_enable && } {/* Misc */}
Misc
updateConfig('use_policy_training_preset', checked) } />
)}
); }; export default AdvancedCard;