提交 148e2a04 编写于 作者: 走神的阿圆's avatar 走神的阿圆

add config.json for component sampling.

上级 b8590f97
...@@ -16,9 +16,25 @@ ...@@ -16,9 +16,25 @@
from __future__ import absolute_import from __future__ import absolute_import
import threading import threading
import random import random
import json
import collections import collections
DEFAULT_PLUGIN_MAXSIZE = { from visualdl.utils.dir import CONFIG_PATH
try:
with open(CONFIG_PATH, 'r', encoding='utf-8') as fp:
data = json.load(fp)
DEFAULT_PLUGIN_MAXSIZE = {
"scalar": data.get('scalar_sample', 1000),
"image": data.get('image_sample', 10),
"histogram": data.get('histogram_sample', 100),
"embeddings": data.get('embedding_sample', 50000),
"audio": data.get('audio_sample', 10),
"pr_curve": data.get('pr_curve_sample', 300),
"meta_data": 100
}
except Exception:
DEFAULT_PLUGIN_MAXSIZE = {
"scalar": 1000, "scalar": 1000,
"image": 10, "image": 10,
"histogram": 100, "histogram": 100,
...@@ -26,7 +42,7 @@ DEFAULT_PLUGIN_MAXSIZE = { ...@@ -26,7 +42,7 @@ DEFAULT_PLUGIN_MAXSIZE = {
"audio": 10, "audio": 10,
"pr_curve": 300, "pr_curve": 300,
"meta_data": 100 "meta_data": 100
} }
class Reservoir(object): class Reservoir(object):
......
...@@ -25,7 +25,7 @@ from visualdl.server.log import logger ...@@ -25,7 +25,7 @@ from visualdl.server.log import logger
def get_server_url(): def get_server_url():
with open(CONFIG_PATH, 'r') as fp: with open(CONFIG_PATH, 'r', encoding='utf-8') as fp:
server_url = json.load(fp)['server_url'] server_url = json.load(fp)['server_url']
return server_url return server_url
......
...@@ -33,5 +33,5 @@ def init_vdl_config(): ...@@ -33,5 +33,5 @@ def init_vdl_config():
if not os.path.exists(CONF_HOME): if not os.path.exists(CONF_HOME):
os.makedirs(CONF_HOME) os.makedirs(CONF_HOME)
if not os.path.exists(CONFIG_PATH) or 0 == os.path.getsize(CONFIG_PATH): if not os.path.exists(CONFIG_PATH) or 0 == os.path.getsize(CONFIG_PATH):
with open(CONFIG_PATH, 'w') as fp: with open(CONFIG_PATH, 'w', encoding='utf-8') as fp:
fp.write(json.dumps(default_vdl_config)) fp.write(json.dumps(default_vdl_config))
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册