Browse Source

Merge remote-tracking branch 'origin/V20220830' into res-manage-v2

# Conflicts:
#	templates/repo/modelarts/notebook/show.tmpl
tags/v1.22.9.1^2^2
chenyifan01 3 years ago
parent
commit
b69d18290e
10 changed files with 85 additions and 64 deletions
  1. +1
    -1
      models/cloudbrain.go
  2. +15
    -10
      models/dataset.go
  3. +1
    -1
      modules/cloudbrain/resty.go
  4. +2
    -2
      options/locale/locale_en-US.ini
  5. +4
    -0
      routers/repo/dataset.go
  6. +1
    -1
      templates/repo/datasets/index.tmpl
  7. +7
    -7
      templates/repo/modelarts/notebook/show.tmpl
  8. +27
    -21
      web_src/js/components/dataset/referenceDataset.vue
  9. +23
    -17
      web_src/js/components/dataset/selectDataset.vue
  10. +4
    -4
      web_src/js/features/i18nVue.js

+ 1
- 1
models/cloudbrain.go View File

@@ -1952,7 +1952,7 @@ func GetCloudbrainCountByUserID(userID int64, jobType string) (int, error) {
func GetCloudbrainRunCountByRepoID(repoID int64) (int, error) {
count, err := x.In("status", JobWaiting, JobRunning, ModelArtsCreateQueue, ModelArtsCreating, ModelArtsStarting,
ModelArtsReadyToStart, ModelArtsResizing, ModelArtsStartQueuing, ModelArtsRunning, ModelArtsRestarting, ModelArtsTrainJobInit,
ModelArtsTrainJobImageCreating, ModelArtsTrainJobSubmitTrying, ModelArtsTrainJobWaiting, ModelArtsTrainJobRunning,
ModelArtsTrainJobImageCreating, ModelArtsTrainJobSubmitTrying, ModelArtsTrainJobWaiting, ModelArtsTrainJobRunning, ModelArtsStopping, ModelArtsResizing,
ModelArtsTrainJobScaling, ModelArtsTrainJobCheckInit, ModelArtsTrainJobCheckRunning, ModelArtsTrainJobCheckRunningCompleted).And("repo_id = ?", repoID).Count(new(Cloudbrain))
return int(count), err
}


+ 15
- 10
models/dataset.go View File

@@ -171,16 +171,17 @@ func (datasets DatasetList) loadAttachmentAttributes(opts *SearchDatasetOptions)
}

type SearchDatasetOptions struct {
Keyword string
OwnerID int64
User *User
RepoID int64
IncludePublic bool
RecommendOnly bool
Category string
Task string
License string
DatasetIDs []int64
Keyword string
OwnerID int64
User *User
RepoID int64
IncludePublic bool
RecommendOnly bool
Category string
Task string
License string
DatasetIDs []int64
ExcludeDatasetId int64
ListOptions
SearchOrderBy
IsOwner bool
@@ -240,6 +241,10 @@ func SearchDatasetCondition(opts *SearchDatasetOptions) builder.Cond {
cond = cond.And(builder.Eq{"dataset.repo_id": opts.RepoID})
}

if opts.ExcludeDatasetId > 0 {
cond = cond.And(builder.Neq{"dataset.id": opts.ExcludeDatasetId})
}

if opts.PublicOnly {
cond = cond.And(builder.Eq{"dataset.status": DatasetStatusPublic})
cond = cond.And(builder.Eq{"attachment.is_private": false})


+ 1
- 1
modules/cloudbrain/resty.go View File

@@ -93,7 +93,7 @@ sendjob:
return nil, fmt.Errorf("resty get queues detail failed: %s", err)
}

if jobResult.Code == errInvalidToken && retry < 1 {
if (res.StatusCode() == http.StatusUnauthorized || jobResult.Code == errInvalidToken) && retry < 1 {
retry++
_ = loginCloudbrain()
goto sendjob


+ 2
- 2
options/locale/locale_en-US.ini View File

@@ -924,7 +924,7 @@ dataset_name_tooltips = Please enter letters, numbers, _ and - up to 100 charact
dataset_no_create = No dataset has been created yet
dataset_explain = Dataset: CloudBrain I provides CPU/GPU resources, Cloudbrain II provides Ascend NPU resources, and the data set used for debugging also needs to be uploaded to the corresponding environment;
dataset_instructions_for_use = Instructions for use: You can refer to Openi AI Collaboration Platform
dataset_camp_course = Newcomer Training Camp Course;
dataset_camp_course = OpenI_Learning;
dataset_upload = Upload
dataset_upload_status= Upload Status
dataset_file_name = File Name
@@ -1221,7 +1221,7 @@ model_Evaluation_not_created = Model evaluation has not been created
repo_not_initialized = Code version: You have not initialized the code repository, please <a href="%s"> initialized </a> first ;
debug_task_running_limit =Running time: no more than 4 hours, it will automatically stop if it exceeds 4 hours;
dataset_desc = Dataset: Cloud Brain 1 provides CPU/GPU,Cloud Brain 2 provides Ascend NPU.And dataset also needs to be uploaded to the corresponding environment;
platform_instructions = Instructions for use: You can refer to the <a href="https://git.openi.org.cn/zeizei/OpenI_Learning">Xiaobai training camp </a> course of Openi AI collaboration platform.
platform_instructions = Instructions for use: You can refer to the <a href="https://git.openi.org.cn/zeizei/OpenI_Learning"> OpenI_Learning </a> course of Openi AI collaboration platform.
model_not_exist = Model file: You do not have a model file yet, please generate and <a href="%s/modelmanage/show_model">export the model</a> through the <a href="%s/modelarts/train-job">training task</a> first ;
benchmark_leaderboards = Benchmark leaderboards



+ 4
- 0
routers/repo/dataset.go View File

@@ -529,6 +529,10 @@ func ReferenceDatasetAvailable(ctx *context.Context) {
NeedAttachment: false,
CloudBrainType: models.TypeCloudBrainAll,
}
dataset, _ := models.GetDatasetByRepo(&models.Repository{ID: ctx.Repo.Repository.ID})
if dataset != nil {
opts.ExcludeDatasetId = dataset.ID
}
datasetMultiple(ctx, opts)

}


+ 1
- 1
templates/repo/datasets/index.tmpl View File

@@ -417,7 +417,7 @@
<div class="bgtask-content">
<div class="bgtask-content-txt">{{.i18n.Tr "dataset.dataset_explain"}}</div>
<div class="bgtask-content-txt">{{.i18n.Tr "dataset.dataset_instructions_for_use"}}<a
href="https://git.openi.org.cn/zeizei/OpenI_Learning">{{.i18n.Tr "dataset.dataset_camp_course"}}</a></div>
href="https://git.openi.org.cn/zeizei/OpenI_Learning">&nbsp;{{.i18n.Tr "dataset.dataset_camp_course"}}</a></div>
</div>
</div>
</div>


+ 7
- 7
templates/repo/modelarts/notebook/show.tmpl View File

@@ -350,14 +350,14 @@

<td class="ti-text-form-content">
<div class="text-span text-span-w" id="{{.VersionName}}-mirror">
<span class="ui poping up clipboard" data-position="top center" id="clipboard-btn" style="cursor:pointer"
<span class="ui poping up clipboard" data-position="top center" id="clipboard-btn-image" style="cursor:pointer"
data-clipboard-text="{{.Image}}"
data-success="{{$.i18n.Tr "repo.copy_link_success"}}"
data-success="{{$.i18n.Tr "repo.copy_link_success"}}"
data-error="{{$.i18n.Tr "repo.copy_link_error"}}"
data-content="{{$.i18n.Tr "repo.copy_link"}}"
data-variation="inverted tiny"
>
<span title="{{.Image}}">{{.Image}}</span>
<span title="{{.Image}}">{{.Image}}</span>
</span>
</div>
</td>
@@ -427,7 +427,7 @@
</div>
</div>

</div>
<div style="clear:both">
<table style="border:none" class="ui fixed small stackable table">
@@ -437,11 +437,11 @@
<th style="color: #8a8e99;font-size:12px" class="two wide center aligned">{{$.i18n.Tr "dataset.download_oper"}}</th>
</tr></thead>
<tbody>
{{range $.datasetDownload}}
{{range $.datasetDownload}}
<tr>
<td style="word-wrap: break-word;word-break: break-all;"><a href="{{.RepositoryLink}}" target="_blank">{{.DatasetName}}</a></td>
<td style="word-wrap: break-word;word-break: break-all;">{{.DatasetDownloadLink}}</td>
<td class="center aligned"><a class="ui poping up clipboard" id="clipboard-btn" data-original="{{$.i18n.Tr "repo.copy_link"}}" data-success="{{$.i18n.Tr "repo.copy_link_success"}}" data-error="{{$.i18n.Tr "repo.copy_link_error"}}" data-content="{{$.i18n.Tr "repo.copy_link"}}" data-variation="inverted tiny" data-clipboard-text="{{.DatasetDownloadLink}}">{{$.i18n.Tr "dataset.download_copy"}}</a></td>
<td class="center aligned"><a class="ui poping up clipboard" id="clipboard-btn-dataset" data-original="{{$.i18n.Tr "repo.copy_link"}}" data-success="{{$.i18n.Tr "repo.copy_link_success"}}" data-error="{{$.i18n.Tr "repo.copy_link_error"}}" data-content="{{$.i18n.Tr "repo.copy_link"}}" data-variation="inverted tiny" data-clipboard-text="{{.DatasetDownloadLink}}">{{$.i18n.Tr "dataset.download_copy"}}</a></td>
</tr>
{{end}}
</tbody>
@@ -506,4 +506,4 @@
$('td.ti-text-form-content.spec div').text(specStr);
$('td.ti-text-form-content.resorce_type div').text(getListValueWithKey(ACC_CARD_TYPE, SPEC.AccCardType));
})();
</script>
</script>

+ 27
- 21
web_src/js/components/dataset/referenceDataset.vue View File

@@ -339,19 +339,18 @@
overflow-y: auto;
"
>
<el-checkbox-group v-model="checkList">
<el-checkbox
v-for="(item, index) in selectDatasetArray"
:key="index"
:label="item.ID"
:title="item.Title"
@change="(checked) => changeCheckSelected(checked, item)"
style="display: flex; margin: 0.5rem 0"
><span class="select-data-right">{{
item.Title
}}</span></el-checkbox
>
</el-checkbox-group>
<el-checkbox
v-for="(item, index) in selectDatasetArray"
:key="index"
:label="item.ID"
:title="item.Title"
:value="item.isChecked"
@change="(checked) => changeCheckSelected(checked, item)"
style="display: flex; margin: 0.5rem 0"
><span class="select-data-right">{{
item.Title
}}</span></el-checkbox
>
</div>
<div style="text-align: end">
<el-button
@@ -406,7 +405,11 @@ export default {
methods: {
openDataset() {
this.checkList = this.datasetList.map((item) => {
this.selectDatasetArray.push({ ID: item.ID, Title: item.Title });
this.selectDatasetArray.push({
ID: item.ID,
Title: item.Title,
isChecked: true,
});
return item.ID;
});
this.dialogVisible = true;
@@ -473,7 +476,11 @@ export default {
return;
}
if (checked) {
this.selectDatasetArray.push({ ID: item.ID, Title: item.Title });
this.selectDatasetArray.push({
ID: item.ID,
Title: item.Title,
isChecked: true,
});
} else {
let index = this.selectDatasetArray.findIndex((element) => {
return element.ID === item.ID;
@@ -482,12 +489,11 @@ export default {
}
},
changeCheckSelected(checked, item) {
if (!checked) {
let index = this.selectDatasetArray.findIndex((element) => {
return element.ID === item.ID;
});
this.selectDatasetArray.splice(index, 1);
}
let index = this.selectDatasetArray.findIndex((element) => {
return element.ID === item.ID;
});
this.selectDatasetArray.splice(index, 1);
this.checkList.splice(index, 1);
},
postStar(item, isSigned) {
if (!isSigned) {


+ 23
- 17
web_src/js/components/dataset/selectDataset.vue View File

@@ -11,9 +11,9 @@
v-if="benchmarkNew"
class="label-fix-width"
style="font-weight: normal"
>{{i18n.dataset_label}}</label
>{{ i18n.dataset_label }}</label
>
<label v-else>{{i18n.dataset_label}}</label>
<label v-else>{{ i18n.dataset_label }}</label>
<span
:class="
benchmarkNew === true ? 'dataset-train-span' : 'dataset-debug-span'
@@ -59,7 +59,7 @@
? 'select-dataset-button'
: 'select-dataset-button-color'
"
>{{i18n.dataset_select}}
>{{ i18n.dataset_select }}
</el-button>
<el-dialog
:title="i18n.dataset_select"
@@ -90,7 +90,11 @@
>
<el-tabs v-model="activeName" @tab-click="handleClick">
<!-- 当前项目的数据集 -->
<el-tab-pane :label="i18n.dataset_current_repo" name="first" v-loading="loadingCurrent">
<el-tab-pane
:label="i18n.dataset_current_repo"
name="first"
v-loading="loadingCurrent"
>
<el-row>
<el-tree
:data="currentDatasetList"
@@ -172,13 +176,13 @@
class="zip-loading"
v-if="data.DecompressState === 2"
>
{{i18n.dataset_unziping}}
{{ i18n.dataset_unziping }}
</span>
<span
class="unzip-failed"
v-if="data.DecompressState === 3"
>
{{i18n.dataset_unzip_failed}}
{{ i18n.dataset_unzip_failed }}
</span>
</span>
</span>
@@ -201,7 +205,11 @@
</div>
</el-tab-pane>
<!-- 我上传的数据集 -->
<el-tab-pane :label="i18n.dataset_my_upload" name="second" v-loading="loadingMy">
<el-tab-pane
:label="i18n.dataset_my_upload"
name="second"
v-loading="loadingMy"
>
<el-row>
<el-tree
:data="myDatasetList"
@@ -274,13 +282,13 @@
class="zip-loading"
v-if="data.DecompressState === 2"
>
{{i18n.dataset_unziping}}
{{ i18n.dataset_unziping }}
</span>
<span
class="unzip-failed"
v-if="data.DecompressState === 3"
>
{{i18n.dataset_unzip_failed}}
{{ i18n.dataset_unzip_failed }}
</span>
</span>
</span>
@@ -380,13 +388,13 @@
class="zip-loading"
v-if="data.DecompressState === 2"
>
{{i18n.dataset_unziping}}
{{ i18n.dataset_unziping }}
</span>
<span
class="unzip-failed"
v-if="data.DecompressState === 3"
>
{{i18n.dataset_unzip_failed}}
{{ i18n.dataset_unzip_failed }}
</span>
</span>
</span>
@@ -486,13 +494,13 @@
class="zip-loading"
v-if="data.DecompressState === 2"
>
{{i18n.dataset_unziping}}
{{ i18n.dataset_unziping }}
</span>
<span
class="unzip-failed"
v-if="data.DecompressState === 3"
>
{{i18n.dataset_unzip_failed}}
{{ i18n.dataset_unzip_failed }}
</span>
</span>
</span>
@@ -536,7 +544,7 @@
line-height: 40px;
"
>
{{i18n.dataset_selected}}
{{ i18n.dataset_selected }}
</div>
<div style="flex: 1; margin-top: 1.5rem">
<el-checkbox-group v-model="checkList">
@@ -558,7 +566,7 @@
color: #fff;
border: 1px solid #389e0d;
"
>{{i18n.dataset_ok}}</el-button
>{{ i18n.dataset_ok }}</el-button
>
</div>
</el-col>
@@ -732,7 +740,6 @@ export default {
.then((res) => {
this.loadingCurrent = false;
let data = JSON.parse(res.data.data);
console.log(data);
this.currentDatasetList = this.transformeTreeData(
data,
"currentTree",
@@ -996,7 +1003,6 @@ export default {
location.href.indexOf("train-job") !== -1 ||
location.href.indexOf("inference") !== -1
) {
console.log("this.benchmarkNew");
this.benchmarkNew = true;
}
if (


+ 4
- 4
web_src/js/features/i18nVue.js View File

@@ -142,16 +142,16 @@ export const i18nVue = {
disassociate: "Unlink",
public_dataset: "Public Dataset",
selected_data_file: "Selected DataSets",
sure: "Ok",
sure: "OK",
search_dataset: "Search dataset name/description ...",
citations: "Citations",
downloads: "Downloads",
not_link_dataset: "No datasets have been associated yet",
not_link_dataset: "No datasets have been linked yet",
no_link_dataset_tips1:
"You can display public datasets on the platform here by clicking the New Linked Dataset button.",
"You can display public datasets on the platform here by clicking the Linked Datasets button.",

dataset_instructions_for_use:
"Instructions for use: You can refer to Openi AI Collaboration Platform ",
"Instructions for use: You can refer to OpenI AI Collaboration Platform ",
dataset_camp_course: " Newcomer Training Camp Course",
dataset_link_success: "Linked dataset succeeded!",
dataset_link_failed: "Linked dataset Failed!",


Loading…
Cancel
Save