Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
},
"dependencies": {
"@dao-style/core": "1.7.0",
"@dao-style/extend": "1.7.0",
"@dao-style/extend": "1.7.1-beta.4",
"axios": "^1.5.1",
"clipboard-copy": "^4.0.1",
"core-js": "^3.8.3",
Expand Down
59 changes: 48 additions & 11 deletions src/api/dataset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,29 +227,58 @@ export interface Validate {
}

/**
* Plugin defines a plugin used by a dataset
*/
* Plugin describes the plugin including parameters and whether uses a plugin.
*/
export interface Plugin {
/**
* LoadPlugin describes a Scoring CR whether uses plugin to do evaluation, if true then
* Plugin data will be needed,
*/
loadPlugin: boolean;
name?: string;
parameters?: string;
}

/**
* Task defines a dataset task type
*/
* Task describes the main task that the dataset can do, including Text Generation, Question
* Answering, Translation, Conversational etc.
*/
export interface Task {
name?: string;
name: TaskName;
/**
* SubTask defines a dataset task's subtask e.g. language-modeling of Text Generation,
* open-domain-qa of Question Answering etc. It is corresponding to Task.
*/
subTasks?: SubTask[];
}

export enum TaskName {
QuestionAnswering = 'Question Answering',
Summarization = 'Summarization',
TextClassification = 'Text Classification',
TextGeneration = 'Text Generation',
}

/**
* EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN! NOTE: json tags are required. Any
* new fields you add must have json tags for the fields to be serialized. SubTask defines a
* dataset task's subtask
*/
* SubTask defines a dataset task's subtask
*/
export interface SubTask {
name?: string;
name: SubTaskName;
}

export enum SubTaskName {
ClosedDomainQA = 'closed-domain-qa',
ExtractiveQA = 'extractive-qa',
LanguageModeling = 'language-modeling',
MaskedLanguageModeling = 'masked-language-modeling',
MultiChoiceQA = 'multi-choice-qa',
MultiClassClassification = 'multi-class-classification',
MultiLabelClassification = 'multi-label-classification',
NaturalLanguageInference = 'natural-language-inference',
NewsArticlesSummarization = 'news-articles-summarization',
OpenDomainQA = 'open-domain-qa',
SentimentClassification = 'sentiment-classification',
TopicClassification = 'topic-classification',
}

/**
Expand All @@ -260,7 +289,15 @@ export interface Status {
* INSERT ADDITIONAL STATUS FIELD - define observed state of cluster Important: Run "make"
* to regenerate code after modifying this file
*/
state?: string;
state?: State;
}

/**
* DatasetState is an enum type for the State field
*/
export enum State {
Ready = 'READY',
Unready = 'UNREADY',
}

const apiVersion = 'extension.datatunerx.io/v1beta1';
Expand Down
29 changes: 15 additions & 14 deletions src/api/finetune-job.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Condition, ObjectMeta } from 'kubernetes-types/meta/v1';
/* eslint-disable no-use-before-define */
import { K8sClient } from '@/plugins/axios/client';
import { Toleration } from 'kubernetes-types/core/v1';
import { Spec as FinetuneSpec, State as FinetuneState } from './finetune';
/**
* FinetuneJob is the Schema for the finetunejobs API
Expand Down Expand Up @@ -29,12 +30,12 @@ export interface FinetuneJob {
* FinetuneJobStatus defines the observed state of FinetuneJob
*/
status?: Status;
valid?: boolean
valid?: boolean;
}

/**
* FinetuneJobSpec defines the desired state of FinetuneJob
*/
* FinetuneJobSpec defines the desired state of FinetuneJob
*/
export interface Spec {
/**
* Finetune cr config.
Expand All @@ -51,8 +52,8 @@ export interface Spec {
}

/**
* Finetune cr config.
*/
* Finetune cr config.
*/
export interface Finetune {
/**
* FinetuneSpec defines the desired state of Finetune
Expand All @@ -62,33 +63,33 @@ export interface Finetune {
}

/**
* Score plugin config.
*/
* Score plugin config.
*/
export interface ScoringConfig {
/**
* Name specifies the name of the scoring CR.
*/
name: string;
name?: string;
parameters?: string;
}

/**
* Serve config.
*/
* Serve config.
*/
export interface ServeConfig {
/**
* NodeSelector specifies the node where service will be deployed.
*/
nodeSelector: string;
nodeSelector?: { [key: string]: string };
/**
* Tolerations specifies the tolerations for service.
*/
tolerations?: string;
tolerations?: Toleration[];
}

/**
* FinetuneJobStatus defines the observed state of FinetuneJob
*/
* FinetuneJobStatus defines the observed state of FinetuneJob
*/
export interface Status {
conditions?: Condition[];
finetuneState?: FinetuneState;
Expand Down
12 changes: 10 additions & 2 deletions src/locales/en-US/views/Dataset.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
"en-US": "English",
"create": "Create Dataset",
"update": "Update Dataset",
"deleteConfirm": "Confirm deletion of dataset {datasetToDelete}?",
"delete":{
"header":"Delete Dataset",
"content":"Are you sure you want to delete this dataset: {name}?"
},

"tag": "Tag",
"duplicateTags": "Duplicate Tags",
Expand Down Expand Up @@ -43,5 +46,10 @@
"basicInformation":"Basic Information",
"datasetInfoConfig": "Dataset Information",

"loadDatasetError": "Failed to load dataset information"
"loadDatasetError": "Failed to load dataset information",

"status": {
"ready": "Ready",
"unready": "Not Ready"
}
}
5 changes: 4 additions & 1 deletion src/locales/en-US/views/Hyperparameter.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
{
"create": "Create Hyperparameter",
"update": "Update Hyperparameter",
"deleteConfirm": "Confirm deletion of Hyperparameter Group {hyperparameterToDelete}?",
"delete":{
"header":"Delete Hyperparameter",
"content":"Are you sure to delete the hyperparameter: {name}?"
},

"name": "Name",
"fineTuningType": "Fine-tuning",
Expand Down
12 changes: 10 additions & 2 deletions src/locales/zh-CN/views/Dataset.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
"en-US": "英文",
"create": "创建数据集",
"update": "更新数据集",
"deleteConfirm": "确认删除数据集 {datasetToDelete} 吗?",
"delete":{
"header":"删除数据集",
"content":"确认删除数据集 {name} 吗?"
},

"tag": "标签",
"duplicateTags": "标签重复",
Expand Down Expand Up @@ -43,5 +46,10 @@
"basicInformation":"基本信息",
"datasetInfoConfig": "数据集信息配置",

"loadDatasetError": "加载数据集失败"
"loadDatasetError": "加载数据集失败",

"status": {
"ready": "就绪",
"unready": "未就绪"
}
}
5 changes: 4 additions & 1 deletion src/locales/zh-CN/views/Hyperparameter.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
{
"create": "创建超参组",
"update": "更新超参组",
"deleteConfirm": "确认删除超参组 {hyperparameterToDelete} 吗?",
"delete":{
"header":"删除数据集",
"content":"确认删除超参组 {name} 吗?"
},

"name": "名称",
"fineTuningType": "微调类型",
Expand Down
14 changes: 10 additions & 4 deletions src/views/dataset/DatasetCreate.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
import { useRoute, useRouter } from 'vue-router';
import { useI18n } from 'vue-i18n';
import {
LicenseType, SizeType, LanguageOptions, SubTask, Subset, taskCategories, datasetClient,
LicenseType, SizeType, LanguageOptions, SubTask, Subset, taskCategories, datasetClient, SubTaskName,
} from '@/api/dataset';
import { Plugin, dataPluginClient } from '@/api/plugin';
import { useNamespaceStore } from '@/stores/namespace';
Expand All @@ -23,7 +23,7 @@ import { HttpStatusCode, KubernetesError } from '@/plugins/axios';
import KeyValueForm from '@/components/KeyValueForm.vue';
import { type DatasetForRender, convertDatasetForPost } from '@/api/dataset-for-render';

import { useDataset } from './composition/create';
import { useDataset } from './composition/dataset';

const { t } = useI18n();

Expand Down Expand Up @@ -170,8 +170,10 @@ const { remove: removeFromTags, push: pushToTags, fields: tags } = useFieldArray
const addTag = async () => pushToTags('');
const removeTag = (index: number) => removeFromTags(index);

const { remove: removeFromSubtasks, push: pushToSubtasks, fields: subTasks } = useFieldArray<SubTask>('spec.datasetMetadata.task.subTasks');
const addSubtask = () => pushToSubtasks({ name: '' });
const {
remove: removeFromSubtasks, push: pushToSubtasks, fields: subTasks, replace: replaceSubTask,
} = useFieldArray<SubTask>('spec.datasetMetadata.task.subTasks');
const addSubtask = () => pushToSubtasks({ name: '' as SubTaskName });
const removeSubtask = (index: number) => removeFromSubtasks(index);

const {
Expand All @@ -182,6 +184,10 @@ const handleDeleteRule = (index: number) => removeFromRules(index);

const { value: loadPlugin } = useField<boolean>('spec.datasetMetadata.plugin.loadPlugin');

watch(() => formModel.spec.datasetMetadata.task?.name, () => {
replaceSubTask([]);
});

watch(() => loadPlugin.value, (val) => {
replace(val ? [] : [{ name: 'Default' }]);
});
Expand Down
27 changes: 26 additions & 1 deletion src/views/dataset/DatasetDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { useI18n } from 'vue-i18n';
import { useNamespaceStore } from '@/stores/namespace';
import { Dataset, datasetClient } from '@/api/dataset';
import { nError } from '@/utils/useNoty';
import { useDeleteDataset } from './composition/dataset';

const { t } = useI18n();
const router = useRouter();
Expand Down Expand Up @@ -100,6 +101,18 @@ const onEdit = () => {
},
});
};

const toList = () => {
router.push({
name: 'DatasetList',
});
};

const { onConfirmDelete } = useDeleteDataset(
namespaceStore.namespace,
toList,
);

</script>

<template>
Expand All @@ -125,6 +138,12 @@ const onEdit = () => {
>
{{ t('common.edit') }}
</dao-button>
<dao-button
type="danger"
@click="onConfirmDelete(dataset?.metadata?.name)"
>
{{ t('common.delete') }}
</dao-button>
</template>
</dao-header>

Expand All @@ -140,7 +159,13 @@ const onEdit = () => {
>
<template #kv-tag="{ row }">
<dao-key-value-layout-item :label="row.label">
<dao-hover-card :data="row.value?.split(',')" />
<dao-hover-card
v-if="row.value"
:data="row.value?.split(',')"
/>
<template v-else>
-
</template>
</dao-key-value-layout-item>
</template>
</dao-key-value-layout>
Expand Down
Loading