示例#1
0
#coding:utf-8
'''
Created on 2018年3月1日

@author: qiujiahao

@email:[email protected]

'''
import logging
import conf
import time
import os
from threading import Thread,Timer

dir = conf.get_args().module_path

start_log = False
if not os.path.exists(dir+'/log'):
    os.makedirs(dir+'/log')

def log(info,level='debug'):
    "获取当前时间"
    print(info,start_log)#此处再打印一下,方便我调试
    if start_log==False:
        return
    date=time.strftime("%Y%m%d")
    filename=dir+'/log/'+date+'.txt'
    loc_time=time.strftime("%H:%M:%S")
    if level=='debug':
        logging.basicConfig(filename=filename,level=logging.DEBUG)
示例#2
0
 def __init__(self):
     self.args = get_args()
     self.graph = Graph('bolt://localhost:7687',
                        user=self.args.neo4j_user,
                        password=self.args.neo4j_password)
示例#3
0
 def __init__(self):
     self.args=get_args()
     self.data_process()
示例#4
0
import sys
sys.path.append("lib")
sys.path.append('src')
import conf
import platformdep
import mylogging

VERSION = "0.3.3"  # also in setup_script.iss

args = conf.get_args()  # configuration dictionary

appName = "nameGUI"
CONFFOLDER = args.datadir if args.datadir else platformdep.get_conf_dir(appName.lower())

LOGFILENAME = "logfile.txt"
LOGFILENAMEPATH = CONFFOLDER + "/" + LOGFILENAME
LOGLEVELCONSOLE = mylogging.DEBUG
LOGLEVELFILE = mylogging.DEBUG

NAMENEWDBFILENAME = "nameNewDb.txt"
NAMENEWDBFILENAMEPATH = CONFFOLDER + "/" + NAMENEWDBFILENAME

def get_my_logger(name):
    return mylogging.get_logger(name=name, levelConsole=LOGLEVELCONSOLE,
                                            filename=LOGFILENAMEPATH, levelFile=LOGLEVELFILE)
示例#5
0
    while True:
        input_word = input('请输入您的问题:')
        text = data.text2index(input_word)
        if use_cuda:
            seq2seq_model = Seq2Seq(input_dim, embedding_dim, hidden_dim, output_dim, use_cuda=use_cuda).cuda()
        else:
            seq2seq_model = Seq2Seq(input_dim, embedding_dim, hidden_dim, output_dim, use_cuda=use_cuda)
        seq2seq_model.load_state_dict(torch.load(args.module_path))
        seq2seq_model.eval()
        #predict_indices = seq2seq_model.seq2seq_predict(text)
        #predict_result = data.index2text(predict_indices)
        #print(predict_result)
        predict_sample_indices = seq2seq_model.beamsearch(text)
        for predict_indices in predict_sample_indices:
            predict_result = data.index2text(predict_indices)
            print("".join(predict_result[:-1]))
        #rerank_by_bleu(input_word, results)


if __name__=='__main__':
    args=get_args()
    data=data(args)
    data.data_split()
    args.vocab_size=data.vocab_size
    print('参数列表:{}'.format(args))
    if args.mode=='train':
        start_train(args,data)
    else:
        start_test(args,data)

示例#6
0
import sys

sys.path.append("lib")
sys.path.append('src')
import conf
import platformdep
import mylogging

VERSION = "0.3.3"  # also in setup_script.iss

args = conf.get_args()  # configuration dictionary

appName = "nameGUI"
CONFFOLDER = args.datadir if args.datadir else platformdep.get_conf_dir(
    appName.lower())

LOGFILENAME = "logfile.txt"
LOGFILENAMEPATH = CONFFOLDER + "/" + LOGFILENAME
LOGLEVELCONSOLE = mylogging.DEBUG
LOGLEVELFILE = mylogging.DEBUG

NAMENEWDBFILENAME = "nameNewDb.txt"
NAMENEWDBFILENAMEPATH = CONFFOLDER + "/" + NAMENEWDBFILENAME


def get_my_logger(name):
    return mylogging.get_logger(name=name,
                                levelConsole=LOGLEVELCONSOLE,
                                filename=LOGFILENAMEPATH,
                                levelFile=LOGLEVELFILE)
示例#7
0
import conf
from handwriting.training import train
from handwriting.validation import validate

if __name__ == "__main__":

    # Get conf parameters
    settings = conf.get_args()

    ################
    # TRAINING
    ################
    if settings.train_unconditional:
        train.train_unconditional(settings)

    if settings.train_conditional:
        train.train_conditional(settings)

    ################
    # VALIDATION
    ################
    if settings.validate_unconditional:
        validate.validate_unconditional(settings)

    if settings.validate_conditional:
        validate.validate_conditional(settings)