Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
VisualDL
提交
dd4eb0cd
V
VisualDL
项目概览
PaddlePaddle
/
VisualDL
大约 1 年 前同步成功
通知
88
Star
4655
Fork
642
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
10
列表
看板
标记
里程碑
合并请求
2
Wiki
5
Wiki
分析
仓库
DevOps
项目成员
Pages
V
VisualDL
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
10
Issue
10
列表
看板
标记
里程碑
合并请求
2
合并请求
2
Pages
分析
分析
仓库分析
DevOps
Wiki
5
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
dd4eb0cd
编写于
7月 27, 2020
作者:
走神的阿圆
提交者:
GitHub
7月 27, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add hdfs --model (#727)
上级
e9613d93
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
41 addition
and
8 deletion
+41
-8
visualdl/io/bfile.py
visualdl/io/bfile.py
+30
-0
visualdl/reader/reader.py
visualdl/reader/reader.py
+8
-6
visualdl/server/lib.py
visualdl/server/lib.py
+3
-2
未找到文件。
visualdl/io/bfile.py
浏览文件 @
dd4eb0cd
...
...
@@ -99,6 +99,15 @@ class LocalFileSystem(object):
def
join
(
path
,
*
paths
):
return
os
.
path
.
join
(
path
,
*
paths
)
def
isfile
(
self
,
filename
):
return
os
.
path
.
isfile
(
filename
)
def
read_file
(
self
,
filename
,
binary_mode
=
True
):
mode
=
"rb"
if
binary_mode
else
"r"
with
open
(
filename
,
mode
)
as
reader
:
data
=
reader
.
read
()
return
data
def
read
(
self
,
filename
,
binary_mode
=
False
,
size
=
None
,
continue_from
=
None
):
mode
=
"rb"
if
binary_mode
else
"r"
encoding
=
None
if
binary_mode
else
"utf-8"
...
...
@@ -142,6 +151,14 @@ class HDFileSystem(object):
else
:
return
True
def
isfile
(
self
,
filename
):
return
exists
(
filename
)
def
read_file
(
self
,
filename
,
binary_mode
=
True
):
with
self
.
cli
.
read
(
hdfs_path
=
filename
[
7
:])
as
reader
:
data
=
reader
.
read
()
return
data
def
makedirs
(
self
,
path
):
self
.
cli
.
makedirs
(
hdfs_path
=
path
[
7
:])
...
...
@@ -205,6 +222,13 @@ class BosFileSystem(object):
credentials
=
BceCredentials
(
access_key_id
,
secret_access_key
),
endpoint
=
bos_host
)
def
isfile
(
self
,
filename
):
return
exists
(
filename
)
def
read_file
(
self
,
filename
,
binary
=
True
):
print
(
'BosFileSystem not support --model yet.'
)
return
@
staticmethod
def
_get_object_info
(
path
):
path
=
path
[
6
:]
...
...
@@ -392,6 +416,9 @@ class BFile(object):
def
__iter__
(
self
):
return
self
def
isfile
(
self
,
filename
):
return
self
.
fs
.
isfile
(
filename
)
def
_read_buffer_to_offset
(
self
,
new_buff_offset
):
"""Read buffer from index self.buffer_offset to index new_buff_offset.
...
...
@@ -407,6 +434,9 @@ class BFile(object):
self
.
buff_offset
+=
read_size
return
self
.
buff
[
old_buff_offset
:
old_buff_offset
+
read_size
]
def
read_file
(
self
,
filename
,
binnary
=
True
):
return
self
.
fs
.
read_file
(
filename
,
binnary
)
def
read
(
self
,
n
=
None
):
"""Read `n` or all contents of self.buff or file.
...
...
visualdl/reader/reader.py
浏览文件 @
dd4eb0cd
...
...
@@ -70,10 +70,12 @@ class LogReader(object):
@
model
.
setter
def
model
(
self
,
model_path
):
if
not
os
.
path
.
isfile
(
model_path
):
self
.
_model
=
model_path
with
bfile
.
BFile
(
model_path
,
'rb'
)
as
bfp
:
if
not
bfp
.
isfile
(
model_path
):
print
(
"Model path %s should be file path, please check this path."
%
model_path
)
else
:
if
os
.
path
.
exists
(
model_path
):
if
bfile
.
exists
(
model_path
):
self
.
_model
=
model_path
else
:
print
(
"Model path %s is invalid, please check this path."
%
model_path
)
...
...
visualdl/server/lib.py
浏览文件 @
dd4eb0cd
...
...
@@ -18,6 +18,7 @@ import sys
import
time
import
numpy
as
np
from
visualdl.server.log
import
logger
from
visualdl.io
import
bfile
from
visualdl.utils.string_util
import
encode_tag
,
decode_tag
...
...
@@ -192,8 +193,8 @@ def get_histogram(log_reader, run, tag):
def
get_graph
(
log_reader
):
result
=
b
""
if
log_reader
.
model
:
with
open
(
log_reader
.
model
,
"rb"
)
as
fp
:
result
=
fp
.
read
(
)
with
bfile
.
BFile
(
log_reader
.
model
,
'rb'
)
as
b
fp
:
result
=
bfp
.
read_file
(
log_reader
.
model
)
return
result
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录