-
Notifications
You must be signed in to change notification settings - Fork 35
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
enhancement: Reduce reliance on docs by expanding kwargs into parameters #7
enhancement: Reduce reliance on docs by expanding kwargs into parameters #7
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You did the work i was too lazy for! Any chance you can include it for the other classes as well? that's the same for all?
That's my speciality 😉 I'll extend it to the other classes too! Let me tackle another PR first. |
model: Optional[str] = None, | ||
temperature: float = 0.9, | ||
top_p: float = 0.6, | ||
top_k: Optional[int] = 10, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this implementation, top_k
can technically be None
, but it might be best to simply turn it into top_k: int = 10,
as you wouldn't really want users to specify None
. Same for frequency_penalty
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TGI supports none for both and then uses 0 or omits the values basically.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does, but EasyLLM doesn't:
easyllm/easyllm/clients/huggingface.py
Line 148 in 00ec957
"top_p": float(r.top_p), |
I can fix this though. I'll introduce the possibility for None.
Could you quickly rebase your PR? i merged the fix for |
Some ~5 arguments were listed as Optional[X], which is equivalent to Union[X, None]. However, None caused crashes for these parameters.
and slightly update the docstrings
19d5b3d
to
49cd588
Compare
model: Optional[str] = None, | ||
temperature: float = 0.9, | ||
top_p: float = 0.6, | ||
top_k: Optional[int] = 10, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TGI supports none for both and then uses 0 or omits the values basically.
Hello!
Pull Request overview
kwargs
into parameters to allow IDE support when usinghuggingface.ChatCompletion.create
.Optional
statements.r
torequest
to improve readability.Preface
First of all, this PR makes some style decisions, and I don't mean to impose my style onto this project, so feel free to suggest changes if they are not up to your likings.
Details
I've replaced
kwargs
fromhuggingface.ChatCompletion.create
with the actual arguments used. This nearly matches theChatCompletionRequest
model, with the exception of theuser
field (which I think might be unused?). Also,create
has adebug
parameter that the model doesn't.I've also removed some
Optional
statements. Note thatOptional[X]
is equivalent toUnion[X, None]
, and for these parameters,None
was not a valid input. Some of the remaining ones, liketop_k
andfrequency_penalty
likely also benefit from having theOptional
removed, but they technically work withNone
, so I left them for now. Feel free to let me know if you'd like these removed too.If desired, I can extrapolate these changes to the
Completion
andEmbedding
classes, but I figured I'd let you have a look at this first.