master
/ Untitled.ipynb

Untitled.ipynb @81e1308view markup · raw · history · blame

Notebook
In [1]:
from handler import handle
/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/dtypes.py:526: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint8 = np.dtype([("qint8", np.int8, 1)])
/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/dtypes.py:527: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint8 = np.dtype([("quint8", np.uint8, 1)])
/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/dtypes.py:528: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint16 = np.dtype([("qint16", np.int16, 1)])
/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/dtypes.py:529: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint16 = np.dtype([("quint16", np.uint16, 1)])
/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/dtypes.py:530: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint32 = np.dtype([("qint32", np.int32, 1)])
/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/dtypes.py:535: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  np_resource = np.dtype([("resource", np.ubyte, 1)])
11:40:51 INFO:best_model: ./results/output_poem/best_model/model-61170

WARNING:tensorflow:From /home/jovyan/work/char_rnn_model.py:51: LSTMCell.__init__ (from tensorflow.python.ops.rnn_cell_impl) is deprecated and will be removed in a future version.
Instructions for updating:
This class is equivalent as tf.keras.layers.LSTMCell, and will be replaced by that in Tensorflow 2.0.
11:40:51 WARNING:From /home/jovyan/work/char_rnn_model.py:51: LSTMCell.__init__ (from tensorflow.python.ops.rnn_cell_impl) is deprecated and will be removed in a future version.
Instructions for updating:
This class is equivalent as tf.keras.layers.LSTMCell, and will be replaced by that in Tensorflow 2.0.
WARNING:tensorflow:From /home/jovyan/work/char_rnn_model.py:62: MultiRNNCell.__init__ (from tensorflow.python.ops.rnn_cell_impl) is deprecated and will be removed in a future version.
Instructions for updating:
This class is equivalent as tf.keras.layers.StackedRNNCells, and will be replaced by that in Tensorflow 2.0.
11:40:51 WARNING:From /home/jovyan/work/char_rnn_model.py:62: MultiRNNCell.__init__ (from tensorflow.python.ops.rnn_cell_impl) is deprecated and will be removed in a future version.
Instructions for updating:
This class is equivalent as tf.keras.layers.StackedRNNCells, and will be replaced by that in Tensorflow 2.0.
WARNING:tensorflow:From /usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/op_def_library.py:263: colocate_with (from tensorflow.python.framework.ops) is deprecated and will be removed in a future version.
Instructions for updating:
Colocations handled automatically by placer.
11:40:51 WARNING:From /usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/op_def_library.py:263: colocate_with (from tensorflow.python.framework.ops) is deprecated and will be removed in a future version.
Instructions for updating:
Colocations handled automatically by placer.
WARNING:tensorflow:From /home/jovyan/work/char_rnn_model.py:107: static_rnn (from tensorflow.python.ops.rnn) is deprecated and will be removed in a future version.
Instructions for updating:
Please use `keras.layers.RNN(cell, unroll=True)`, which is equivalent to this API
11:40:51 WARNING:From /home/jovyan/work/char_rnn_model.py:107: static_rnn (from tensorflow.python.ops.rnn) is deprecated and will be removed in a future version.
Instructions for updating:
Please use `keras.layers.RNN(cell, unroll=True)`, which is equivalent to this API
WARNING:tensorflow:From /usr/local/lib/python3.5/dist-packages/tensorflow/python/training/saver.py:1266: checkpoint_exists (from tensorflow.python.training.checkpoint_management) is deprecated and will be removed in a future version.
Instructions for updating:
Use standard file APIs to check for files with this prefix.
11:40:51 WARNING:From /usr/local/lib/python3.5/dist-packages/tensorflow/python/training/saver.py:1266: checkpoint_exists (from tensorflow.python.training.checkpoint_management) is deprecated and will be removed in a future version.
Instructions for updating:
Use standard file APIs to check for files with this prefix.
In [2]:
conf = {'体裁':'五言', 'style':'藏头诗', 'Chinese_word':'一二三四'}
res = handle(conf)
In [3]:
res
Out[3]:
{'Poetry': '一谈安信惭转真,\n二毛吹血自在斯。\n三年波澜恐不安,\n四海无人不可知。\n'}
In [23]:
res1 = res['Poetry'].split('。')[:2]
In [29]:
res1 = res['Poetry'].split('。')[:2]
res2 = []
for i in res1:
    res2.extend(i.split(','))
res3 = res2[0]+',\n'+res2[1]+'。\n'+res2[2]+',\n'+res2[3]+'。'
In [30]:
res2
Out[30]:
['一闻江城涯', '二月月涛中', '三湘闇北内', '四海无人同']
In [35]:
res3 = res2[0]+',\n'+res2[1]+'。\n'+res2[2]+',\n'+res2[3]+'。'
print(res3)
一闻江城涯,
二月月涛中。
三湘闇北内,
四海无人同。
In [1]:
# You can use other public modules via our Client object with module's identifier
# and parameters.
# For more detailes, please see our online document - https://momodel.github.io/docs/#

import os
import sys

# Define root path
sys.path.append('../')

# Import necessary packages
from modules import json_parser
from modules import Client

# Initialise Client object
client = Client(api_key='33799e1c5d6fa05fdd7dec3aa7aad868445d1c737edcf9c37fa89cb3b39cb2d9',
                project_id='5bfd118f1afd942b66b36b30', user_ID='yangsaisai',
                project_type='app', source_file_path='Untitled.ipynb')

# Make run/train/predict command alias for further use
run = client.run
train = client.train
predict = client.predict

# Make controller alias for further use
controller = client.controller
In [2]:
ls /home/jovyan/work/datasets/yangsaisai-poetrydatasets
OVERVIEW.md   poems_edge_split.txt  rhyme_words.txt
poem_ids.txt  results/              vectors_poem.bin
In [ ]: