neulab/docprompting-conala huggingface dataset:
tf.compat.v1.train.generate_checkpoint_state_proto Generates a checkpoint state proto. 
tf.compat.v1.train.generate_checkpoint_state_proto(
    save_dir, model_checkpoint_path, all_model_checkpoint_paths=None,
    all_model_checkpoint_timestamps=None, last_preserved_timestamp=None
)

 


 Args
  save_dir   Directory where the model was saved.  
  model_checkpoint_path   The checkpoint file.  
  all_model_checkpoint_paths   List of strings. Paths to all not-yet-deleted checkpoints, sorted from oldest to newest. If this is a non-empty list, the last element must be equal to model_checkpoint_path. These paths are also saved in the CheckpointState proto.  
  all_model_checkpoint_timestamps   A list of floats, indicating the number of seconds since the Epoch when each checkpoint was generated.  
  last_preserved_timestamp   A float, indicating the number of seconds since the Epoch when the last preserved checkpoint was written, e.g. due to a keep_checkpoint_every_n_hours parameter (see tf.train.CheckpointManager for an implementation).   
 


 Returns   CheckpointState proto with model_checkpoint_path and all_model_checkpoint_paths updated to either absolute paths or relative paths to the current save_dir.  

 


 Raises
  ValueError   If all_model_checkpoint_timestamps was provided but its length does not match all_model_checkpoint_paths.
tf.compat.v1.train.get_checkpoint_mtimes Returns the mtimes (modification timestamps) of the checkpoints. (deprecated) 
tf.compat.v1.train.get_checkpoint_mtimes(
    checkpoint_prefixes
)
 Warning: THIS FUNCTION IS DEPRECATED. It will be removed in a future version. Instructions for updating: Use standard file utilities to get mtimes. Globs for the checkpoints pointed to by checkpoint_prefixes. If the files exist, collect their mtime. Both V2 and V1 checkpoints are considered, in that priority. This is the recommended way to get the mtimes, since it takes into account the naming difference between V1 and V2 formats. 
Note: If not all checkpoints exist, the length of the returned mtimes list will be smaller than the length of checkpoint_prefixes list, so mapping checkpoints to corresponding mtimes will not be possible.

 


 Args
  checkpoint_prefixes   a list of checkpoint paths, typically the results of Saver.save() or those of tf.train.latest_checkpoint(), regardless of sharded/non-sharded or V1/V2.   
 


 Returns   A list of mtimes (in microseconds) of the found checkpoints.
tf.compat.v1.train.get_global_step Get the global step tensor. 
tf.compat.v1.train.get_global_step(
    graph=None
)
 The global step tensor must be an integer variable. We first try to find it in the collection GLOBAL_STEP, or by name global_step:0.
 


 Args
  graph   The graph to find the global step in. If missing, use default graph.   
 


 Returns   The global step variable, or None if none was found.  

 


 Raises
  TypeError   If the global step tensor has a non-integer type, or if it is not a Variable.
tf.compat.v1.train.get_or_create_global_step Returns and create (if necessary) the global step tensor. 
tf.compat.v1.train.get_or_create_global_step(
    graph=None
)

 


 Args
  graph   The graph in which to create the global step tensor. If missing, use default graph.   
 


 Returns   The global step tensor.
tf.compat.v1.train.global_step Small helper to get the global step. 
tf.compat.v1.train.global_step(
    sess, global_step_tensor
)
 # Create a variable to hold the global_step.
global_step_tensor = tf.Variable(10, trainable=False, name='global_step')
# Create a session.
sess = tf.compat.v1.Session()
# Initialize the variable
sess.run(global_step_tensor.initializer)
# Get the variable value.
print('global_step: %s' % tf.compat.v1.train.global_step(sess,
global_step_tensor))

global_step: 10

 


 Args
  sess   A TensorFlow Session object.  
  global_step_tensor   Tensor or the name of the operation that contains the global step.   
 


 Returns   The global step value.
tf.compat.v1.train.input_producer Output the rows of input_tensor to a queue for an input pipeline. (deprecated) 
tf.compat.v1.train.input_producer(
    input_tensor, element_shape=None, num_epochs=None, shuffle=True, seed=None,
    capacity=32, shared_name=None, summary_name=None, name=None, cancel_op=None
)
 Warning: THIS FUNCTION IS DEPRECATED. It will be removed in a future version. Instructions for updating: Queue-based input pipelines have been replaced by tf.data. Use tf.data.Dataset.from_tensor_slices(input_tensor).shuffle(tf.shape(input_tensor, out_type=tf.int64)[0]).repeat(num_epochs). If shuffle=False, omit the .shuffle(...).
