Skip to content

Commit 098f7ec

Browse files
authored
update demo to latest (#970)
* chore: update demo * chore: update demo * bump fe to 2.2.0 * bump fe to 2.2.0-1 * fix: docker runtime error
1 parent 0151d78 commit 098f7ec

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+1237
-12118
lines changed

Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ FROM python:3-alpine
1212
WORKDIR /home/visualdl
1313
COPY --from=builder /home/visualdl/dist/* dist/
1414

15-
RUN apk add --no-cache jpeg-dev && \
15+
RUN apk add --no-cache jpeg-dev libstdc++ && \
1616
apk add --no-cache --virtual .build-deps build-base linux-headers zlib-dev && \
1717
pip install --disable-pip-version-check --find-links=dist visualdl && \
1818
apk del --no-network .build-deps && \

frontend/lerna.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"packages": [
33
"packages/*"
44
],
5-
"version": "2.1.5",
5+
"version": "2.2.0-1",
66
"npmClient": "yarn",
77
"useWorkspaces": true,
88
"command": {

frontend/packages/cli/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@visualdl/cli",
3-
"version": "2.1.5",
3+
"version": "2.2.0-1",
44
"description": "A platform to visualize the deep learning process and result.",
55
"keywords": [
66
"visualdl",
@@ -34,7 +34,7 @@
3434
"dist"
3535
],
3636
"dependencies": {
37-
"@visualdl/server": "2.1.5",
37+
"@visualdl/server": "2.2.0-1",
3838
"open": "8.0.9",
3939
"ora": "5.4.0",
4040
"pm2": "4.5.6",

frontend/packages/core/package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@visualdl/core",
3-
"version": "2.1.5",
3+
"version": "2.2.0-1",
44
"description": "A platform to visualize the deep learning process and result.",
55
"keywords": [
66
"visualdl",
@@ -35,8 +35,8 @@
3535
],
3636
"dependencies": {
3737
"@tippyjs/react": "4.2.5",
38-
"@visualdl/netron": "2.1.5",
39-
"@visualdl/wasm": "2.1.5",
38+
"@visualdl/netron": "2.2.0-1",
39+
"@visualdl/wasm": "2.2.0-1",
4040
"bignumber.js": "9.0.1",
4141
"classnames": "2.3.1",
4242
"d3": "6.7.0",
@@ -113,7 +113,7 @@
113113
"@types/snowpack-env": "2.3.3",
114114
"@types/styled-components": "5.1.9",
115115
"@types/three": "0.128.0",
116-
"@visualdl/mock": "2.1.5",
116+
"@visualdl/mock": "2.2.0-1",
117117
"babel-plugin-styled-components": "1.12.0",
118118
"dotenv": "9.0.2",
119119
"enhanced-resolve": "5.8.2",

frontend/packages/core/src/hooks/useECharts.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ const useECharts = <T extends HTMLElement, W extends HTMLElement = HTMLDivElemen
6363
await import('echarts-gl');
6464
}
6565

66-
const echartInstance = echarts.init((ref.current as unknown) as HTMLDivElement);
66+
const echartInstance = echarts.init(ref.current as unknown as HTMLDivElement);
6767

6868
ref.current.addEventListener('mouseleave', hideTip);
6969

frontend/packages/core/src/hooks/useTagFilter.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -251,10 +251,10 @@ const useTagFilter = (type: Page, running: boolean) => {
251251
[state.tags]
252252
);
253253

254-
const runsInTags = useMemo(() => state.selectedRuns.filter(run => !!tags?.[run.label]?.length), [
255-
state.selectedRuns,
256-
tags
257-
]);
254+
const runsInTags = useMemo(
255+
() => state.selectedRuns.filter(run => !!tags?.[run.label]?.length),
256+
[state.selectedRuns, tags]
257+
);
258258

259259
return {
260260
...state,

frontend/packages/core/src/hooks/useThrottleFn.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ function useThrottleFn<T extends Fn>(fn: T, options?: ThrottleOptions): ReturnVa
5151
);
5252

5353
return {
54-
run: (throttled as any) as T,
54+
run: throttled as any as T,
5555
cancel: throttled.cancel
5656
};
5757
}

frontend/packages/core/src/resource/histogram/chart.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,15 @@ export const options: Record<Modes, EChartOption> = {
4545
},
4646
offset: {
4747
...baseOptions,
48-
visualMap: ({
48+
visualMap: {
4949
type: 'continuous',
5050
show: false,
5151
dimension: 1,
5252
inRange: {
5353
colorLightness: [0.5, 0.8],
5454
colorSaturation: [0.5, 0.8]
5555
}
56-
} as unknown) as VisualMap.Continuous[], // Fix echarts type bug
56+
} as unknown as VisualMap.Continuous[], // Fix echarts type bug
5757
xAxis: {
5858
axisLine: {
5959
onZero: false

frontend/packages/core/src/utils/fetch.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ export type BlobResponse = {
6868
function getT(): Promise<TFunction> {
6969
return new Promise(resolve => {
7070
// Bug of i18next
71-
i18next.changeLanguage((undefined as unknown) as string).then(t => resolve(t));
71+
i18next.changeLanguage(undefined as unknown as string).then(t => resolve(t));
7272
});
7373
}
7474

frontend/packages/demo/builder/audio.ts

+3-8
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,18 @@
1414
* limitations under the License.
1515
*/
1616

17-
import type {Data, Worker} from './types';
18-
19-
interface Audio {
20-
step: number;
21-
wallTime: number;
22-
}
17+
import type {Sample, TagData, Worker} from './types';
2318

2419
const worker: Worker = async io => {
2520
const components = await io.getData<string[]>('/components');
2621
if (!components.includes('audio')) {
2722
return;
2823
}
2924

30-
const {runs, tags} = await io.save<Data>('/audio/tags');
25+
const {runs, tags} = await io.save<TagData>('/audio/tags');
3126
for (const [index, run] of runs.entries()) {
3227
for (const tag of tags[index]) {
33-
const list = (await io.save<Audio[]>('/audio/list', {run, tag})) ?? [];
28+
const list = (await io.save<Sample[]>('/audio/list', {run, tag})) ?? [];
3429
for (const [index, audio] of list.entries()) {
3530
await io.saveBinary('/audio/audio', {run, tag, index, ts: audio.wallTime});
3631
}

frontend/packages/demo/builder/high-dimensional.ts

+7-6
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,15 @@
1414
* limitations under the License.
1515
*/
1616

17-
import type {Embedding, Worker} from './types';
17+
import type {Worker} from './types';
1818

19-
const worker: Worker = async io => {
20-
const components = await io.getData<string[]>('/components');
21-
if (!components.includes('embeddings')) {
22-
return;
23-
}
19+
interface Embedding {
20+
name: string;
21+
shape: [number, number];
22+
path: string;
23+
}
2424

25+
const worker: Worker = async io => {
2526
const list = await io.save<Embedding[]>('/embedding/list');
2627
await Promise.all(
2728
list.map(({name}) =>

frontend/packages/demo/builder/histogram.ts

+2-7
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,10 @@
1414
* limitations under the License.
1515
*/
1616

17-
import type {Data, Worker} from './types';
17+
import type {TagData, Worker} from './types';
1818

1919
const worker: Worker = async io => {
20-
const components = await io.getData<string[]>('/components');
21-
if (!components.includes('histogram')) {
22-
return;
23-
}
24-
25-
const {runs, tags} = await io.save<Data>('/histogram/tags');
20+
const {runs, tags} = await io.save<TagData>('/histogram/tags');
2621
const q = [];
2722
for (const [index, run] of runs.entries()) {
2823
for (const tag of tags[index]) {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/**
2+
* Copyright 2020 Baidu Inc. All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
import type {Worker} from './types';
18+
19+
interface Indicator {
20+
name: string;
21+
type: string;
22+
}
23+
24+
interface IndicatorData {
25+
hparams: Indicator[];
26+
metrics: Indicator[];
27+
}
28+
29+
interface ListItem {
30+
name: string;
31+
hparams: Record<string, string | number>;
32+
metrics: Record<string, string | number>;
33+
}
34+
35+
const DataTypes = ['csv', 'tsv'];
36+
37+
const worker: Worker = async io => {
38+
const q = [io.save<IndicatorData>('/hparams/indicators'), io.save<ListItem[]>('/hparams/list')] as const;
39+
const [{metrics}, list] = await Promise.all(q);
40+
for (const row of list) {
41+
for (const metric of metrics) {
42+
await io.save('/hparams/metric', {run: row.name, metric: metric.name});
43+
}
44+
}
45+
46+
await Promise.all(DataTypes.map(type => io.saveBinary('/hparams/data', {type})));
47+
};
48+
49+
export default worker;

frontend/packages/demo/builder/image.ts

+3-13
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,13 @@
1414
* limitations under the License.
1515
*/
1616

17-
import type {Data, Worker} from './types';
18-
19-
interface Image {
20-
step: number;
21-
wallTime: number;
22-
}
17+
import type {Sample, TagData, Worker} from './types';
2318

2419
const worker: Worker = async io => {
25-
const components = await io.getData<string[]>('/components');
26-
if (!components.includes('image')) {
27-
return;
28-
}
29-
30-
const {runs, tags} = await io.save<Data>('/image/tags');
20+
const {runs, tags} = await io.save<TagData>('/image/tags');
3121
for (const [index, run] of runs.entries()) {
3222
for (const tag of tags[index]) {
33-
const list = (await io.save<Image[]>('/image/list', {run, tag})) ?? [];
23+
const list = (await io.save<Sample[]>('/image/list', {run, tag})) ?? [];
3424
for (const [index, image] of list.entries()) {
3525
await io.saveBinary('/image/image', {run, tag, index, ts: image.wallTime});
3626
}

frontend/packages/demo/builder/index.ts

+13-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,19 @@ import {spawn} from 'child_process';
2626

2727
const host = '127.0.0.1';
2828
const publicPath = '/visualdl';
29-
const pages = ['common', 'scalar', 'histogram', 'image', 'audio', 'graph', 'pr-curve', 'roc-curve', 'high-dimensional'];
29+
const pages = [
30+
'common',
31+
'scalar',
32+
'histogram',
33+
'image',
34+
'audio',
35+
'text',
36+
'graph',
37+
'pr-curve',
38+
'roc-curve',
39+
'high-dimensional',
40+
'hyper-parameter'
41+
];
3042
const dataDir = path.resolve(__dirname, '../data');
3143

3244
async function start() {

frontend/packages/demo/builder/pr-curve.ts

+2-7
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,10 @@
1414
* limitations under the License.
1515
*/
1616

17-
import type {Data, Worker} from './types';
17+
import type {TagData, Worker} from './types';
1818

1919
const worker: Worker = async io => {
20-
const components = await io.getData<string[]>('/components');
21-
if (!components.includes('pr_curve')) {
22-
return;
23-
}
24-
25-
const {runs, tags} = await io.save<Data>('/pr-curve/tags');
20+
const {runs, tags} = await io.save<TagData>('/pr-curve/tags');
2621
for (const [index, run] of runs.entries()) {
2722
await io.save('/pr-curve/steps', {run});
2823
for (const tag of tags[index]) {

frontend/packages/demo/builder/roc-curve.ts

+2-7
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,10 @@
1414
* limitations under the License.
1515
*/
1616

17-
import type {Data, Worker} from './types';
17+
import type {TagData, Worker} from './types';
1818

1919
const worker: Worker = async io => {
20-
const components = await io.getData<string[]>('/components');
21-
if (!components.includes('roc_curve')) {
22-
return;
23-
}
24-
25-
const {runs, tags} = await io.save<Data>('/roc-curve/tags');
20+
const {runs, tags} = await io.save<TagData>('/roc-curve/tags');
2621
for (const [index, run] of runs.entries()) {
2722
await io.save('/roc-curve/steps', {run});
2823
for (const tag of tags[index]) {

frontend/packages/demo/builder/scalar.ts

+2-7
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,12 @@
1414
* limitations under the License.
1515
*/
1616

17-
import type {Data, Worker} from './types';
17+
import type {TagData, Worker} from './types';
1818

1919
const DataTypes = ['csv', 'tsv'];
2020

2121
const worker: Worker = async io => {
22-
const components = await io.getData<string[]>('/components');
23-
if (!components.includes('scalar')) {
24-
return;
25-
}
26-
27-
const {runs, tags} = await io.save<Data>('/scalar/tags');
22+
const {runs, tags} = await io.save<TagData>('/scalar/tags');
2823
const q = [];
2924
for (const [index, run] of runs.entries()) {
3025
for (const tag of tags[index]) {
+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/**
2+
* Copyright 2020 Baidu Inc. All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
import type {Sample, TagData, Worker} from './types';
18+
19+
const worker: Worker = async io => {
20+
const {runs, tags} = await io.save<TagData>('/text/tags');
21+
for (const [index, run] of runs.entries()) {
22+
for (const tag of tags[index]) {
23+
const list = (await io.save<Sample[]>('/text/list', {run, tag})) ?? [];
24+
for (const [index, text] of list.entries()) {
25+
await io.saveBinary('/text/text', {run, tag, index, ts: text.wallTime});
26+
}
27+
}
28+
}
29+
};
30+
31+
export default worker;

frontend/packages/demo/builder/types.ts

+6-7
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,12 @@ import type IO from './io';
1818

1919
export type Worker = (io: IO) => Promise<void>;
2020

21-
export type Data = {
21+
export interface TagData {
2222
runs: string[];
2323
tags: string[][];
24-
};
24+
}
2525

26-
export type Embedding = {
27-
name: string;
28-
shape: [number, number];
29-
path: string;
30-
};
26+
export interface Sample {
27+
step: number;
28+
wallTime: number;
29+
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)