Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleHub
提交
d9e5d161
P
PaddleHub
项目概览
PaddlePaddle
/
PaddleHub
12 个月 前同步成功
通知
280
Star
12117
Fork
2091
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
200
列表
看板
标记
里程碑
合并请求
4
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleHub
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
200
Issue
200
列表
看板
标记
里程碑
合并请求
4
合并请求
4
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
d9e5d161
编写于
1月 04, 2019
作者:
Z
Zeyu Chen
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix error of python runing
上级
efb55496
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
9 addition
and
28 deletion
+9
-28
paddle_hub/module.py
paddle_hub/module.py
+9
-6
paddle_hub/utils.py
paddle_hub/utils.py
+0
-22
未找到文件。
paddle_hub/module.py
浏览文件 @
d9e5d161
...
...
@@ -41,6 +41,9 @@ class Module(object):
def
__init__
(
self
,
module_url
=
None
,
module_dir
=
None
):
if
module_url
==
None
and
module_dir
==
None
:
raise
Exception
(
"Module:module_url and module_dir are None!"
)
self
.
module_dir
=
""
self
.
module_name
=
""
# donwload module
if
module_url
is
not
None
and
module_url
.
startswith
(
"http"
):
# if it's remote url link, then download and uncompress it
...
...
@@ -48,9 +51,9 @@ class Module(object):
module_url
)
elif
module_dir
is
not
None
:
# otherwise it's local path, no need to deal with it
self
.
module_dir
=
module_
url
self
.
module_dir
=
module_
dir
# use the path name as module name by default
self
.
module_name
=
module_
url
.
split
(
"/"
)[
-
1
]
self
.
module_name
=
module_
dir
.
split
(
"/"
)[
-
1
]
# load paddle inference model
place
=
fluid
.
CPUPlace
()
...
...
@@ -66,8 +69,8 @@ class Module(object):
print
(
"fetch_targets"
)
print
(
self
.
fetch_targets
)
config
=
ModuleConfig
(
self
.
module_dir
)
config
.
load
()
self
.
config
=
ModuleConfig
(
self
.
module_dir
)
self
.
config
.
load
()
# load assets
# self.dict = defaultdict(int)
# self.dict.setdefault(0)
...
...
@@ -266,8 +269,8 @@ class ModuleUtils(object):
if
__name__
==
"__main__"
:
module_link
=
"http://paddlehub.cdn.bcebos.com/word2vec/w2v_saved_inference_module
.tar.gz"
m
=
Module
(
module_
link
)
url
=
"http://paddlehub.cdn.bcebos.com/word2vec/word2vec-dim16-simple-example-2
.tar.gz"
m
=
Module
(
module_
url
=
url
)
inputs
=
[[
"it"
,
"is"
,
"new"
],
[
"hello"
,
"world"
]]
#tensor = m._process_input(inputs)
#print(tensor)
...
...
paddle_hub/utils.py
已删除
100644 → 0
浏览文件 @
efb55496
# Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
__all__
=
[
"mkdir"
]
def
mkdir
(
path
):
""" the same as the shell command mkdir -p "
"""
if
not
os
.
path
.
exists
(
path
):
os
.
makedirs
(
path
)
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录