Note: if num_epochs is not None, this function creates local counter epochs. Use local_variables_initializer() to initialize local variables.

 


 Args
  input_tensor   A tensor with the rows to produce. Must be at least one-dimensional. Must either have a fully-defined shape, or element_shape must be defined.  
  element_shape   (Optional.) A TensorShape representing the shape of a row of input_tensor, if it cannot be inferred.  
  num_epochs   (Optional.) An integer. If specified input_producer produces each row of input_tensor num_epochs times before generating an OutOfRange error. If not specified, input_producer can cycle through the rows of input_tensor an unlimited number of times.  
  shuffle   (Optional.) A boolean. If true, the rows are randomly shuffled within each epoch.  
  seed   (Optional.) An integer. The seed to use if shuffle is true.  
  capacity   (Optional.) The capacity of the queue to be used for buffering the input.  
  shared_name   (Optional.) If set, this queue will be shared under the given name across multiple sessions.  
  summary_name   (Optional.) If set, a scalar summary for the current queue size will be generated, using this name as part of the tag.  
  name   (Optional.) A name for queue.  
  cancel_op   (Optional.) Cancel op for the queue   
 


 Returns   A queue with the output rows. A QueueRunner for the queue is added to the current QUEUE_RUNNER collection of the current graph.  

 


 Raises
  ValueError   If the shape of the input cannot be inferred from the arguments.  
  RuntimeError   If called with eager execution enabled.    Eager Compatibility Input pipelines based on Queues are not supported when eager execution is enabled. Please use the tf.data API to ingest data under eager execution.
tf.compat.v1.train.inverse_time_decay Applies inverse time decay to the initial learning rate. 
tf.compat.v1.train.inverse_time_decay(
    learning_rate, global_step, decay_steps, decay_rate, staircase=False, name=None
)
 When training a model, it is often recommended to lower the learning rate as the training progresses. This function applies an inverse decay function to a provided initial learning rate. It requires an global_step value to compute the decayed learning rate. You can just pass a TensorFlow variable that you increment at each training step. The function returns the decayed learning rate. It is computed as: decayed_learning_rate = learning_rate / (1 + decay_rate * global_step /
decay_step)
 or, if staircase is True, as: decayed_learning_rate = learning_rate / (1 + decay_rate * floor(global_step /
decay_step))
 Example: decay 1/t with a rate of 0.5: ...
global_step = tf.Variable(0, trainable=False)
learning_rate = 0.1
decay_steps = 1.0
decay_rate = 0.5
learning_rate = tf.compat.v1.train.inverse_time_decay(learning_rate,
global_step,
decay_steps, decay_rate)

# Passing global_step to minimize() will increment it at each step.
learning_step = (
    tf.compat.v1.train.GradientDescentOptimizer(learning_rate)
    .minimize(...my loss..., global_step=global_step)
)

 


 Args
  learning_rate   A scalar float32 or float64 Tensor or a Python number. The initial learning rate.  
  global_step   A Python number. Global step to use for the decay computation. Must not be negative.  
  decay_steps   How often to apply decay.  
  decay_rate   A Python number. The decay rate.  
  staircase   Whether to apply decay in a discrete staircase, as opposed to continuous, fashion.  
  name   String. Optional name of the operation. Defaults to 'InverseTimeDecay'.   
 


 Returns   A scalar Tensor of the same type as learning_rate. The decayed learning rate.  

 


 Raises
  ValueError   if global_step is not supplied.    Eager Compatibility When eager execution is enabled, this function returns a function which in turn returns the decayed learning rate Tensor. This can be useful for changing the learning rate value across different invocations of optimizer functions.
tf.compat.v1.train.limit_epochs Returns tensor num_epochs times and then raises an OutOfRange error. (deprecated) 
tf.compat.v1.train.limit_epochs(
    tensor, num_epochs=None, name=None
)
 Warning: THIS FUNCTION IS DEPRECATED. It will be removed in a future version. Instructions for updating: Queue-based input pipelines have been replaced by tf.data. Use tf.data.Dataset.from_tensors(tensor).repeat(num_epochs).
Note: creates local counter epochs. Use local_variables_initializer() to initialize local variables.

 


 Args
  tensor   Any Tensor.  
  num_epochs   A positive integer (optional). If specified, limits the number of steps the output tensor may be evaluated.  
  name   A name for the operations (optional).   
 


 Returns   tensor or OutOfRange.  

 


 Raises
  ValueError   if num_epochs is invalid.
tf.compat.v1.train.linear_cosine_decay Applies linear cosine decay to the learning rate. 
tf.compat.v1.train.linear_cosine_decay(
    learning_rate, global_step, decay_steps, num_periods=0.5, alpha=0.0, beta=0.001,
    name=None
)
 Note that linear cosine decay is more aggressive than cosine decay and larger initial learning rates can typically be used. When training a model, it is often recommended to lower the learning rate as the training progresses. This function applies a linear cosine decay function to a provided initial learning rate. It requires a global_step value to compute the decayed learning rate. You can just pass a TensorFlow variable that you increment at each training step. The function returns the decayed learning rate. It is computed as: global_step = min(global_step, decay_steps)
linear_decay = (decay_steps - global_step) / decay_steps)
cosine_decay = 0.5 * (
    1 + cos(pi * 2 * num_periods * global_step / decay_steps))
decayed = (alpha + linear_decay) * cosine_decay + beta
decayed_learning_rate = learning_rate * decayed
 Example usage: decay_steps = 1000
lr_decayed = linear_cosine_decay(learning_rate, global_step, decay_steps)

 


 Args
  learning_rate   A scalar float32 or float64 Tensor or a Python number. The initial learning rate.  
  global_step   A scalar int32 or int64 Tensor or a Python number. Global step to use for the decay computation.  
  decay_steps   A scalar int32 or int64 Tensor or a Python number. Number of steps to decay over.  
  num_periods   Number of periods in the cosine part of the decay. See computation above.  
  alpha   See computation above.  
  beta   See computation above.  
  name   String. Optional name of the operation. Defaults to 'LinearCosineDecay'.   
 


 Returns   A scalar Tensor of the same type as learning_rate. The decayed learning rate.  

 


 Raises
  ValueError   if global_step is not supplied.    References: Neural Optimizer Search with Reinforcement Learning: Bello et al., 2017 (pdf) Stochastic Gradient Descent with Warm Restarts: Loshchilov et al., 2017 (pdf) Eager Compatibility When eager execution is enabled, this function returns a function which in turn returns the decayed learning rate Tensor. This can be useful for changing the learning rate value across different invocations of optimizer functions.
tf.compat.v1.train.maybe_batch Conditionally creates batches of tensors based on keep_input. (deprecated) 
tf.compat.v1.train.maybe_batch(
    tensors, keep_input, batch_size, num_threads=1, capacity=32, enqueue_many=False,
    shapes=None, dynamic_pad=False, allow_smaller_final_batch=False,
    shared_name=None, name=None
)
 Warning: THIS FUNCTION IS DEPRECATED. It will be removed in a future version. Instructions for updating: Queue-based input pipelines have been replaced by tf.data. Use tf.data.Dataset.filter(...).batch(batch_size) (or padded_batch(...) if dynamic_pad=True). See docstring in batch for more details.
 


 Args
  tensors   The list or dictionary of tensors to enqueue.  
  keep_input   A bool Tensor. This tensor controls whether the input is added to the queue or not. If it is a scalar and evaluates True, then tensors are all added to the queue. If it is a vector and enqueue_many is True, then each example is added to the queue only if the corresponding value in keep_input is True. This tensor essentially acts as a filtering mechanism.  
  batch_size   The new batch size pulled from the queue.  
  num_threads   The number of threads enqueuing tensors. The batching will be nondeterministic if num_threads > 1.  
  capacity   An integer. The maximum number of elements in the queue.  
  enqueue_many   Whether each tensor in tensors is a single example.  
  shapes   (Optional) The shapes for each example. Defaults to the inferred shapes for tensors.  
  dynamic_pad   Boolean. Allow variable dimensions in input shapes. The given dimensions are padded upon dequeue so that tensors within a batch have the same shapes.  
  allow_smaller_final_batch   (Optional) Boolean. If True, allow the final batch to be smaller if there are insufficient items left in the queue.  
  shared_name   (Optional). If set, this queue will be shared under the given name across multiple sessions.  
  name   (Optional) A name for the operations.   
 


 Returns   A list or dictionary of tensors with the same types as tensors.  

 


 Raises
  ValueError   If the shapes are not specified, and cannot be inferred from the elements of tensors.
