楼主: ReneeBK
885 4

TheanoLM - An Extensible Toolkit for Neural Network Language Modeling [推广有奖]

  • 1关注
  • 62粉丝

VIP

已卖:4895份资源

学术权威

14%

还不是VIP/贵宾

-

TA的文库  其他...

R资源总汇

Panel Data Analysis

Experimental Design

威望
1
论坛币
49629 个
通用积分
55.4465
学术水平
370 点
热心指数
273 点
信用等级
335 点
经验
57805 点
帖子
4005
精华
21
在线时间
582 小时
注册时间
2005-5-8
最后登录
2023-11-26

楼主
ReneeBK 发表于 2017-9-11 03:06:23 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
  1. Abstract
  2. We present a new tool for training neural network language models (NNLMs), scoring sentences, and generating text. The tool
  3. has been written using Python library Theano, which allows researcher to easily extend it and tune any aspect of the training
  4. process. Regardless of the flexibility, Theano is able to generate extremely fast native code that can utilize a GPU or multiple
  5. CPU cores in order to parallelize the heavy numerical computations.

  6. The tool has been evaluated in difficult Finnish and English conversational speech recognition tasks, and significant
  7. improvement was obtained over our best back-off n-gram models. The results that we obtained in the Finnish task were compared
  8. to those from existing RNNLM and RWTHLM toolkits, and found to be as good or better, while training times were an order of magnitude shorter.
复制代码

本帖隐藏的内容

TheanoLM — An Extensible Toolkit for Neural Network Language Modeling.pdf (96.17 KB)

二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

关键词:Modeling Language network Toolkit Theano

沙发
ReneeBK 发表于 2017-9-11 03:16:53
  1. from __future__ import print_function
  2. import theano
  3. import theano.tensor as T
  4. from theano.tensor.shared_randomstreams import RandomStreams
  5. import sys
  6. import time
  7. import numpy as np
  8. import pprint

  9. sys.path.append("../..")
  10. import DeepLearningStack
  11. from DeepLearningStack import RecurrentNet



  12. #create a deep network defined in AlexNet.xml
  13. if __name__=="__main__":

  14.     #create deep net
  15.     num_timesteps     = 2
  16.     print ("Creating Recurrent Net for %d time steps"%num_timesteps)
  17.     config            = "RNNArch.xml"
  18.     #random number generator used to initialize the weights
  19.     rng               = RandomStreams(seed=int(time.time()))
  20.     #for each time step, create a non-recurrent input
  21.     nonrcrnt_ins      = []
  22.     #size of the input layer is 136x128,
  23.     for t in range(num_timesteps):
  24.         in_matrix     = T.matrix("data-step-%d"%t,dtype=theano.config.floatX)#the input is concatenation of action history and beliefs
  25.         nonrcrnt_ins.append( {"input":[in_matrix,(136,128)]} )#for each input, provide a symbolic variable and its size
  26.     #create the recurrent inputs for time step 0
  27.     #size of the recurrent inputs according to RNNArch.xml (batch size is 128, each size is dim x batch_size)
  28.     # rct1: 128x128
  29.     # rct2: 128x128
  30.     # fc3 : 10x128
  31.     #fc1_step0         = T.matrix("fc1-step-0",dtype=theano.config.floatX)#the input is concatenation of action history and beliefs
  32.     fc2_step0         = T.matrix("fc2-step-0",dtype=theano.config.floatX)#the input is concatenation of action history and beliefs
  33.     #rcrnt_ins         = {"fc1":[fc1_step0,(128,128)],"fc2":[fc2_step0,(128,128)]}
  34.     rcrnt_ins         = {"fc2":[fc2_step0,(128,128)]}

  35.     #create the graph structure
  36.     rnn               = RecurrentNet.RecurrentNet( rng, nonrcrnt_ins, rcrnt_ins, config, unrolled_len=num_timesteps)
  37.     print("RNN params:")
  38.     pprint.pprint(rnn.params)

  39.     #create a function for RNN
  40.    
  41.     #inputs to the graph consists of the recurrent inputs for time step 0 and non-recurrent inputs for all time steps
  42.     inputs            = [nonrcrnt_ins[k]["input"][0] for k in range(len(nonrcrnt_ins))]
  43.     for k in rcrnt_ins.keys():
  44.         inputs.append(rcrnt_ins[k][0])
  45.     #outputs of the network include the outputs for each time step
  46.     outputs           = [rnn.name2layer[i]["fc2"].output for i in rnn.name2layer.keys()]
  47.     print("compiling the function")
  48.     f                 = theano.function(inputs=inputs,outputs=outputs)
  49.     #draw the RNN
  50.     graph_img_name    = "RNN.png"
  51.     print("creating graph picture in:",graph_img_name)
  52.     theano.printing.pydotprint(f, outfile=graph_img_name, var_with_name_simple=True)  
复制代码

藤椅
fengyg 企业认证  发表于 2017-9-11 06:40:57
kankan

板凳
MouJack007 发表于 2017-9-11 06:49:52
谢谢楼主分享!

报纸
MouJack007 发表于 2017-9-11 06:50:10

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注jltj
拉您入交流群
GMT+8, 2025-12-5 22:49