Questions tagged [beam-search]

This tag is for questions related to the heuristic search algorithm beam search.

From https://en.wikipedia.org/wiki/Beam_search:

Beam search is a heuristic search algorithm that explores a graph by expanding the most promising node in a limited set. Beam search is an optimization of best-first search that reduces its memory requirements. Best-first search is a graph search which orders all partial solutions (states) according to some heuristic which attempts to predict how close a partial solution is to a complete solution (goal state). But in beam search, only a predetermined number of best partial solutions are kept as candidates.

41 questions
2
votes
2 answers

Sorting in Beam Search

Although I have good understanding of beam search but I have a query regarding beam search. When we select n best paths should we sort them or simply we should keep them in the order in which they exist and just discard other expensive nodes? I…
Hammad Hassan
  • 1,192
  • 17
  • 29
1
vote
0 answers

Using .generate function for beam search over predictions in custom model extending TFPreTrainedModel class

I want to use .generate() functionality of hugging face in my model's predictions. My model is a custom model inehriting from "TFPreTrainedModel" class and has a custom transformer inheriting from tf.keras.layers followed by few hidden layers and a…
1
vote
1 answer

Vectorized beam search decoder is not faster on GPU - Tensorflow 2

I'm trying to run a RNN beam search on a tf.keras.Model in a vectorized way to have it work completely on GPU. However, despite having everything as tf.function, as vectorized as I can make it, it runs exactly the same speed with or without a GPU.…
meow
  • 925
  • 7
  • 22
1
vote
2 answers

How to use tensorflow ctc beam search properly?

I want to perform CTC Beam Search on (the output of an ASR model that gives) matrices of phoneme probability values. Tensorflow has a CTC Beam Search implementation but it's poorly documented and I fail to make a working example. I want to write a…
dzsezusz
  • 106
  • 9
1
vote
1 answer

How to retrieve topk values across multiple rows along with their respective indices in PyTorch?

I have a tensor like this: tensor([[[ 7.3478, -1.8058, -2.6140, ..., -0.2719, -0.3171, -0.4737]], [[ 7.3606, -1.8269, -1.9825, ..., -0.8680, 0.4894, 0.2708]]], grad_fn=) I want to get the topk values across both the rows.…
Rafay
  • 6,108
  • 11
  • 51
  • 71
1
vote
0 answers

Accessing word level predictions with Google Translate

There's a research project involving translation I'm thinking about, and for it, I'd like to use google's translation system. However, I need access not just to the translation of an input sentence, but the output of a beam search with probabilities…
Reuben
  • 609
  • 3
  • 9
1
vote
0 answers

What is the difference between tf.nn.ctc_beam_search_decoder and tf.contrib.seq2seq.BeamSearchDecoder mechanism?

I am building a seq2seq model with tensorflow. Can you explain the details of the two beam search functions? Thank…
최가람
  • 19
  • 2
1
vote
1 answer

Based on a beam search algorithm

Based on a beam search algorithm in what does de probability of each node of the graph depends on? I mean like what characteristics gives the node its probability for the search?
1
vote
1 answer

Tensorflow: Troubles with .clone() in seq2seq model using Attention and BeamSearch

I am trying to implement a seq2seq model, using bidirectional_dynamic_decode, Attention and the BeamSearchDecoder in Tensorflow (1.6.0). (I tried to copy only the relevant code, to keep it simple) # encoder def make_lstm(rnn_size, keep_prob): …
tmmmmmi
  • 81
  • 3
1
vote
0 answers

TensorFlow BeamSearchDecoder outputs the sample_id as (actual sample_id+1)

Have I written custom code (as opposed to using a stock example script provided in TensorFlow): Yes. Based on the NMT tutorial, I am writing a customized code for my own task. OS Platform and Distribution (e.g., Linux Ubuntu 16.04):Linux Ubuntu…
1
vote
1 answer

How does tf.contrib.seq2seq.gather_tree work?

How exactly does gather_tree in contrib.seq2seq work? I can see that it takes the predicted ids and beam parent ids and somehow returns the final beams, but what's actually going underneath the hood? There doesn't seem to be any Python code base I…
kuhanw
  • 21
  • 4
1
vote
2 answers

CTC Beam Search using Tensorflow Backend

The keras documentation and tensorflow provide a function ctc_decode which does the ctc beam search decoding for the output of the network. The documentation does not provide example usage for the decoder.…
0
votes
0 answers

How to use Huggingface GenerationMixin (or its beam search) with my own model?

Huggingface's use of a mixin keeps teasing me that this should be possible, but I can't find any clear documentation on exactly what the requirements are, or if the dependencies are just too much to make it worth it. The central module is literally…
Darren Cook
  • 27,837
  • 13
  • 117
  • 217
0
votes
0 answers

Use Beam Search in encoder-decoder

How can tfa.seq2seq.BeamSearchDecoder, for example, be used with a simple encoder-decoder architecture? Suppose the task is machine translation, where the encoder returns a vector representation of the input sequence. The decoder uses Embedding,…
0
votes
0 answers

There are 50 courses and 500 students. Ecah student will register 5 course from it. How could I tell if there exsit a time table with no conflict?

I am doing a project that makes a course-table(location and time) for students that minimize their walking distance by using genetic algorithm. There are 500 students and each of them will register for 3 mandatory courses out of 10 courses, and 2…
Jesse Jin
  • 21
  • 1
  • 4