tf.compat.v1.train.maybe_batch_join Runs a list of tensors to conditionally fill a queue to create batches. (deprecated) 
tf.compat.v1.train.maybe_batch_join(
    tensors_list, keep_input, batch_size, capacity=32, enqueue_many=False,
    shapes=None, dynamic_pad=False, allow_smaller_final_batch=False,
    shared_name=None, name=None
)
 Warning: THIS FUNCTION IS DEPRECATED. It will be removed in a future version. Instructions for updating: Queue-based input pipelines have been replaced by tf.data. Use tf.data.Dataset.interleave(...).filter(...).batch(batch_size) (or padded_batch(...) if dynamic_pad=True). See docstring in batch_join for more details.
 


 Args
  tensors_list   A list of tuples or dictionaries of tensors to enqueue.  
  keep_input   A bool Tensor. This tensor controls whether the input is added to the queue or not. If it is a scalar and evaluates True, then tensors are all added to the queue. If it is a vector and enqueue_many is True, then each example is added to the queue only if the corresponding value in keep_input is True. This tensor essentially acts as a filtering mechanism.  
  batch_size   An integer. The new batch size pulled from the queue.  
  capacity   An integer. The maximum number of elements in the queue.  
  enqueue_many   Whether each tensor in tensor_list_list is a single example.  
  shapes   (Optional) The shapes for each example. Defaults to the inferred shapes for tensor_list_list[i].  
  dynamic_pad   Boolean. Allow variable dimensions in input shapes. The given dimensions are padded upon dequeue so that tensors within a batch have the same shapes.  
  allow_smaller_final_batch   (Optional) Boolean. If True, allow the final batch to be smaller if there are insufficient items left in the queue.  
  shared_name   (Optional) If set, this queue will be shared under the given name across multiple sessions.  
  name   (Optional) A name for the operations.   
 


 Returns   A list or dictionary of tensors with the same number and types as tensors_list[i].  

 


 Raises
  ValueError   If the shapes are not specified, and cannot be inferred from the elements of tensor_list_list.
tf.compat.v1.train.maybe_shuffle_batch Creates batches by randomly shuffling conditionally-enqueued tensors. (deprecated) 
tf.compat.v1.train.maybe_shuffle_batch(
    tensors, batch_size, capacity, min_after_dequeue, keep_input, num_threads=1,
    seed=None, enqueue_many=False, shapes=None, allow_smaller_final_batch=False,
    shared_name=None, name=None
)
 Warning: THIS FUNCTION IS DEPRECATED. It will be removed in a future version. Instructions for updating: Queue-based input pipelines have been replaced by tf.data. Use tf.data.Dataset.filter(...).shuffle(min_after_dequeue).batch(batch_size). See docstring in shuffle_batch for more details.
 


 Args
  tensors   The list or dictionary of tensors to enqueue.  
  batch_size   The new batch size pulled from the queue.  
  capacity   An integer. The maximum number of elements in the queue.  
  min_after_dequeue   Minimum number elements in the queue after a dequeue, used to ensure a level of mixing of elements.  
  keep_input   A bool Tensor. This tensor controls whether the input is added to the queue or not. If it is a scalar and evaluates True, then tensors are all added to the queue. If it is a vector and enqueue_many is True, then each example is added to the queue only if the corresponding value in keep_input is True. This tensor essentially acts as a filtering mechanism.  
  num_threads   The number of threads enqueuing tensor_list.  
  seed   Seed for the random shuffling within the queue.  
  enqueue_many   Whether each tensor in tensor_list is a single example.  
  shapes   (Optional) The shapes for each example. Defaults to the inferred shapes for tensor_list.  
  allow_smaller_final_batch   (Optional) Boolean. If True, allow the final batch to be smaller if there are insufficient items left in the queue.  
  shared_name   (Optional) If set, this queue will be shared under the given name across multiple sessions.  
  name   (Optional) A name for the operations.   
 


 Returns   A list or dictionary of tensors with the types as tensors.  

 


 Raises
  ValueError   If the shapes are not specified, and cannot be inferred from the elements of tensors.    Eager Compatibility Input pipelines based on Queues are not supported when eager execution is enabled. Please use the tf.data API to ingest data under eager execution.
