提交 4b798e46 编写于 作者: W wuzewu

Update contribution docs

上级 cd14bbe0
...@@ -214,49 +214,8 @@ SentaTest.sentiment_classify(texts=["这部电影太差劲了"]) ...@@ -214,49 +214,8 @@ SentaTest.sentiment_classify(texts=["这部电影太差劲了"])
## 四、发布Module ## 四、发布Module
在完成Module的开发和测试后,如果想要将模型分享给其他人使用,可以通过以下方式发布模型: 在完成Module的开发和测试后,如果想要将模型分享给其他人使用,可以通过 **上传Module到PaddleHub官网** 的方式发布模型:
### 方式一、上传Module到PaddleHub官网
https://www.paddlepaddle.org.cn/hub https://www.paddlepaddle.org.cn/hub
我们会在尽可能短的时间内完成Module的审核并给出反馈,通过审核并上线后,Module将展示在PaddleHub官网的`开发者贡献模型`中,用户可以像加载其他官方Module一样加载该Module。 我们会在尽可能短的时间内完成Module的审核并给出反馈,通过审核并上线后,Module将展示在PaddleHub官网的`开发者贡献模型`中,用户可以像加载其他官方Module一样加载该Module。
### 方式二、上传Module到远程代码托管平台
PaddleHub也支持直接加载远程代码托管平台上的Module,具体步骤如下:
#### step 1. 创建新的仓库
在代码托管平台上创建一个新的Git仓库,添加前面所写Module的代码,为了方便区分管理不同的Module,我们创建一个modules目录,并将senta_test放在modules目录下
#### step 2. 新增配置文件`hubconf.py`
在根目录下,新增配置文件`hubconf.py`,文件中引用一个通过`moduleinfo`修饰的类,如下
```python
from modules.senta_test.module import SentaTest
```
*此时文件结构如下:*
```
hubconf.py
modules
├── senta_test/
├── vocab.list
├── module.py
└── processor.py
```
#### step 3. 完成提交并推送到远程仓库
#### step 4. 在本地加载远程仓库中的Module
为了方便体验,我们在GitHub和Gitee上都存放了SentaTest的代码,可以直接通过以下方式体验效果
```python
import paddlehub as hub
senta_test = hub.Module(name='senta_test', source='https://github.com/nepeplwu/myhub.git')
# senta_test = hub.Module(name='senta_test', source='https://gitee.com/nepeplwu/myhub.git')
print(senta_test.sentiment_classify(texts=["这部电影太差劲了"]))
```
...@@ -234,51 +234,8 @@ Install the Module on the local machine and run it through hub run. ...@@ -234,51 +234,8 @@ Install the Module on the local machine and run it through hub run.
## IV. Release Module ## IV. Release Module
After completing the development and testing of the module, if you want to share the model with others, you can release the model in the following ways. After completing the development and testing of the module, if you want to share the model with others, you can release the model by **Upload the Module to the PaddleHub website**.
### Method 1: Upload the Module to the PaddleHub website.
https://www.paddlepaddle.org.cn/hub https://www.paddlepaddle.org.cn/hub
We will complete the review of the module and give feedback in the shortest possible time. After passing the review and going online, the module will be displayed on the PaddleHub website, and users can load it like any other official modules. We will complete the review of the module and give feedback in the shortest possible time. After passing the review and going online, the module will be displayed on the PaddleHub website, and users can load it like any other official modules.
### Method 2: Upload the Module to the remote code hosting platform.
PaddleHub also supports loading Modules directly to the remote code hosting platforms. The steps are as follows:
#### Step 1: Create a new repository.
To create a new Git repository on the code hosting platform, add the codes of the module we wrote earlier. To make it easier to manage different modules, we create a modules directory and put senta\_test in the modules directory.
#### Step 2: Add a new configuration file`hubconf.py`.
In the root directory, add a new configuration `hubconf.py` file, which references a class modified by `moduleinfo` as follows:
```python
from modules.senta_test.module import SentaTest
```
*The structure of the file at this point is as follows:*
```
hubconf.py
modules
├── senta_test/
├── vocab.list
├── module.py
└── processor.py
```
#### Step 3: Complete the commit and push to the remote repository.
#### Step 4: Load Module in the remote repository locally.
To facilitate the experience, we have stored the SentaTest codes on GitHub and Gitee. So you can directly experience the effect in the following ways:
```python
import paddlehub as hub
senta_test = hub.Module(name='senta_test', source='https://github.com/nepeplwu/myhub.git')
# senta_test = hub.Module(name='senta_test', source='https://gitee.com/nepeplwu/myhub.git')
print(senta_test.sentiment_classify(texts=["这部电影太差劲了"]))
```
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
__version__ = '2.0.1' __version__ = '2.0.4'
import paddle import paddle
from packaging.version import Version from packaging.version import Version
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册