google / jetstream-pytorch

PyTorch/XLA integration with JetStream (https://github.com/google/JetStream) for LLM inference"
Apache License 2.0
32 stars 14 forks source link

Fix convert checkpoint lint check #55

Closed FanhaiLu1 closed 4 months ago

FanhaiLu1 commented 4 months ago

After this PR: Your code has been rated at 10.00/10

Before this PR: Your code has been rated at 9.08/10 ***** Module jetstream-pytorch.convert_checkpoints convert_checkpoints.py:370:0: C0301: Line too long (111/100) (line-too-long)

convert_checkpoints.py:219:0: R0912: Too many branches (15/12) (too-many-branches) convert_checkpoints.py:291:27: C0207: Use input_ckpt_dir_str.rsplit('//', maxsplit=1)[-1] instead (use-maxsplit-arg) convert_checkpoints.py:294:2: W0612: Unused variable 'bucket' (unused-variable) convert_checkpoints.py:329:29: C0207: Use str(output_ckpt_dir).rsplit('//', maxsplit=1)[-1] instead (use-maxsplit-arg) convert_checkpoints.py:328:2: W0612: Unused variable 'output_ckpt_dir_str' (unused-variable) convert_checkpoints.py:352:4: C0415: Import outside toplevel (safetensors.torch.save_file) (import-outside-toplevel) convert_checkpoints.py:361:0: C0116: Missing function or method docstring (missing-function-docstring) convert_checkpoints.py:401:0: C0116: Missing function or method docstring (missing-function-docstring) convert_checkpoints.py:26:0: C0411: standard import "collections.abc.Sequence" should be placed before first party import "jetstream_pt.quantize" (wrong-import-order) convert_checkpoints.py:27:0: C0411: standard import "gc" should be placed before first party import "jetstream_pt.quantize" (wrong-import-order) convert_checkpoints.py:28:0: C0411: standard import "hashlib" should be placed before first party import "jetstream_pt.quantize" (wrong-import-order) convert_checkpoints.py:29:0: C0411: standard import "json" should be placed before first party import "jetstream_pt.quantize" (wrong-import-order) convert_checkpoints.py:30:0: C0411: standard import "os" should be placed before first party import "jetstream_pt.quantize" (wrong-import-order) convert_checkpoints.py:32:0: C0411: third party import "absl.app" should be placed before first party import "jetstream_pt.quantize" (wrong-import-order) convert_checkpoints.py:33:0: C0411: third party import "absl.flags" should be placed before first party import "jetstream_pt.quantize" (wrong-import-order) convert_checkpoints.py:34:0: C0411: third party import "etils.epath" should be placed before first party import "jetstream_pt.quantize" (wrong-import-order) convert_checkpoints.py:35:0: C0411: third party import "torch" should be placed before first party import "jetstream_pt.quantize" (wrong-import-order) convert_checkpoints.py:36:0: C0411: third party import "google.cloud.storage" should be placed before first party import "jetstream_pt.quantize" (wrong-import-order) convert_checkpoints.py:37:0: C0411: standard import "time" should be placed before third party imports "absl.app", "absl.flags", "etils.epath", "torch", "google.cloud.storage" and first party import "jetstream_pt.quantize" (wrong-import-order)


Your code has been rated at 9.08/10