tf.compat.v1.train.maybe_shuffle_batch_join Create batches by randomly shuffling conditionally-enqueued tensors. (deprecated) 
tf.compat.v1.train.maybe_shuffle_batch_join(
    tensors_list, batch_size, capacity, min_after_dequeue, keep_input, seed=None,
    enqueue_many=False, shapes=None, allow_smaller_final_batch=False,
    shared_name=None, name=None
)
 Warning: THIS FUNCTION IS DEPRECATED. It will be removed in a future version. Instructions for updating: Queue-based input pipelines have been replaced by tf.data. Use tf.data.Dataset.interleave(...).filter(...).shuffle(min_after_dequeue).batch(batch_size). See docstring in shuffle_batch_join for more details.
 


 Args
  tensors_list   A list of tuples or dictionaries of tensors to enqueue.  
  batch_size   An integer. The new batch size pulled from the queue.  
  capacity   An integer. The maximum number of elements in the queue.  
  min_after_dequeue   Minimum number elements in the queue after a dequeue, used to ensure a level of mixing of elements.  
  keep_input   A bool Tensor. This tensor controls whether the input is added to the queue or not. If it is a scalar and evaluates True, then tensors are all added to the queue. If it is a vector and enqueue_many is True, then each example is added to the queue only if the corresponding value in keep_input is True. This tensor essentially acts as a filtering mechanism.  
  seed   Seed for the random shuffling within the queue.  
  enqueue_many   Whether each tensor in tensor_list_list is a single example.  
  shapes   (Optional) The shapes for each example. Defaults to the inferred shapes for tensors_list[i].  
  allow_smaller_final_batch   (Optional) Boolean. If True, allow the final batch to be smaller if there are insufficient items left in the queue.  
  shared_name   (optional). If set, this queue will be shared under the given name across multiple sessions.  
  name   (Optional) A name for the operations.   
 


 Returns   A list or dictionary of tensors with the same number and types as tensors_list[i].  

 


 Raises
  ValueError   If the shapes are not specified, and cannot be inferred from the elements of tensors_list.    Eager Compatibility Input pipelines based on Queues are not supported when eager execution is enabled. Please use the tf.data API to ingest data under eager execution.
tf.compat.v1.train.MonitoredSession.StepContext Control flow instrument for the step_fn from run_step_fn().  View aliases  Compat aliases for migration 
See Migration guide for more details. tf.compat.v1.train.SingularMonitoredSession.StepContext  
tf.compat.v1.train.MonitoredSession.StepContext(
    session, run_with_hooks_fn
)
 Users of step_fn may perform run() calls without running hooks by accessing the session. A run() call with hooks may be performed using run_with_hooks(). Computation flow can be interrupted using request_stop().
 


 Args
  session   An instance of tf.compat.v1.Session.  
  run_with_hooks_fn   A function for running fetches and hooks.   
 


 Attributes
  session  
   Methods request_stop View source 
request_stop()
 Exit the training loop by causing should_stop() to return True. Causes step_fn to exit by raising an exception.
 


 Raises   StopIteration  
 run_with_hooks View source 
run_with_hooks(
    *args, **kwargs
)
 Same as MonitoredSession.run. Accepts the same arguments.
tf.compat.v1.train.natural_exp_decay Applies natural exponential decay to the initial learning rate. 
tf.compat.v1.train.natural_exp_decay(
    learning_rate, global_step, decay_steps, decay_rate, staircase=False, name=None
)
 When training a model, it is often recommended to lower the learning rate as the training progresses. This function applies an exponential decay function to a provided initial learning rate. It requires an global_step value to compute the decayed learning rate. You can just pass a TensorFlow variable that you increment at each training step. The function returns the decayed learning rate. It is computed as: decayed_learning_rate = learning_rate * exp(-decay_rate * global_step /
decay_step)
 or, if staircase is True, as: decayed_learning_rate = learning_rate * exp(-decay_rate * floor(global_step /
decay_step))
 Example: decay exponentially with a base of 0.96: ...
global_step = tf.Variable(0, trainable=False)
learning_rate = 0.1
decay_steps = 5
k = 0.5
learning_rate = tf.compat.v1.train.natural_exp_decay(learning_rate,
global_step,
                                           decay_steps, k)

# Passing global_step to minimize() will increment it at each step.
learning_step = (
    tf.compat.v1.train.GradientDescentOptimizer(learning_rate)
    .minimize(...my loss..., global_step=global_step)
)

 


 Args
  learning_rate   A scalar float32 or float64 Tensor or a Python number. The initial learning rate.  
  global_step   A Python number. Global step to use for the decay computation. Must not be negative.  
  decay_steps   How often to apply decay.  
  decay_rate   A Python number. The decay rate.  
  staircase   Whether to apply decay in a discrete staircase, as opposed to continuous, fashion.  
  name   String. Optional name of the operation. Defaults to 'ExponentialTimeDecay'.   
 


 Returns   A scalar Tensor of the same type as learning_rate. The decayed learning rate.  

 


 Raises
  ValueError   if global_step is not supplied.    Eager Compatibility When eager execution is enabled, this function returns a function which in turn returns the decayed learning rate Tensor. This can be useful for changing the learning rate value across different invocations of optimizer functions.
tf.compat.v1.train.NewCheckpointReader A function that returns a CheckPointReader. 
tf.compat.v1.train.NewCheckpointReader(
    filepattern
)

 


 Args
  filepattern   The filename.   
 


 Returns   A CheckpointReader object.