Skip to content

Commit 3458fc3

Browse files
Merge pull request #887 from transformerlab/fix/delete_values
Fixed Error invoking remote method 'setStoreValue': TypeError: Use delete() to clear values
2 parents f803102 + 3d349b7 commit 3458fc3

3 files changed

Lines changed: 73 additions & 35 deletions

File tree

api/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,4 +109,4 @@ cpu = [
109109
"tensorboard==2.18.0",
110110
"tiktoken==0.8.0",
111111
"watchfiles==1.0.4",
112-
]
112+
]

lab-sdk/src/lab/experiment.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,40 @@ def get_all(cls):
100100
if storage.exists(index_file):
101101
with storage.open(index_file, "r", uncached=True) as f:
102102
data = json.load(f)
103+
104+
name = data.get("name")
105+
exp_id = data.get("id")
106+
107+
# If both name and id are missing, skip this experiment
108+
if not name and not exp_id:
109+
print(f"Experiment at {exp_path} missing required 'name' and 'id' fields; skipping")
110+
continue
111+
112+
# If name missing but id present, copy id -> name and persist
113+
if not name and exp_id:
114+
data["name"] = exp_id
115+
try:
116+
with storage.open(index_file, "w") as wf:
117+
json.dump(data, wf, indent=4)
118+
name = exp_id
119+
except Exception:
120+
# If we couldn't persist, skip to avoid inconsistent state
121+
continue
122+
123+
# If id missing but name present, copy name -> id and persist
124+
if not exp_id and name:
125+
data["id"] = name
126+
try:
127+
with storage.open(index_file, "w") as wf:
128+
json.dump(data, wf, indent=4)
129+
exp_id = name
130+
except Exception as e:
131+
print(
132+
f"Failed to write corrected index.json for experiment '{name}' at {index_file} (copied name -> id): {e}"
133+
)
134+
# If we couldn't persist, skip to avoid inconsistent state
135+
continue
136+
103137
experiments.append(data)
104138
except Exception:
105139
pass

src/renderer/components/Experiment/SelectExperimentMenu.tsx

Lines changed: 38 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ export default function SelectExperimentMenu({ models }) {
272272
sx={{
273273
backgroundColor: 'transparent !important',
274274
fontSize: '20px',
275-
color: 'var(--joy-palette-neutral-plainDisabledColor)',
275+
color: 'var(--joy-palette-neutralDisabledColor)',
276276
paddingLeft: 1,
277277
paddingRight: 0,
278278
minHeight: '22px',
@@ -390,43 +390,47 @@ export default function SelectExperimentMenu({ models }) {
390390
>
391391
{isLoading && <MenuItem>Loading...</MenuItem>}
392392
{data &&
393-
data.map((experiment: any) => {
394-
return (
395-
<MenuItem
396-
selected={experimentInfo?.name === experiment.name}
397-
variant={
398-
experimentInfo?.name === experiment.name
399-
? 'soft'
400-
: undefined
401-
}
402-
onClick={createHandleClose(experiment.name)}
403-
key={experiment.id}
404-
sx={{
405-
display: 'flex',
406-
alignItems: 'center',
407-
textOverflow: 'ellipsis',
408-
overflow: 'hidden',
409-
whiteSpace: 'nowrap',
410-
}}
411-
>
412-
<span
413-
style={{
414-
overflow: 'hidden',
393+
data
394+
.filter(
395+
(experiment: any) => experiment?.id && experiment?.name,
396+
) // skip bad rows
397+
.map((experiment: any) => {
398+
return (
399+
<MenuItem
400+
selected={experimentInfo?.id === experiment.id}
401+
variant={
402+
experimentInfo?.id === experiment.id
403+
? 'soft'
404+
: undefined
405+
}
406+
onClick={createHandleClose(experiment.id)}
407+
key={experiment.id}
408+
sx={{
409+
display: 'flex',
410+
alignItems: 'center',
415411
textOverflow: 'ellipsis',
412+
overflow: 'hidden',
416413
whiteSpace: 'nowrap',
417-
flex: 1,
418-
minWidth: 0,
419414
}}
420-
title={experiment.name}
421415
>
422-
{experiment.name}
423-
</span>
424-
{experimentInfo?.name === experiment.name && (
425-
<CheckIcon style={{ marginLeft: 'auto' }} />
426-
)}
427-
</MenuItem>
428-
);
429-
})}
416+
<span
417+
style={{
418+
overflow: 'hidden',
419+
textOverflow: 'ellipsis',
420+
whiteSpace: 'nowrap',
421+
flex: 1,
422+
minWidth: 0,
423+
}}
424+
title={experiment.name}
425+
>
426+
{experiment.name}
427+
</span>
428+
{experimentInfo?.id === experiment.id && (
429+
<CheckIcon style={{ marginLeft: 'auto' }} />
430+
)}
431+
</MenuItem>
432+
);
433+
})}
430434
</Box>
431435
<Divider />
432436
<MenuItem onClick={() => setModalOpen(true)} disabled={isLoading}>

0 commit comments

Comments
 (0)