How to use load_files method in yandex-tank

Best Python code snippet using yandex-tank

mt_inference.py

Source:mt_inference.py Github

copy

Full Screen

...9 10 word2idx_input_path = confFile.WORD2IDX_INPUTS11 word2idx_output_path = confFile.WORD2IDX_TARGET12 13 word2idx_input = load_files(word2idx_input_path)14 word2idx_target = load_files(word2idx_output_path)15 idx2word_input = {v:k for k, v in word2idx_input.items()}16 idx2word_trans = {v:k for k, v in word2idx_target.items()}17 enc_out = encoder_model.predict(input_sequence)18 target_seq = np.zeros((1, 1))19 target_seq[0, 0] = word2idx_target['sos']20 eos = word2idx_target['eos']21 22 s = np.zeros((1, confFile.LATENT_DIM))23 c = np.zeros((1, confFile.LATENT_DIM))24 output_sentence = []25 for _ in range(max_len_target):26 o, s, c = decoder_model.predict([target_seq, enc_out, s, c])27 idx = np.argmax(o.flatten())28 # End sentence of EOS29 if eos == idx:30 break31 word = ''32 if idx > 0:33 word = idx2word_trans[idx]34 output_sentence.append(word)35 target_seq[0, 0] = idx36 return ' '.join(output_sentence)37 38def test(string, infrence_models):39 tokenizerpath = confFile.TOKENIZER_INPUT_PATH40 max_len_input_path = confFile.MAX_LEN_INPUT41 max_len_input = load_files(max_len_input_path)42 tokenizer_input = load_files(tokenizerpath)43 string_seq=tokenizer_input.texts_to_sequences([string])44 string_seq=pad_sequences(string_seq,maxlen=max_len_input)45 translation=decode_sequence(string_seq, infrence_models[0], infrence_models[1])46 47 return translation48Model = ModelBuilding()49embedding_matrix = load_files(confFile.EMBEDDING_MATRIX_PATH)50max_len_target_path = confFile.MAX_LEN_TARGET51max_len_input_path = confFile.MAX_LEN_INPUT52model_weights_path = confFile.WEIGHTS_PATH53max_len_target = load_files(max_len_target_path)54max_len_input = load_files(max_len_input_path)55num_words = load_files(confFile.NUM_WORDS)56num_words_output = load_files(confFile.NUM_WORDS_OUTPUT)57model = Model.EncDecbuild(num_words, confFile.LATENT_DIM, confFile.EMBEDDING_DIM, embedding_matrix, max_len_input, max_len_target, num_words_output)58model.load_weights(model_weights_path)59infrence_models = Model.encoderDecoderModel(max_len_input, confFile.LATENT_DIM)60translation = test("tom is laughing", infrence_models)61print(translation)...

Full Screen

Full Screen

prolog.py

Source:prolog.py Github

copy

Full Screen

...4def yap(action,load_files,outfile=None,timeout=None):5 call('yap',action,load_files,outfile,timeout)6def call(prolog_version,action,load_files,outfile=None,timeout=None):7 load_files = map(lambda x: "'{}'".format(x),load_files)8 cmd = "load_files([{}],[silent(true)]). ".format(','.join(load_files))9 cmd+=action10 if outfile == None:11 p = subprocess.Popen([prolog_version,'-q'], stdin=subprocess.PIPE)12 call_p(p,cmd,timeout)13 else:14 with open(outfile, 'w') as outf:15 p = subprocess.Popen([prolog_version,'-q','-G8g'], stdin=subprocess.PIPE, stdout=outf)16 call_p(p,cmd,timeout)17def call_p(p,cmd,timeout):18 try:19 print(cmd)20 p.stdin.write(cmd.encode())21 p.communicate(timeout=timeout)22 except Exception as e:...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run yandex-tank automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful