neulab/docprompting-conala huggingface dataset:
torch.distributed.scatter_object_list(scatter_object_output_list, scatter_object_input_list, src=0, group=None) [source]
 
Scatters picklable objects in scatter_object_input_list to the whole group. Similar to scatter(), but Python objects can be passed in. On each rank, the scattered object will be stored as the first element of scatter_object_output_list. Note that all objects in scatter_object_input_list must be picklable in order to be scattered.  Parameters 
 
scatter_object_output_list (List[Any]) – Non-empty list whose first element will store the object scattered to this rank. 
scatter_object_input_list (List[Any]) – List of input objects to scatter. Each object must be picklable. Only objects on the src rank will be scattered, and the argument can be None for non-src ranks. 
src (int) – Source rank from which to scatter scatter_object_input_list. 
group – (ProcessGroup, optional): The process group to work on. If None, the default process group will be used. Default is None.   Returns 
None. If rank is part of the group, scatter_object_output_list will have its first element set to the scattered object for this rank.    Note Note that this API differs slightly from the scatter collective since it does not provide an async_op handle and thus will be a blocking call.   Warning scatter_object_list() uses pickle module implicitly, which is known to be insecure. It is possible to construct malicious pickle data which will execute arbitrary code during unpickling. Only call this function with data you trust.   Example::

>>> # Note: Process group initialization omitted on each rank.
>>> import torch.distributed as dist
>>> if dist.get_rank() == 0:
>>>     # Assumes world_size of 3.
>>>     objects = ["foo", 12, {1: 2}] # any picklable object
>>> else:
>>>     # Can be any list on non-src ranks, elements are not used.
>>>     objects = [None, None, None]
>>> output_list = [None]
>>> dist.scatter_object_list(output_list, objects, src=0)
>>> # Rank i gets objects[i]. For example, on rank 2:
>>> output_list
[{1: 2}]
torch.distributed.send(tensor, dst, group=None, tag=0) [source]
 
Sends a tensor synchronously.  Parameters 
 
tensor (Tensor) – Tensor to send. 
dst (int) – Destination rank. 
group (ProcessGroup, optional) – The process group to work on. If None, the default process group will be used. 
tag (int, optional) – Tag to match send with remote recv
class torch.distributed.Store  
Base class for all store implementations, such as the 3 provided by PyTorch distributed: (TCPStore, FileStore, and HashStore).
torch.distributed.Store.add(self: torch._C._distributed_c10d.Store, arg0: str, arg1: int) → int  
The first call to add for a given key creates a counter associated with key in the store, initialized to amount. Subsequent calls to add with the same key increment the counter by the specified amount. Calling add() with a key that has already been set in the store by set() will result in an exception.  Parameters 
 
key (str) – The key in the store whose counter will be incremented. 
amount (int) – The quantity by which the counter will be incremented.     Example::

>>> import torch.distributed as dist
>>> from datetime import timedelta
>>> # Using TCPStore as an example, other store types can also be used
>>> store = dist.TCPStore("127.0.0.1", 0, 1, True, timedelta(seconds=30))
>>> store.add("first_key", 1)
>>> store.add("first_key", 6)
>>> # Should return 7
>>> store.get("first_key")
torch.distributed.Store.delete_key(self: torch._C._distributed_c10d.Store, arg0: str) → bool  
Deletes the key-value pair associated with key from the store. Returns true if the key was successfully deleted, and false if it was not.  Warning The delete_key API is only supported by the TCPStore and HashStore. Using this API with the FileStore will result in an exception.   Parameters 
key (str) – The key to be deleted from the store  Returns 
True if key was deleted, otherwise False.    Example::

>>> import torch.distributed as dist
>>> from datetime import timedelta
>>> # Using TCPStore as an example, HashStore can also be used
>>> store = dist.TCPStore("127.0.0.1", 0, 1, True, timedelta(seconds=30))
>>> store.set("first_key")
>>> # This should return true
>>> store.delete_key("first_key")
>>> # This should return false
>>> store.delete_key("bad_key")
torch.distributed.Store.get(self: torch._C._distributed_c10d.Store, arg0: str) → bytes  
Retrieves the value associated with the given key in the store. If key is not present in the store, the function will wait for timeout, which is defined when initializing the store, before throwing an exception.  Parameters 
key (str) – The function will return the value associated with this key.  Returns 
Value associated with key if key is in the store.    Example::

>>> import torch.distributed as dist
>>> from datetime import timedelta
>>> store = dist.TCPStore("127.0.0.1", 0, 1, True, timedelta(seconds=30))
>>> store.set("first_key", "first_value")
>>> # Should return "first_value"
>>> store.get("first_key")
torch.distributed.Store.num_keys(self: torch._C._distributed_c10d.Store) → int  
Returns the number of keys set in the store. Note that this number will typically be one greater than the number of keys added by set() and add() since one key is used to coordinate all the workers using the store.  Warning When used with the TCPStore, num_keys returns the number of keys written to the underlying file. If the store is destructed and another store is created with the same file, the original keys will be retained.   Returns 
The number of keys present in the store.    Example::

>>> import torch.distributed as dist
>>> from datetime import timedelta
>>> # Using TCPStore as an example, other store types can also be used
>>> store = dist.TCPStore("127.0.0.1", 0, 1, True, timedelta(seconds=30))
>>> store.set("first_key", "first_value")
>>> # This should return 2
>>> store.num_keys()
torch.distributed.Store.set(self: torch._C._distributed_c10d.Store, arg0: str, arg1: str) → None  
Inserts the key-value pair into the store based on the supplied key and value. If key already exists in the store, it will overwrite the old value with the new supplied value.  Parameters 
 
key (str) – The key to be added to the store. 
value (str) – The value associated with key to be added to the store.     Example::

>>> import torch.distributed as dist
>>> from datetime import timedelta
>>> store = dist.TCPStore("127.0.0.1", 0, 1, True, timedelta(seconds=30))
>>> store.set("first_key", "first_value")
>>> # Should return "first_value"
>>> store.get("first_key")
torch.distributed.Store.set_timeout(self: torch._C._distributed_c10d.Store, arg0: datetime.timedelta) → None  
Sets the store’s default timeout. This timeout is used during initialization and in wait() and get().  Parameters 
timeout (timedelta) – timeout to be set in the store.    Example::

>>> import torch.distributed as dist
>>> from datetime import timedelta
>>> # Using TCPStore as an example, other store types can also be used
>>> store = dist.TCPStore("127.0.0.1", 0, 1, True, timedelta(seconds=30))
>>> store.set_timeout(timedelta(seconds=10))
>>> # This will throw an exception after 10 seconds
>>> store.wait(["bad_key"])
torch.distributed.Store.wait(*args, **kwargs)  
Overloaded function.  wait(self: torch._C._distributed_c10d.Store, arg0: List[str]) -> None  Waits for each key in keys to be added to the store. If not all keys are set before the timeout (set during store initialization), then wait will throw an exception.  Parameters 
keys (list) – List of keys on which to wait until they are set in the store.    Example::

>>> import torch.distributed as dist
>>> from datetime import timedelta
>>> # Using TCPStore as an example, other store types can also be used
>>> store = dist.TCPStore("127.0.0.1", 0, 1, True, timedelta(seconds=30))
>>> # This will throw an exception after 30 seconds
>>> store.wait(["bad_key"])
    wait(self: torch._C._distributed_c10d.Store, arg0: List[str], arg1: datetime.timedelta) -> None  Waits for each key in keys to be added to the store, and throws an exception if the keys have not been set by the supplied timeout.  Parameters 
 
keys (list) – List of keys on which to wait until they are set in the store. 
timeout (timedelta) – Time to wait for the keys to be added before throwing an exception.     Example::

>>> import torch.distributed as dist
>>> from datetime import timedelta
>>> # Using TCPStore as an example, other store types can also be used
>>> store = dist.TCPStore("127.0.0.1", 0, 1, True, timedelta(seconds=30))
>>> # This will throw an exception after 10 seconds
>>> store.wait(["bad_key"], timedelta(seconds=10))
class torch.distributed.TCPStore  
A TCP-based distributed key-value store implementation. The server store holds the data, while the client stores can connect to the server store over TCP and perform actions such as set() to insert a key-value pair, get() to retrieve a key-value pair, etc.  Parameters 
 
host_name (str) – The hostname or IP Address the server store should run on. 
port (int) – The port on which the server store should listen for incoming requests. 
world_size (int) – The total number of store users (number of clients + 1 for the server). 
is_master (bool) – True when initializing the server store, False for client stores. 
timeout (timedelta) – Timeout used by the store during initialization and for methods such as get() and wait().     Example::

>>> import torch.distributed as dist
>>> from datetime import timedelta
>>> # Run on process 1 (server)
>>> server_store = dist.TCPStore("127.0.0.1", 1234, 2, True, timedelta(seconds=30))
>>> # Run on process 2 (client)
>>> client_store = dist.TCPStore("127.0.0.1", 1234, 2, False)
>>> # Use any of the store methods from either the client or server after initialization
>>> server_store.set("first_key", "first_value")
>>> client_store.get("first_key")
class torch.distributions.bernoulli.Bernoulli(probs=None, logits=None, validate_args=None) [source]
 
Bases: torch.distributions.exp_family.ExponentialFamily Creates a Bernoulli distribution parameterized by probs or logits (but not both). Samples are binary (0 or 1). They take the value 1 with probability p and 0 with probability 1 - p. Example: >>> m = Bernoulli(torch.tensor([0.3]))
>>> m.sample()  # 30% chance 1; 70% chance 0
tensor([ 0.])
  Parameters 
 
probs (Number, Tensor) – the probability of sampling 1
 
logits (Number, Tensor) – the log-odds of sampling 1
     
arg_constraints = {'logits': Real(), 'probs': Interval(lower_bound=0.0, upper_bound=1.0)} 
  
entropy() [source]

  
enumerate_support(expand=True) [source]

  
expand(batch_shape, _instance=None) [source]

  
has_enumerate_support = True 
  
log_prob(value) [source]

  
logits [source]

  
property mean 
  
property param_shape 
  
probs [source]

  
sample(sample_shape=torch.Size([])) [source]

  
support = Boolean() 
  
property variance
arg_constraints = {'logits': Real(), 'probs': Interval(lower_bound=0.0, upper_bound=1.0)}
class torch.distributions.beta.Beta(concentration1, concentration0, validate_args=None) [source]
 
Bases: torch.distributions.exp_family.ExponentialFamily Beta distribution parameterized by concentration1 and concentration0. Example: >>> m = Beta(torch.tensor([0.5]), torch.tensor([0.5]))
>>> m.sample()  # Beta distributed with concentration concentration1 and concentration0
tensor([ 0.1046])
  Parameters 
 
concentration1 (float or Tensor) – 1st concentration parameter of the distribution (often referred to as alpha) 
concentration0 (float or Tensor) – 2nd concentration parameter of the distribution (often referred to as beta)     
arg_constraints = {'concentration0': GreaterThan(lower_bound=0.0), 'concentration1': GreaterThan(lower_bound=0.0)} 
  
property concentration0 
  
property concentration1 
  
entropy() [source]

  
expand(batch_shape, _instance=None) [source]

  
has_rsample = True 
  
log_prob(value) [source]

  
property mean 
  
rsample(sample_shape=()) [source]

  
support = Interval(lower_bound=0.0, upper_bound=1.0) 
  
property variance
arg_constraints = {'concentration0': GreaterThan(lower_bound=0.0), 'concentration1': GreaterThan(lower_bound=0.0)}
support = Interval(lower_bound=0.0, upper_bound=1.0)
class torch.distributions.binomial.Binomial(total_count=1, probs=None, logits=None, validate_args=None) [source]
 
Bases: torch.distributions.distribution.Distribution Creates a Binomial distribution parameterized by total_count and either probs or logits (but not both). total_count must be broadcastable with probs/logits. Example: >>> m = Binomial(100, torch.tensor([0 , .2, .8, 1]))
>>> x = m.sample()
tensor([   0.,   22.,   71.,  100.])

>>> m = Binomial(torch.tensor([[5.], [10.]]), torch.tensor([0.5, 0.8]))
>>> x = m.sample()
tensor([[ 4.,  5.],
        [ 7.,  6.]])
  Parameters 
 
total_count (int or Tensor) – number of Bernoulli trials 
probs (Tensor) – Event probabilities 
logits (Tensor) – Event log-odds     
arg_constraints = {'logits': Real(), 'probs': Interval(lower_bound=0.0, upper_bound=1.0), 'total_count': IntegerGreaterThan(lower_bound=0)} 
  
enumerate_support(expand=True) [source]

  
expand(batch_shape, _instance=None) [source]

  
has_enumerate_support = True 
  
log_prob(value) [source]

  
logits [source]

  
property mean 
  
property param_shape 
  
probs [source]

  
sample(sample_shape=torch.Size([])) [source]

  
property support 
  
property variance
arg_constraints = {'logits': Real(), 'probs': Interval(lower_bound=0.0, upper_bound=1.0), 'total_count': IntegerGreaterThan(lower_bound=0)}
class torch.distributions.categorical.Categorical(probs=None, logits=None, validate_args=None) [source]
 
Bases: torch.distributions.distribution.Distribution Creates a categorical distribution parameterized by either probs or logits (but not both).  Note It is equivalent to the distribution that torch.multinomial() samples from.  Samples are integers from {0,…,K−1}\{0, \ldots, K-1\}  where K is probs.size(-1). If probs is 1-dimensional with length-K, each element is the relative probability of sampling the class at that index. If probs is N-dimensional, the first N-1 dimensions are treated as a batch of relative probability vectors.  Note The probs argument must be non-negative, finite and have a non-zero sum, and it will be normalized to sum to 1 along the last dimension. attr:probs will return this normalized value. The logits argument will be interpreted as unnormalized log probabilities and can therefore be any real number. It will likewise be normalized so that the resulting probabilities sum to 1 along the last dimension. attr:logits will return this normalized value.  See also: torch.multinomial() Example: >>> m = Categorical(torch.tensor([ 0.25, 0.25, 0.25, 0.25 ]))
>>> m.sample()  # equal probability of 0, 1, 2, 3
tensor(3)
  Parameters 
 
probs (Tensor) – event probabilities 
logits (Tensor) – event log probabilities (unnormalized)     
arg_constraints = {'logits': IndependentConstraint(Real(), 1), 'probs': Simplex()} 
  
entropy() [source]

  
enumerate_support(expand=True) [source]

  
expand(batch_shape, _instance=None) [source]

  
has_enumerate_support = True 
  
log_prob(value) [source]

  
logits [source]

  
property mean 
  
property param_shape 
  
probs [source]

  
sample(sample_shape=torch.Size([])) [source]

  
property support 
  
property variance
arg_constraints = {'logits': IndependentConstraint(Real(), 1), 'probs': Simplex()}
class torch.distributions.cauchy.Cauchy(loc, scale, validate_args=None) [source]
 
Bases: torch.distributions.distribution.Distribution Samples from a Cauchy (Lorentz) distribution. The distribution of the ratio of independent normally distributed random variables with means 0 follows a Cauchy distribution. Example: >>> m = Cauchy(torch.tensor([0.0]), torch.tensor([1.0]))
>>> m.sample()  # sample from a Cauchy distribution with loc=0 and scale=1
tensor([ 2.3214])
  Parameters 
 
loc (float or Tensor) – mode or median of the distribution. 
scale (float or Tensor) – half width at half maximum.     
arg_constraints = {'loc': Real(), 'scale': GreaterThan(lower_bound=0.0)} 
  
cdf(value) [source]

  
entropy() [source]

  
expand(batch_shape, _instance=None) [source]

  
has_rsample = True 
  
icdf(value) [source]

  
log_prob(value) [source]

  
property mean 
  
rsample(sample_shape=torch.Size([])) [source]

  
support = Real() 
  
property variance
arg_constraints = {'loc': Real(), 'scale': GreaterThan(lower_bound=0.0)}
class torch.distributions.chi2.Chi2(df, validate_args=None) [source]
 
Bases: torch.distributions.gamma.Gamma Creates a Chi2 distribution parameterized by shape parameter df. This is exactly equivalent to Gamma(alpha=0.5*df, beta=0.5) Example: >>> m = Chi2(torch.tensor([1.0]))
>>> m.sample()  # Chi2 distributed with shape df=1
tensor([ 0.1046])
  Parameters 
df (float or Tensor) – shape parameter of the distribution    
arg_constraints = {'df': GreaterThan(lower_bound=0.0)} 
  
property df 
  
expand(batch_shape, _instance=None) [source]
arg_constraints = {'df': GreaterThan(lower_bound=0.0)}
class torch.distributions.constraints.Constraint [source]
 
Abstract base class for constraints. A constraint object represents a region over which a variable is valid, e.g. within which a variable can be optimized.  Variables 
 
~Constraint.is_discrete (bool) – Whether constrained space is discrete. Defaults to False. 
~Constraint.event_dim (int) – Number of rightmost dimensions that together define an event. The check() method will remove this many dimensions when computing validity.     
check(value) [source]
 
Returns a byte tensor of sample_shape + batch_shape indicating whether each event in value satisfies this constraint.
check(value) [source]
 
Returns a byte tensor of sample_shape + batch_shape indicating whether each event in value satisfies this constraint.
torch.distributions.constraints.dependent_property  
alias of torch.distributions.constraints._DependentProperty
torch.distributions.constraints.greater_than  
alias of torch.distributions.constraints._GreaterThan
torch.distributions.constraints.greater_than_eq  
alias of torch.distributions.constraints._GreaterThanEq
torch.distributions.constraints.half_open_interval  
alias of torch.distributions.constraints._HalfOpenInterval
torch.distributions.constraints.independent  
alias of torch.distributions.constraints._IndependentConstraint
torch.distributions.constraints.integer_interval  
alias of torch.distributions.constraints._IntegerInterval
torch.distributions.constraints.less_than  
alias of torch.distributions.constraints._LessThan
torch.distributions.constraints.multinomial  
alias of torch.distributions.constraints._Multinomial
class torch.distributions.constraint_registry.ConstraintRegistry [source]
 
Registry to link constraints to transforms.  
register(constraint, factory=None) [source]
 
Registers a Constraint subclass in this registry. Usage: @my_registry.register(MyConstraintClass)
def construct_transform(constraint):
    assert isinstance(constraint, MyConstraint)
    return MyTransform(constraint.arg_constraints)
  Parameters 
 
constraint (subclass of Constraint) – A subclass of Constraint, or a singleton object of the desired class. 
factory (callable) – A callable that inputs a constraint object and returns a Transform object.
register(constraint, factory=None) [source]
 
Registers a Constraint subclass in this registry. Usage: @my_registry.register(MyConstraintClass)
def construct_transform(constraint):
    assert isinstance(constraint, MyConstraint)
    return MyTransform(constraint.arg_constraints)
  Parameters 
 
constraint (subclass of Constraint) – A subclass of Constraint, or a singleton object of the desired class. 
factory (callable) – A callable that inputs a constraint object and returns a Transform object.
class torch.distributions.continuous_bernoulli.ContinuousBernoulli(probs=None, logits=None, lims=(0.499, 0.501), validate_args=None) [source]
 
Bases: torch.distributions.exp_family.ExponentialFamily Creates a continuous Bernoulli distribution parameterized by probs or logits (but not both). The distribution is supported in [0, 1] and parameterized by ‘probs’ (in (0,1)) or ‘logits’ (real-valued). Note that, unlike the Bernoulli, ‘probs’ does not correspond to a probability and ‘logits’ does not correspond to log-odds, but the same names are used due to the similarity with the Bernoulli. See [1] for more details. Example: >>> m = ContinuousBernoulli(torch.tensor([0.3]))
>>> m.sample()
tensor([ 0.2538])
  Parameters 
 
probs (Number, Tensor) – (0,1) valued parameters 
logits (Number, Tensor) – real valued parameters whose sigmoid matches ‘probs’    [1] The continuous Bernoulli: fixing a pervasive error in variational autoencoders, Loaiza-Ganem G and Cunningham JP, NeurIPS 2019. https://arxiv.org/abs/1907.06845  
arg_constraints = {'logits': Real(), 'probs': Interval(lower_bound=0.0, upper_bound=1.0)} 
  
cdf(value) [source]

  
entropy() [source]

  
expand(batch_shape, _instance=None) [source]

  
has_rsample = True 
  
icdf(value) [source]

  
log_prob(value) [source]

  
logits [source]

  
property mean 
  
property param_shape 
  
probs [source]

  
rsample(sample_shape=torch.Size([])) [source]

  
sample(sample_shape=torch.Size([])) [source]

  
property stddev 
  
support = Interval(lower_bound=0.0, upper_bound=1.0) 
  
property variance
class torch.distributions.dirichlet.Dirichlet(concentration, validate_args=None) [source]
 
Bases: torch.distributions.exp_family.ExponentialFamily Creates a Dirichlet distribution parameterized by concentration concentration. Example: >>> m = Dirichlet(torch.tensor([0.5, 0.5]))
>>> m.sample()  # Dirichlet distributed with concentrarion concentration
tensor([ 0.1046,  0.8954])
  Parameters 
concentration (Tensor) – concentration parameter of the distribution (often referred to as alpha)    
arg_constraints = {'concentration': IndependentConstraint(GreaterThan(lower_bound=0.0), 1)} 
  
entropy() [source]

  
expand(batch_shape, _instance=None) [source]

  
has_rsample = True 
  
log_prob(value) [source]

  
property mean 
  
rsample(sample_shape=()) [source]

  
support = Simplex() 
  
property variance
arg_constraints = {'concentration': IndependentConstraint(GreaterThan(lower_bound=0.0), 1)}
property arg_constraints  
Returns a dictionary from argument names to Constraint objects that should be satisfied by each argument of this distribution. Args that are not tensors need not appear in this dict.
cdf(value) [source]
 
Returns the cumulative density/mass function evaluated at value.  Parameters 
value (Tensor) –
entropy() [source]
 
Returns entropy of distribution, batched over batch_shape.  Returns 
Tensor of shape batch_shape.
enumerate_support(expand=True) [source]
 
Returns tensor containing all values supported by a discrete distribution. The result will enumerate over dimension 0, so the shape of the result will be (cardinality,) + batch_shape + event_shape (where event_shape = () for univariate distributions). Note that this enumerates over all batched tensors in lock-step [[0, 0], [1, 1], …]. With expand=False, enumeration happens along dim 0, but with the remaining batch dimensions being singleton dimensions, [[0], [1], ... To iterate over the full Cartesian product use itertools.product(m.enumerate_support()).  Parameters 
expand (bool) – whether to expand the support over the batch dims to match the distribution’s batch_shape.  Returns 
Tensor iterating over dimension 0.
expand(batch_shape, _instance=None) [source]
 
Returns a new distribution instance (or populates an existing instance provided by a derived class) with batch dimensions expanded to batch_shape. This method calls expand on the distribution’s parameters. As such, this does not allocate new memory for the expanded distribution instance. Additionally, this does not repeat any args checking or parameter broadcasting in __init__.py, when an instance is first created.  Parameters 
 
batch_shape (torch.Size) – the desired expanded size. 
_instance – new instance provided by subclasses that need to override .expand.   Returns 
New distribution instance with batch dimensions expanded to batch_size.
icdf(value) [source]
 
Returns the inverse cumulative density/mass function evaluated at value.  Parameters 
value (Tensor) –