Skip to content
Snippets Groups Projects
Commit a08203fe authored by deep1401's avatar deep1401
Browse files

Make the dataset tab optional based on checking if there is a dataset config...

Make the dataset tab optional based on checking if there is a dataset config variable needed by the plugin
parent 9b673925
No related branches found
No related tags found
No related merge requests found
......@@ -105,6 +105,11 @@ export default function TrainingModalLoRA({
}
}, [experimentInfo, currentEvalName, pluginId]);
// Function to check if any key in the config contains the word "dataset"
const hasDatasetKey = (config: any) => {
return Object.keys(config).some(key => key.toLowerCase().includes('dataset'));
};
if (!experimentInfo?.id) {
return 'Select an Experiment';
}
......@@ -200,8 +205,8 @@ export default function TrainingModalLoRA({
<TabList>
<Tab>Introduction</Tab>
<Tab>Name</Tab>
<Tab>Dataset</Tab>
<Tab>Plugin Config</Tab>
{hasDatasetKey(config) && <Tab>Dataset</Tab>}
</TabList>
<TabPanel value={0} sx={{ p: 2, overflow: 'auto' }}>
<PluginIntroduction
......@@ -213,6 +218,13 @@ export default function TrainingModalLoRA({
<TrainingModalFirstTab />
</TabPanel>
<TabPanel value={2} sx={{ p: 2, overflow: 'auto' }} keepMounted>
<DynamicPluginForm
experimentInfo={experimentInfo}
plugin={pluginId}
config={config}
/>
</TabPanel>
{hasDatasetKey(config) && (<TabPanel value={3} sx={{ p: 2, overflow: 'auto' }} keepMounted>
<>
<TrainingModalDataTab
datasetsIsLoading={datasetsIsLoading}
......@@ -228,13 +240,7 @@ export default function TrainingModalLoRA({
/>
</>
</TabPanel>
<TabPanel value={3} sx={{ p: 2, overflow: 'auto' }} keepMounted>
<DynamicPluginForm
experimentInfo={experimentInfo}
plugin={pluginId}
config={config}
/>
</TabPanel>
)}
</Tabs>
<Stack spacing={2} direction="row" justifyContent="flex-end">
<Button color="danger" variant="soft" onClick={() => onClose()}>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment