inputs
stringlengths
312
52k
targets
stringlengths
1
3.1k
block_type
stringclasses
11 values
scenario
stringclasses
7 values
<filename>camp_zipnerf/internal/geopoly.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # camp_zipnerf/internal/stepfun.py def sample_intervals( rng, t, w_logits, num_samples, single_jitter=False, domain=(-jnp.inf, jnp.inf), ): ...
if remove_symmetries: # Remove elements of `verts` that are reflections of each other. match = compute_sq_dist(verts.T, -verts.T) < eps verts = verts[~np.any(np.triu(match), axis=0), :]
IF
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>camp_zipnerf/internal/coord.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # camp_zipnerf/internal/render.py def gaussianize_frustum(t0, t1): """Convert intervals along a conical frustum into means and variances.""" # A more stable versi...
if fn_inv is None: # A simple mapping from some functions to their inverse. inv_mapping = { 'reciprocal': jnp.reciprocal, 'log': jnp.exp, 'exp': jnp.log, 'sqrt': jnp.square, 'square': jnp.sqrt, } fn_inv = inv_mapping[fn.__name__]
IF
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>camp_zipnerf/internal/geopoly.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # camp_zipnerf/internal/math.py def find_interval(x): # Grab the value where `mask` switches from True to False, and vice versa. # This approach tak...
if mat1 is None: mat1 = mat0
IF
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>camp_zipnerf/internal/math.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # camp_zipnerf/internal/linspline.py def sorted_lookup(x, xp): """Lookup `x` at sorted locations `xp`.""" # jnp.searchsorted() has slightly different conventions f...
if device_is_tpu: # Identify the location in `xp` that corresponds to each `x`. # The final `True` index in `mask` is the start of the matching interval. mask = x[Ellipsis, None, :] >= xp[Ellipsis, :, None] def find_interval(x): # Grab the value where `mask` switches from True to False, and vice ...
IF
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>camp_zipnerf/internal/stepfun.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # camp_zipnerf/internal/linspline.py def compute_integral(t, y): """Integrate a linear spline into a piecewise quadratic spline.""" utils.assert_valid_linspline...
wq = jnp.diff(acc_wq, axis=-1)
STATEMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>camp_zipnerf/internal/geopoly.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # camp_zipnerf/internal/quaternion.py def from_axis_angle( axis_angle, eps = jnp.finfo(jnp.float32).eps ): """Constructs a quaternion for the given axis/angle...
new_verts /= np.sqrt(np.sum(new_verts**2, 1, keepdims=True))
STATEMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>camp_zipnerf/internal/stepfun.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # camp_zipnerf/internal/math.py def log_lerp(t, v0, v1): """Interpolate log-linearly from `v0` (t=0) to `v1` (t=1).""" if v0 <= 0 or v1 <= 0: raise ValueErr...
return t_new
STATEMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>camp_zipnerf/internal/linspline.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # camp_zipnerf/internal/stepfun.py def blur_and_resample_weights(tq, t, w, blur_halfwidth): """Blur the (t, w) histogram by blur_halfwidth, then resample it int...
c = jnp.concatenate([jnp.zeros_like(y[Ellipsis, :1]), c1], axis=-1)
STATEMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>camp_zipnerf/internal/math.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # camp_zipnerf/internal/coord.py def expected_sin(mean, var): """Compute the mean of sin(x), x ~ N(mean, var).""" return jnp.exp(-0.5 * var) * math.safe_sin(mean) ...
return safe_trig_helper(x, jnp.sin)
STATEMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>camp_zipnerf/internal/coord.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # camp_zipnerf/internal/render.py def gaussianize_frustum(t0, t1): """Convert intervals along a conical frustum into means and variances.""" # A more stable versi...
return z
STATEMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>camp_zipnerf/internal/math.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # camp_zipnerf/internal/linspline.py def sorted_lookup(x, xp): """Lookup `x` at sorted locations `xp`.""" # jnp.searchsorted() has slightly different conventions f...
vals = []
STATEMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>camp_zipnerf/internal/ref_utils.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # camp_zipnerf/internal/geometry.py def spherical_to_cartesian( r, theta, phi, ): """Converts spherical to cartesian coordinates. For more detail...
ide = sph_harms * jnp.exp(-sigma * kappa_inv)
STATEMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>camp_zipnerf/internal/ref_utils.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # camp_zipnerf/internal/geometry.py def spherical_to_cartesian( r, theta, phi, ): """Converts spherical to cartesian coordinates. For more detail...
vmz = jnp.concatenate([z**i for i in range(mat.shape[0])], axis=-1)
STATEMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>camp_zipnerf/internal/coord.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # camp_zipnerf/internal/render.py def lift_gaussian(d, t_mean, t_var, r_var, diag): """Lift a Gaussian defined along a ray to 3D coordinates.""" mean = d[Ellipsis...
z_mag_sq = jnp.maximum(1, jnp.sum(z**2, axis=-1, keepdims=True))
STATEMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>camp_zipnerf/internal/utils.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # camp_zipnerf/internal/datasets.py def __init__(self, dataset: Dataset): super().__init__() self._queue = queue.Queue(3) # Set prefetch buffer to 3 batch...
# Thread exception will be raised here
LINE_COMMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>camp_zipnerf/internal/stepfun.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # camp_zipnerf/internal/utils.py def assert_valid_stepfun(t, y): """Assert that step function (t, y) has a valid shape.""" if t.shape[-1] != y.shape[-1] + 1: ...
# Sample a set of points from the step function.
LINE_COMMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>camp_zipnerf/internal/ref_utils.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # camp_zipnerf/internal/geometry.py def spherical_to_cartesian( r, theta, phi, ): """Converts spherical to cartesian coordinates. For more detail...
# concentration parameter, kappa.
LINE_COMMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>camp_zipnerf/internal/stepfun.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # camp_zipnerf/internal/geopoly.py def compute_sq_dist(mat0, mat1=None): """Compute the squared Euclidean distance between all pairs of columns.""" if mat1 is N...
# The loss incurred within each individual interval with itself.
LINE_COMMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>camp_zipnerf/internal/linspline.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # camp_zipnerf/internal/rigid_body.py def exp_so3( axis_angle, eps=jnp.finfo(jnp.float32).eps ): """Exponential map from Lie algebra so3 to Lie group SO3. ...
# Dilate the t-values by at least numerical epsilon in each direction.
LINE_COMMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>camp_zipnerf/internal/geopoly.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # camp_zipnerf/internal/math.py def log_lerp(t, v0, v1): """Interpolate log-linearly from `v0` (t=0) to `v1` (t=1).""" if v0 <= 0 or v1 <= 0: raise ValueErr...
# Barycentric weights.
LINE_COMMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>camp_zipnerf/internal/coord.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # camp_zipnerf/internal/spin_math.py def safe_sqrt(x, *, eps = jnp.finfo(jnp.float32).eps, value_at_zero = 0.0): """A safe...
# Guard against NaN outputs when `det` is super small. Note that this does not
LINE_COMMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>camp_zipnerf/internal/stepfun.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # camp_zipnerf/internal/geopoly.py def compute_sq_dist(mat0, mat1=None): """Compute the squared Euclidean distance between all pairs of columns.""" if mat1 is N...
# The loss incurred between all pairs of intervals.
LINE_COMMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>camp_zipnerf/internal/math.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # camp_zipnerf/internal/linspline.py def sorted_lookup(x, xp): """Lookup `x` at sorted locations `xp`.""" # jnp.searchsorted() has slightly different conventions f...
# jnp.searchsorted() has slightly different conventions for boundary
LINE_COMMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>camp_zipnerf/internal/utils.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # camp_zipnerf/internal/datasets.py def __init__(self, dataset: Dataset): super().__init__() self._queue = queue.Queue(3) # Set prefetch buffer to 3 batch...
# iterations
LINE_COMMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>camp_zipnerf/internal/geopoly.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # camp_zipnerf/internal/math.py def log_lerp(t, v0, v1): """Interpolate log-linearly from `v0` (t=0) to `v1` (t=1).""" if v0 <= 0 or v1 <= 0: raise ValueErr...
for i in range(v + 1): for j in range(v + 1 - i): int_weights.append((i, j, v - (i + j)))
FOR
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>camp_zipnerf/internal/ref_utils.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # camp_zipnerf/internal/geopoly.py def compute_tesselation_weights(v): """Tesselate the vertices of a triangle by a factor of `v`.""" if v < 1: raise Valu...
for i in range(deg_view): l = 2**i # Only use nonnegative m values, later splitting real and imaginary parts. for m in range(l + 1): ml_list.append((m, l))
FOR
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>camp_zipnerf/internal/geopoly.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # camp_zipnerf/internal/math.py def log_lerp(t, v0, v1): """Interpolate log-linearly from `v0` (t=0) to `v1` (t=1).""" if v0 <= 0 or v1 <= 0: raise ValueErr...
for j in range(v + 1 - i): int_weights.append((i, j, v - (i + j)))
FOR
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>camp_zipnerf/internal/utils.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # camp_zipnerf/internal/datasets.py def __init__(self, dataset: Dataset): super().__init__() self._queue = queue.Queue(3) # Set prefetch buffer to 3 batch...
for item in fn(*args, **kwargs): results_queue.put(item)
FOR
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>camp_zipnerf/internal/ref_utils.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # camp_zipnerf/internal/camera_utils.py def identify_file_indices( dir_or_text_file, file_names ): """Computes indices for a subset of files out of a larger...
for k in range(l - m + 1): mat[k, i] = sph_harm_coeff(l, m, k)
FOR
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>camp_zipnerf/internal/math.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # camp_zipnerf/internal/linspline.py def sorted_lookup(x, xp): """Lookup `x` at sorted locations `xp`.""" # jnp.searchsorted() has slightly different conventions f...
for fp in fps: fp0 = jnp.take_along_axis(fp, idx0, axis=-1) fp1 = jnp.take_along_axis(fp, idx1, axis=-1) vals.append((fp0, fp1))
FOR
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>camp_zipnerf/internal/utils.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # camp_zipnerf/internal/stepfun.py def integrate_weights(w): """Compute the cumulative sum of w, assuming all weight vectors sum to 1. The output's size on the l...
for item in fn(*args, **kwargs): results_queue.put(item)
FOR
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>camp_zipnerf/internal/geopoly.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # camp_zipnerf/internal/quaternion.py def from_axis_angle( axis_angle, eps = jnp.finfo(jnp.float32).eps ): """Constructs a quaternion for the given axis/angle...
for base_face in base_faces: new_verts = np.matmul(tri_weights, base_verts[base_face, :]) new_verts /= np.sqrt(np.sum(new_verts**2, 1, keepdims=True)) verts.append(new_verts)
FOR
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>camp_zipnerf/internal/ref_utils.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # camp_zipnerf/internal/geopoly.py def compute_tesselation_weights(v): """Tesselate the vertices of a triangle by a factor of `v`.""" if v < 1: raise Valu...
for m in range(l + 1): ml_list.append((m, l))
FOR
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>camp_zipnerf/internal/utils.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # camp_zipnerf/internal/datasets.py def __init__(self, dataset: Dataset): super().__init__() self._queue = queue.Queue(3) # Set prefetch buffer to 3 batch...
for item in fn(*args, **kwargs): results_queue.put(item)
FOR
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>camp_zipnerf/internal/utils.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # camp_zipnerf/internal/stepfun.py def integrate_weights(w): """Compute the cumulative sum of w, assuming all weight vectors sum to 1. The output's size on the l...
def result_fn(*args, **kwargs): results_queue = queue.Queue(queue_size) populating_data = True populating_data_lock = threading.Lock() def thread_fn(): # Mark has_data as a variable that's outside of thread_fn # Otherwise, `populating_data = True` creates a local variable ...
METHOD
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>camp_zipnerf/internal/utils.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # camp_zipnerf/internal/stepfun.py def integrate_weights(w): """Compute the cumulative sum of w, assuming all weight vectors sum to 1. The output's size on the l...
def decorator( fn, ): def result_fn(*args, **kwargs): results_queue = queue.Queue(queue_size) populating_data = True populating_data_lock = threading.Lock() def thread_fn(): # Mark has_data as a variable that's outside of thread_fn # Otherwise, `populating_data = Tru...
METHOD
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>camp_zipnerf/internal/ref_utils.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # camp_zipnerf/internal/spin_math.py def safe_log(x, *, eps = jnp.finfo(jnp.float32).eps, value_at_zero = jnp.finfo(jnp.flo...
def dir_enc_fn(xyz): """Function returning directional encoding (DE).""" return integrated_dir_enc_fn(xyz, jnp.zeros_like(xyz[Ellipsis, :1]))
METHOD
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>camp_zipnerf/internal/ref_utils.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # camp_zipnerf/internal/camera_utils.py def identify_file_indices( dir_or_text_file, file_names ): """Computes indices for a subset of files out of a larger...
def integrated_dir_enc_fn(xyz, kappa_inv): """Function returning integrated directional encoding (IDE). Args: xyz: [..., 3] array of Cartesian coordinates of directions to evaluate at. kappa_inv: [..., 1] reciprocal of the concentration parameter of the von Mises-Fisher distribution. R...
METHOD
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>camp_zipnerf/internal/utils.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # camp_zipnerf/internal/stepfun.py def integrate_weights(w): """Compute the cumulative sum of w, assuming all weight vectors sum to 1. The output's size on the l...
def thread_fn(): # Mark has_data as a variable that's outside of thread_fn # Otherwise, `populating_data = True` creates a local variable nonlocal populating_data try: for item in fn(*args, **kwargs): results_queue.put(item) finally: # Set populati...
METHOD
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>camp_zipnerf/internal/math.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # camp_zipnerf/internal/train_utils.py def summarize_tree(fn, tree, ancestry=(), max_depth=3): """Flatten 'tree' while 'fn'-ing values and formatting keys like/this....
def safe_fn(x): """fn() with clipped inputs.""" return fn(jnp.clip(x, *x_range))
METHOD
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>camp_zipnerf/internal/utils.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # camp_zipnerf/internal/datasets.py def __init__(self, dataset: Dataset): super().__init__() self._queue = queue.Queue(3) # Set prefetch buffer to 3 batch...
def thread_fn(): # Mark has_data as a variable that's outside of thread_fn # Otherwise, `populating_data = True` creates a local variable nonlocal populating_data try: for item in fn(*args, **kwargs): results_queue.put(item) finally: # Set populati...
METHOD
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>camp_zipnerf/internal/utils.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # camp_zipnerf/internal/datasets.py def __init__(self, dataset: Dataset): super().__init__() self._queue = queue.Queue(3) # Set prefetch buffer to 3 batch...
def thread_fn(): # Mark has_data as a variable that's outside of thread_fn # Otherwise, `populating_data = True` creates a local variable nonlocal populating_data try: for item in fn(*args, **kwargs): results_queue.put(item) finally: # Set populati...
METHOD
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>camp_zipnerf/internal/math.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # camp_zipnerf/internal/train_utils.py def summarize_tree(fn, tree, ancestry=(), max_depth=3): """Flatten 'tree' while 'fn'-ing values and formatting keys like/this....
def safe_fn_jvp(primals, tangents): """Backpropagate using the gradient and clipped inputs.""" (x,) = primals (x_dot,) = tangents y = safe_fn(x) y_dot = grad_fn(jnp.clip(x, *x_range), y, x_dot) return y, y_dot
METHOD
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>camp_zipnerf/internal/utils.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # camp_zipnerf/internal/datasets.py def __init__(self, dataset: Dataset): super().__init__() self._queue = queue.Queue(3) # Set prefetch buffer to 3 batch...
def result_fn(*args, **kwargs): results_queue = queue.Queue(queue_size) populating_data = True populating_data_lock = threading.Lock() def thread_fn(): # Mark has_data as a variable that's outside of thread_fn # Otherwise, `populating_data = True` creates a local variable ...
METHOD
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>camp_zipnerf/internal/utils.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # camp_zipnerf/internal/datasets.py def __init__(self, dataset: Dataset): super().__init__() self._queue = queue.Queue(3) # Set prefetch buffer to 3 batch...
try: for item in fn(*args, **kwargs): results_queue.put(item)
TRY
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>camp_zipnerf/internal/utils.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # camp_zipnerf/internal/datasets.py def __init__(self, dataset: Dataset): super().__init__() self._queue = queue.Queue(3) # Set prefetch buffer to 3 batch...
try: # Set timeout to allow for exceptions to be propagated. next_value = results_queue.get(timeout=1.0)
TRY
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>camp_zipnerf/internal/utils.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # camp_zipnerf/internal/datasets.py def __init__(self, dataset: Dataset): super().__init__() self._queue = queue.Queue(3) # Set prefetch buffer to 3 batch...
try: # Set timeout to allow for exceptions to be propagated. next_value = results_queue.get(timeout=1.0)
TRY
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>camp_zipnerf/internal/utils.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # camp_zipnerf/internal/datasets.py def __init__(self, dataset: Dataset): super().__init__() self._queue = queue.Queue(3) # Set prefetch buffer to 3 batch...
try: for item in fn(*args, **kwargs): results_queue.put(item)
TRY
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>camp_zipnerf/internal/utils.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # camp_zipnerf/internal/stepfun.py def integrate_weights(w): """Compute the cumulative sum of w, assuming all weight vectors sum to 1. The output's size on the l...
try: # Set timeout to allow for exceptions to be propagated. next_value = results_queue.get(timeout=1.0)
TRY
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>camp_zipnerf/internal/utils.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # camp_zipnerf/internal/stepfun.py def integrate_weights(w): """Compute the cumulative sum of w, assuming all weight vectors sum to 1. The output's size on the l...
try: for item in fn(*args, **kwargs): results_queue.put(item)
TRY
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>camp_zipnerf/internal/utils.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # camp_zipnerf/internal/datasets.py def __init__(self, dataset: Dataset): super().__init__() self._queue = queue.Queue(3) # Set prefetch buffer to 3 batch...
while True: with populating_data_lock: if not populating_data and results_queue.empty(): break get_start = time.time() try: # Set timeout to allow for exceptions to be propagated. next_value = results_queue.get(timeout=1.0) except...
WHILE
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>camp_zipnerf/internal/utils.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # camp_zipnerf/internal/datasets.py def __init__(self, dataset: Dataset): super().__init__() self._queue = queue.Queue(3) # Set prefetch buffer to 3 batch...
while True: with populating_data_lock: if not populating_data and results_queue.empty(): break get_start = time.time() try: # Set timeout to allow for exceptions to be propagated. next_value = results_queue.get(timeout=1.0) except...
WHILE
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>camp_zipnerf/internal/utils.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # camp_zipnerf/internal/stepfun.py def integrate_weights(w): """Compute the cumulative sum of w, assuming all weight vectors sum to 1. The output's size on the l...
while True: with populating_data_lock: if not populating_data and results_queue.empty(): break get_start = time.time() try: # Set timeout to allow for exceptions to be propagated. next_value = results_queue.get(timeout=1.0) except...
WHILE
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>camp_zipnerf/internal/utils.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # camp_zipnerf/internal/datasets.py def __init__(self, dataset: Dataset): super().__init__() self._queue = queue.Queue(3) # Set prefetch buffer to 3 batch...
except queue.Empty: continue
CATCH
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>camp_zipnerf/internal/utils.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # camp_zipnerf/internal/stepfun.py def integrate_weights(w): """Compute the cumulative sum of w, assuming all weight vectors sum to 1. The output's size on the l...
except queue.Empty: continue
CATCH
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>camp_zipnerf/internal/utils.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # camp_zipnerf/internal/datasets.py def __init__(self, dataset: Dataset): super().__init__() self._queue = queue.Queue(3) # Set prefetch buffer to 3 batch...
except queue.Empty: continue
CATCH
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>camp_zipnerf/internal/math.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # camp_zipnerf/internal/train_utils.py def summarize_tree(fn, tree, ancestry=(), max_depth=3): """Flatten 'tree' while 'fn'-ing values and formatting keys like/this....
@jax.custom_jvp
ANNOTATION
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>camp_zipnerf/internal/math.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # camp_zipnerf/internal/train_utils.py def summarize_tree(fn, tree, ancestry=(), max_depth=3): """Flatten 'tree' while 'fn'-ing values and formatting keys like/this....
@safe_fn.defjvp
ANNOTATION
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>microagents/agents/agent_persistence_manager.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # microagents/integrations/agent_persistence.py def load_all_purposes(self): """ Load all agent purposes from the persistence lay...
""" Load all agents from the database. """
BLOCK_COMMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>microagents/integrations/sqlite_agent_persistence.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # microagents/integrations/memoize.py def _cache_result(self, arg_hash, result): cursor = self.connection.cursor() cursor.ex...
""" Save the serialized agent to an SQLite database. """
BLOCK_COMMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>microagents/agents/agent_lifecycle.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # microagents/agents/microagent_manager.py def cleanup_agents(self): """Remove all agents with status stopped = True""" self.agent_lifecycl...
"""Remove all agents with status stopped = True in an efficient manner."""
BLOCK_COMMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>microagents/agents/agent_lifecycle.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # microagents/agents/agent_response.py def _generate_chat_response(self, system_prompt, react_prompt): return self.openai_wrapper.chat_completion( ...
""" Generates a prompt for the LLM based on the given goal and sample input. """
BLOCK_COMMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>microagents/integrations/memoize.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # microagents/integrations/sqlite_agent_persistence.py def load_all_purposes(self): """ Load all agent purposes from the SQLite database. ...
""" Memoization decorator that caches the output of a method in a SQLite database. """
BLOCK_COMMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>microagents/agents/agent_lifecycle.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # microagents/agents/microagent_manager.py def create_agents(self) -> None: """Creates prime agents and logs the process.""" logger.info("C...
"""Creates the prime agent and adds it to the agent list."""
BLOCK_COMMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>microagents/agents/microagent_manager.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # microagents/agents/agent_lifecycle.py def get_available_agents_for_agent(self, agent) -> List[MicroAgent]: """Returns the list of available ag...
"""Returns the list of agents."""
BLOCK_COMMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>microagents/agents/agent_similarity.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # microagents/agents/agent_lifecycle.py def save_agent(self, agent: MicroAgent) -> None: """Saves the given agent with error handling.""" ...
""" Finds the closest agent based on the given purpose embedding. :param purpose_embedding: The embedding of the purpose to find the closest agent for. :return: Tuple of the closest agent and the highest similarity score. """
BLOCK_COMMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>microagents/agents/microagent_manager.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # microagents/agents/agent_lifecycle.py def cleanup_agents(self): """Remove all agents with status stopped = True in an efficient manner.""" ...
"""Remove all agents with status stopped = True"""
BLOCK_COMMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>microagents/agents/agent_similarity.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # microagents/ui/logic.py def display_agent_info(self, table_data): time.sleep(2) self.app.table.clear() if len(table_data) > 0: ...
""" Retrieves the embedding for a given text. :param text: Text to get embedding for. :return: Embedding as a numpy array. """
BLOCK_COMMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>microagents/agents/microagent.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # microagents/ui/format.py def print_agent_statistics(agent): """ Print statistics for a given agent. """ print(f"📊 Stats for {agent.purpose}:") ...
self.parent_id = parent_id
STATEMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>microagents/agents/microagent.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # microagents/ui/format.py def print_agent_statistics(agent): """ Print statistics for a given agent. """ print(f"📊 Stats for {agent.purpose}:") ...
self.id = str(uuid.uuid4())
STATEMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>microagents/integrations/memoize.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # microagents/agents/parallel_agent_executor.py def determine_winning_agent(self): if not self.response_queue.empty(): return self.respon...
result = self._fetch_from_cache(arg_hash)
STATEMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>microagents/agents/microagent.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # microagents/ui/format.py def print_agent_statistics(agent): """ Print statistics for a given agent. """ print(f"📊 Stats for {agent.purpose}:") ...
self.dynamic_prompt = initial_prompt
STATEMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>microagents/integrations/sqlite_agent_persistence.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # microagents/integrations/agent_persistence.py def load_all_purposes(self): """ Load all agent purposes from the persistenc...
cursor = conn.cursor()
STATEMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>microagents/agents/agent_similarity.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # microagents/agents/agent_lifecycle.py def save_agent(self, agent: MicroAgent) -> None: """Saves the given agent with error handling.""" ...
similarity = cosine_similarity([agent.purpose_embedding], [purpose_embedding])[0][0]
STATEMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>microagents/integrations/memoize.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # microagents/integrations/sqlite_agent_persistence.py def save_agent(self, agent_dict): """ Save the serialized agent to an SQLite database....
cursor = self.connection.cursor()
STATEMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>microagents/agents/microagent.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # microagents/ui/format.py def print_agent_statistics(agent): """ Print statistics for a given agent. """ print(f"📊 Stats for {agent.purpose}:") ...
self.parent_id = None
STATEMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>microagents/integrations/memoize.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # microagents/integrations/sqlite_agent_persistence.py def _initialize_database(self): """ Initialize the SQLite database with the required s...
self.connection = sqlite3.connect(self.filename)
STATEMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>microagents/agents/microagent.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # microagents/ui/format.py def print_agent_statistics(agent): """ Print statistics for a given agent. """ print(f"📊 Stats for {agent.purpose}:") ...
self.depth = depth
STATEMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>microagents/agents/agent_lifecycle.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # microagents/agents/agent_response.py def _generate_chat_response(self, system_prompt, react_prompt): return self.openai_wrapper.chat_completion( ...
try: return self.openai_wrapper.chat_completion(messages=messages)
TRY
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>microagents/agents/agent_similarity.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # microagents/agents/agent_lifecycle.py def save_agent(self, agent: MicroAgent) -> None: """Saves the given agent with error handling.""" ...
try: for agent in self.agents: if agent.purpose_embedding is None: agent.purpose_embedding = self.get_embedding(agent.purpose) similarity = cosine_similarity([agent.purpose_embedding], [purpose_embedding])[0][0] if similarity > highest_sim...
TRY
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>microagents/agents/agent_similarity.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # microagents/ui/logic.py def display_agent_info(self, table_data): time.sleep(2) self.app.table.clear() if len(table_data) > 0: ...
try: response = self.openai_wrapper.get_embedding(text) if 'data' in response and len(response['data']) > 0 and 'embedding' in response['data'][0]: return np.array(response['data'][0]['embedding']) else: logger.exception("Invalid response format") ...
TRY
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>microagents/agents/agent_lifecycle.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # microagents/agents/microagent_manager.py def create_agents(self) -> None: """Creates prime agents and logs the process.""" logger.info("C...
try: self.agent_persistence.save_agent(agent)
TRY
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>microagents/agents/agent_similarity.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # microagents/agents/agent_lifecycle.py def save_agent(self, agent: MicroAgent) -> None: """Saves the given agent with error handling.""" ...
except Exception as e: logger.exception(f"Error finding closest agent: {e}") raise ValueError(f"Error finding closest agent: {e}")
CATCH
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>microagents/agents/agent_lifecycle.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # microagents/agents/agent_response.py def _generate_chat_response(self, system_prompt, react_prompt): return self.openai_wrapper.chat_completion( ...
except Exception as e: logger.exception(f"Error generating LLM prompt: {e}") return ""
CATCH
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>microagents/agents/agent_lifecycle.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # microagents/agents/microagent_manager.py def create_agents(self) -> None: """Creates prime agents and logs the process.""" logger.info("C...
except Exception as e: logger.exception(f"Error in saving agent: {e}") raise
CATCH
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>microagents/agents/agent_similarity.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # microagents/ui/logic.py def display_agent_info(self, table_data): time.sleep(2) self.app.table.clear() if len(table_data) > 0: ...
except Exception as e: logger.exception(f"Error retrieving embedding: {e}") raise ValueError(f"Error retrieving embedding: {e}")
CATCH
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>microagents/agents/agent_persistence_manager.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # microagents/integrations/agent_persistence.py def load_all_purposes(self): """ Load all agent purposes from the persistence lay...
for purpose in purposes: agent = self.load_agent(purpose, agent_lifecycle, openai_wrapper) if agent: agents.append(agent)
FOR
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>microagents/agents/agent_similarity.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # microagents/agents/agent_lifecycle.py def save_agent(self, agent: MicroAgent) -> None: """Saves the given agent with error handling.""" ...
for agent in self.agents: if agent.purpose_embedding is None: agent.purpose_embedding = self.get_embedding(agent.purpose) similarity = cosine_similarity([agent.purpose_embedding], [purpose_embedding])[0][0] if similarity > highest_similarity: ...
FOR
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>microagents/agents/microagent.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # microagents/ui/format.py def print_agent_statistics(agent): """ Print statistics for a given agent. """ print(f"📊 Stats for {agent.purpose}:") ...
if is_prime: self.id = "2a5e6fe9-1bb1-426c-9521-145caa2cf66b" else: if id: self.id = id else: self.id = str(uuid.uuid4())
IF
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>microagents/agents/microagent.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # microagents/ui/format.py def print_agent_statistics(agent): """ Print statistics for a given agent. """ print(f"📊 Stats for {agent.purpose}:") ...
if id: self.id = id else: self.id = str(uuid.uuid4())
IF
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>microagents/agents/agent_similarity.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # microagents/agents/agent_lifecycle.py def save_agent(self, agent: MicroAgent) -> None: """Saves the given agent with error handling.""" ...
if similarity > highest_similarity: highest_similarity = similarity closest_agent = agent
IF
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>microagents/agents/agent_similarity.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # microagents/agents/agent_lifecycle.py def save_agent(self, agent: MicroAgent) -> None: """Saves the given agent with error handling.""" ...
if agent.purpose_embedding is None: agent.purpose_embedding = self.get_embedding(agent.purpose)
IF
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>microagents/agents/agent_similarity.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # microagents/ui/logic.py def display_agent_info(self, table_data): time.sleep(2) self.app.table.clear() if len(table_data) > 0: ...
if 'data' in response and len(response['data']) > 0 and 'embedding' in response['data'][0]: return np.array(response['data'][0]['embedding']) else: logger.exception("Invalid response format") raise ValueError("Invalid response format")
IF
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>microagents/integrations/memoize.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # microagents/agents/parallel_agent_executor.py def determine_winning_agent(self): if not self.response_queue.empty(): return self.respon...
if result is not None: return result
IF
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>microagents/agents/agent_persistence_manager.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # microagents/integrations/agent_persistence.py def load_all_purposes(self): """ Load all agent purposes from the persistence lay...
if agent: agents.append(agent)
IF
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>microagents/agents/microagent.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # microagents/ui/format.py def print_agent_statistics(agent): """ Print statistics for a given agent. """ print(f"📊 Stats for {agent.purpose}:") ...
if parent: self.parent_id = parent.id if parent else None else: self.parent_id = None
IF
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>microagents/integrations/memoize.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # microagents/integrations/sqlite_agent_persistence.py def load_all_purposes(self): """ Load all agent purposes from the SQLite database. ...
def decorator(func): @functools.wraps(func) def wrapped(*args, **kwargs): with SQLiteMemoization(filename) as memoizer: return memoizer.fetch_or_compute(func, func_name, *args, **kwargs) return wrapped
METHOD
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>microagents/integrations/memoize.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # microagents/utils/utility.py def time_function(func: T) -> T: """ Decorator to measure the execution time of a function. Args: func (Calla...
def wrapped(*args, **kwargs): with SQLiteMemoization(filename) as memoizer: return memoizer.fetch_or_compute(func, func_name, *args, **kwargs)
METHOD
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>microagents/integrations/memoize.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # microagents/integrations/sqlite_agent_persistence.py def load_all_purposes(self): """ Load all agent purposes from the SQLite database. ...
def wrapped(*args, **kwargs): with SQLiteMemoization(filename) as memoizer: return memoizer.fetch_or_compute(func, func_name, *args, **kwargs)
METHOD
prefix_suffix_full_complete_current_block_with_repo_rag_oracle
<filename>microagents/integrations/sqlite_agent_persistence.py<fim_prefix>""" Here are some snippets of code retrieved from other files in this repository that may help you: # microagents/integrations/memoize.py def _cache_result(self, arg_hash, result): cursor = self.connection.cursor() cursor.ex...
# add id field
LINE_COMMENT
prefix_suffix_full_complete_current_block_with_repo_rag_oracle