Skip to content
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

model_rpc style improvement #293

Merged
merged 4 commits into from
Mar 24, 2024
Merged

model_rpc style improvement #293

merged 4 commits into from
Mar 24, 2024

Conversation

hnyls2002
Copy link
Collaborator

@hnyls2002 hnyls2002 commented Mar 13, 2024

What does this PR do?

  • Make the old ModelRpcServer an independent class, with the __init__ function to initialize all the fields, which were initialized in exposed_init_model before.
  • Change the thread server
    class ModelRpcService(rpyc.Service):
        exposed_ModelRpcServer = ModelRpcServer

@Qubitium
Copy link
Contributor

Qubitium commented Mar 14, 2024

I am going to chime on the new format part. The new line expansion format of if args is really redundant and inflates line count with no obvious improvement to readability. Should be used when # of args is > some N due to a standard perhaps. If I pass in 3 args, there is no need for 2 extra lines of code. Perhaps project can standardize on a formatting style using a formatter/linter that everyone can adhere to?

image

image

@hnyls2002
Copy link
Collaborator Author

@Qubitium The main intention of this PR is not to expand the arguments into multiple lines, as you mentioned. These changes were actually made by our formatting script

https://github.com/sgl-project/sglang/blob/main/scripts/format.sh

I believe the verdict on when to introduce a new line isn't solely influenced by the number of arguments. Factors such as indentation and the maximum length of a line should also be considered. This is the approach taken by black.

My main concern is with the init_exposed_model method, which initializes all fields of ModelRpcServer, but it does so outside of the conventional __init__ function. This results in a lot of Pylint warnings and complicates the process of tracking class members.

@Qubitium
Copy link
Contributor

@hnyls2002 If project sticks with black, I will follow suite.

Can black be tweaked to be less, strict? The following expansion is pure badness. Python has is own guideline on max width but black takes to another, almost unnecessary level.

image

@merrymercy
Copy link
Contributor

@hnyls2002 The PR looks good to me. Please resolve the conflicts and you can merge it by yourself.

@hnyls2002 hnyls2002 merged commit 7523541 into main Mar 24, 2024
@hnyls2002 hnyls2002 deleted the mpdel-rpc-style branch March 24, 2024 07:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants