google / jetstream-pytorch

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

Clean up engine #42

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:

our code has been rated at 8.46/10 ***** Module jetstream_pt.engine engine.py:567:5: W0511: TODO load from files (fixme) engine.py:46:0: C0115: Missing class docstring (missing-class-docstring) engine.py:46:0: R0903: Too few public methods (0/2) (too-few-public-methods) engine.py:53:0: C0115: Missing class docstring (missing-class-docstring) engine.py:53:0: R0903: Too few public methods (0/2) (too-few-public-methods) engine.py:68:0: R0902: Too many instance attributes (12/7) (too-many-instance-attributes) engine.py:124:6: R1705: Unnecessary "else" after "return", remove the "else" and de-indent the code inside it (no-else-return) engine.py:129:6: R1705: Unnecessary "else" after "return", remove the "else" and de-indent the code inside it (no-else-return) engine.py:110:2: R0911: Too many return statements (8/6) (too-many-return-statements) engine.py:137:2: W0221: Variadics removed in overriding 'PyTorchEngine.init_decode_state' method (arguments-differ) engine.py:159:2: R0913: Too many arguments (8/5) (too-many-arguments) engine.py:266:2: C0116: Missing function or method docstring (missing-function-docstring) engine.py:269:6: W0613: Unused argument 'new_length' (unused-argument) engine.py:273:2: R0914: Too many local variables (25/15) (too-many-locals) engine.py:348:2: R0914: Too many local variables (30/15) (too-many-locals) engine.py:356:4: W0612: Unused variable 'end_insert' (unused-variable) engine.py:520:29: E1101: Module 'jetstream.engine.tokenizer_pb2' has no 'TokenizerParameters' member (no-member) engine.py:521:11: E1101: Module 'jetstream.engine.tokenizer_pb2' has no 'TokenizerParameters' member (no-member) engine.py:523:2: C0116: Missing function or method docstring (missing-function-docstring) engine.py:543:4: C0415: Import outside toplevel (safetensors.safe_open) (import-outside-toplevel) engine.py:566:2: W0221: Variadics removed in overriding 'PyTorchEngine.load_params' method (arguments-differ) engine.py:584:2: W0236: Method 'colocated_cpus' was expected to be 'property', found it instead as 'method' (invalid-overridden-method) engine.py:627:11: W0212: Access to a protected member _data of a client class (protected-access) engine.py:631:11: E1101: Instance of 'PyTorchEngine' has no '_mesh' member; maybe 'mesh'? (no-member) engine.py:634:0: R0913: Too many arguments (13/5) (too-many-arguments) engine.py:634:0: R0914: Too many local variables (29/15) (too-many-locals) engine.py:662:22: C0121: Comparison 'ckpt_path == None' should be 'ckpt_path is None' (singleton-comparison) engine.py:672:4: C0415: Import outside toplevel (etils.epath) (import-outside-toplevel) engine.py:674:50: C0121: Comparison 'ckpt_path != None' should be 'ckpt_path is not None' (singleton-comparison) engine.py:635:4: W0613: Unused argument 'devices' (unused-argument) engine.py:638:4: W0613: Unused argument 'samples_per_slot' (unused-argument) engine.py:700:2: W0612: Unused variable 'shard_weights_fn' (unused-variable) engine.py:715:8: W0612: Unused variable 'k' (unused-variable) engine.py:35:0: C0411: third party import "torch.utils._pytree" should be placed before first party imports "jetstream_pt.third_party.llama2.model_exportable", "jetstream_pt.cache_manager", "jetstream_pt.quantize", "jetstream_pt.environment.JetEngineEnvironment" (wrong-import-order)