Skip to content
This repository has been archived by the owner on Jan 24, 2024. It is now read-only.

How to set my own parameters in model.generate() in basaran? #193

Open
zoubaihan opened this issue May 17, 2023 · 2 comments
Open

How to set my own parameters in model.generate() in basaran? #193

zoubaihan opened this issue May 17, 2023 · 2 comments
Labels
question Further information is requested

Comments

@zoubaihan
Copy link

Hello, I want use my customize parameters when model.generate(), like this:

model.generate(input_ids, max_new_tokens=max_new_tokens,
                                     do_sample=True, max_length=max_length, temperature=temperature, top_p=top_p,
                                     repetition_penalty=repetition_penalty)

but if I use basaran, the code is like this:

model = load_model(model_name)
for choice in model(input_code):
      yield choice

It seems no place I can set parameters like do_sample, max_length, top_p, ..., just like I use model.generate() directly.
So that I can not set those parameters by myself.
How to solve this problem?

@peakji peakji added the question Further information is requested label May 21, 2023
@peakji
Copy link
Member

peakji commented May 21, 2023

Hi @zoubaihan, you can specify parameters such as top_p and max_tokens when calling the StreamModel instance obtained using the load_model function. However, we haven't implemented a streaming version for all parameters in HF Transformers yet, so parameters like do_sample are currently not supported.

Here's the full list of supported params: https://github.com/hyperonym/basaran#completions

@zoubaihan
Copy link
Author

OK, thank you, I hope one day it could support all parameters of model.generate() !

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants