-
-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lint20240110 ruff cleanup, zeta/ops init.py Case change #98
Conversation
@@ -0,0 +1,20 @@ | |||
pip install pytest; cd tests/utils ; pytest test_video_tensor_to_gift.py | |||
|
|||
['Andromeda', 'T_destination', '__annotations__', '__call__', '__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattr__', '__getattribute__', '__getstate__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__setstate__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_apply', '_backward_hooks', '_backward_pre_hooks', '_buffers', '_call_impl', '_compiled_call_impl', '_forward_hooks', '_forward_hooks_always_called', '_forward_hooks_with_kwargs', '_forward_pre_hooks', '_forward_pre_hooks_with_kwargs', '_get_backward_hooks', '_get_backward_pre_hooks', '_get_name', '_is_full_backward_hook', '_load_from_state_dict', '_load_state_dict_post_hooks', '_load_state_dict_pre_hooks', '_maybe_warn_non_full_backward_hook', '_modules', '_named_members', '_non_persistent_buffers_set', '_parameters', '_register_load_state_dict_pre_hook', '_register_state_dict_hook', '_replicate_for_data_parallel', '_save_to_state_dict', '_slow_forward', '_state_dict_hooks', '_state_dict_pre_hooks', '_version', '_wrapped_call_impl', |
Check notice
Code scanning / Remark-lint (reported by Codacy)
Warn when references to undefined definitions are found. Note
@@ -14,7 +14,7 @@ | |||
def test_print_main_without_dist(message): | |||
"""Test print_main without distribution""" | |||
print_main(message) | |||
captured = capsys.readout() | |||
captured = capsys.readout() # noqa: F821 |
Check warning
Code scanning / Pylint (reported by Codacy)
Undefined variable 'capsys' Warning test
@@ -1278,7 +1269,7 @@ | |||
return_intermediates=False, | |||
cache: Optional[Intermediates] = None, | |||
): | |||
b, n, _, h, kv_h, head_scale, device, has_context = ( | |||
b, n, _, h, kv_h, head_scale, device, has_context = ( # noqa F841 |
Check warning
Code scanning / Pylint (reported by Codacy)
Variable name "b" doesn't conform to snake_case naming style Warning
@@ -1278,7 +1269,7 @@ | |||
return_intermediates=False, | |||
cache: Optional[Intermediates] = None, | |||
): | |||
b, n, _, h, kv_h, head_scale, device, has_context = ( | |||
b, n, _, h, kv_h, head_scale, device, has_context = ( # noqa F841 |
Check warning
Code scanning / Pylint (reported by Codacy)
Variable name "n" doesn't conform to snake_case naming style Warning
@@ -2172,7 +2163,7 @@ | |||
cache: Optional[LayerIntermediates] = None, | |||
**kwargs, | |||
): | |||
b, n, device, num_mems, has_memory_tokens, emb_frac_gradient = ( | |||
b, n, device, num_mems, has_memory_tokens, emb_frac_gradient = ( # noqa F841 |
Check warning
Code scanning / Pylint (reported by Codacy)
Variable name "n" doesn't conform to snake_case naming style Warning
@@ -2172,7 +2163,7 @@ | |||
cache: Optional[LayerIntermediates] = None, | |||
**kwargs, | |||
): | |||
b, n, device, num_mems, has_memory_tokens, emb_frac_gradient = ( | |||
b, n, device, num_mems, has_memory_tokens, emb_frac_gradient = ( # noqa F841 |
Check warning
Code scanning / Pylint (reported by Codacy)
Variable name "b" doesn't conform to snake_case naming style Warning
@@ -1278,7 +1269,7 @@ | |||
return_intermediates=False, | |||
cache: Optional[Intermediates] = None, | |||
): | |||
b, n, _, h, kv_h, head_scale, device, has_context = ( | |||
b, n, _, h, kv_h, head_scale, device, has_context = ( # noqa F841 |
Check warning
Code scanning / Pylint (reported by Codacy)
Variable name "h" doesn't conform to snake_case naming style Warning
@@ -128,7 +128,7 @@ | |||
logits, embed = self.forward( | |||
out, return_logits_with_embedding=True, **kwargs | |||
) | |||
logits, embeds = logits[:, -1], embeds[:, -1] | |||
logits, embeds = logits[:, -1], embeds[:, -1] # noqa F841 |
Check warning
Code scanning / Pylint (reported by Codacy)
Using variable 'embeds' before assignment Warning
@@ -14,7 +14,7 @@ | |||
def test_print_main_without_dist(message): | |||
"""Test print_main without distribution""" | |||
print_main(message) | |||
captured = capsys.readout() | |||
captured = capsys.readout() # noqa: F821 |
Check warning
Code scanning / Pylintpython3 (reported by Codacy)
Undefined variable 'capsys' Warning test
@@ -1,5 +1,6 @@ | |||
import torch | |||
from zeta.utils import interpolate_pos_encoding_2d | |||
import pytest.raises |
Check warning
Code scanning / Pylintpython3 (reported by Codacy)
third party import "import pytest.raises" should be placed before "from zeta.utils import interpolate_pos_encoding_2d" Warning test
@@ -10,7 +10,7 @@ | |||
from swarms.utils.parse_code import ( | |||
extract_code_from_markdown, | |||
) | |||
from zeta.utils import * | |||
from zeta.utils import * # noqa: F403 |
Check notice
Code scanning / Pylintpython3 (reported by Codacy)
Wildcard import zeta.utils Note
@@ -10,7 +10,7 @@ | |||
from swarms.utils.parse_code import ( | |||
extract_code_from_markdown, | |||
) | |||
from zeta.utils import * | |||
from zeta.utils import * # noqa: F403 |
Check notice
Code scanning / Pylintpython3 (reported by Codacy)
Unused import(s) track_cuda_memory_usage, benchmark, print_cuda_memory_usage, save_memory_snapshot, disable_warnings_and_logs, print_num_params, print_main, module_device, save_load, exists, default, once, eval_decorator, cast_tuple, maybe, init_zero_, pick_and_pop, group_dict_by_key, string_begins_with, group_by_key_prefix, top_p, top_k, top_a, log, gumbel_noise, video_tensor_to_gift, gif_to_tensor, l2norm, pad_at_dim, cosine_beta_schedule, cast_if_src_dtype, get_sinusoid_encoding_table, interpolate_pos_encoding_2d and enforce_types from wildcard import of zeta.utils Note
@@ -1278,7 +1269,7 @@ | |||
return_intermediates=False, | |||
cache: Optional[Intermediates] = None, | |||
): | |||
b, n, _, h, kv_h, head_scale, device, has_context = ( | |||
b, n, _, h, kv_h, head_scale, device, has_context = ( # noqa F841 |
Check notice
Code scanning / Pylintpython3 (reported by Codacy)
Unused variable 'n' Note
@@ -2172,7 +2163,7 @@ | |||
cache: Optional[LayerIntermediates] = None, | |||
**kwargs, | |||
): | |||
b, n, device, num_mems, has_memory_tokens, emb_frac_gradient = ( | |||
b, n, device, num_mems, has_memory_tokens, emb_frac_gradient = ( # noqa F841 |
Check notice
Code scanning / Pylintpython3 (reported by Codacy)
Unused variable 'device' Note
@@ -163,7 +163,7 @@ | |||
self.sdp_kwargs = sdp_kwargs | |||
|
|||
def flash_attn(self, q, k, v, mask=None, attn_bias=None): | |||
batch, heads, q_len, _, k_len, is_cuda, device = ( | |||
batch, heads, q_len, _, k_len, is_cuda, device = ( # noqa F841 |
Check notice
Code scanning / Pylintpython3 (reported by Codacy)
Unused variable 'is_cuda' Note
@@ -7,7 +7,7 @@ | |||
|
|||
from scripts.auto_tests_docs.docs import DOCUMENTATION_WRITER_SOP | |||
from swarms import OpenAIChat | |||
from zeta.ops import * | |||
from zeta.ops import * # noqa: F403 |
Check notice
Code scanning / Pylintpython3 (reported by Codacy)
Wildcard import zeta.ops Note
@@ -7,7 +7,7 @@ | |||
|
|||
from scripts.auto_tests_docs.docs import DOCUMENTATION_WRITER_SOP | |||
from swarms import OpenAIChat | |||
from zeta.ops import * | |||
from zeta.ops import * # noqa: F403 |
Check notice
Code scanning / Pylintpython3 (reported by Codacy)
Unused import(s) EinopsToAndFrom, rearrange_many, reduce_many, repeat_many, channel_shuffle_new, compute_matrix_root_inverse_residuals, gram_matrix_new, img_compose_bw, img_compose_decompose, img_decompose, img_order_of_axes, img_transpose, img_transpose_2daxis, img_width_to_height, matrix_inverse_root, matrix_root_diagonal, merge_small_dims, multi_dim_cat, multi_dim_split, squeeze_2d_new, unsqueeze_2d_new, reshape_audio_to_text, reshape_img_to_text, reshape_text_to_img, reshape_video_to_text, fast_softmax, gumbelmax, local_softmax, logit_scaled_softmax, norm_exp_softmax, selu_softmax, sparse_softmax, sparsemax, standard_softmax, temp_softmax, unitwise_norm, padding_to_multiple_of, get_data_parallel_group, get_rank, get_world_size, get_data_parallel_rank, get_data_parallel_world_size, Allgather, all_gather_func, absmax, VPGELU and VPReLU from wildcard import of zeta.ops Note
The name of init,py in zeta/ops started with a captal I. Renamed to lowercase.
Silenced.
Removed a few duplicate tests.