GithubHelp home page GithubHelp logo

Stop Sequence about deepspeed-mii HOT 4 OPEN

microsoft avatar microsoft commented on June 22, 2024
Stop Sequence

from deepspeed-mii.

Comments (4)

mrwyattii avatar mrwyattii commented on June 22, 2024

Hi @volkerha this is not currently possible in MII. In general, any extra kwargs passed to query() will be passed on to the transformers.pipeline object. For example:

pipeline_kwargs = {"max_new_tokens": 50, "batch_size": 2}
result = generator.query({'query': ["DeepSpeed is the", "Seattle is"]}, **pipeline_kwargs)

The problem is that our current deployment types utilize a grpc server and those pipeline_kwargs values must be serialized. Currently we only support values that are int, float, str, and bool. I see a few ways forward:

  1. We introduce a deployment type that doesn't rely on grpc (this is something we have on our TODO list currently)
  2. We extend serialization capabilities (this would be great because even with deployments that utilize grpc, it would fix this issue)
  3. We add a custom API that will generate the stopping criteria based on user input and pass that to the pipeline (this would probably be the most fragile and difficult to maintain option)

In your current usage of MII, do you require the GRPC server capabilities? or would a non-GRPC deployment work for you? I believe (1) will be the most likely to be implemented in the near future.

from deepspeed-mii.

tokestermw avatar tokestermw commented on June 22, 2024

Looks like there is a stop_sequence (though limited to one token). huggingface/transformers#18444

I'm thinking to add a PR to hugging face to add an argument to the generation pipeline to specify stop tokens (so we don't have to pass objects around).

from deepspeed-mii.

volkerha avatar volkerha commented on June 22, 2024

As you mentioned, 🤗transformers simply set the eos_token_id to the first token of the stop_sequence here. We can directly pass eos_token_id to generate(...), so there's not much benefit.

In my case, I would like to specify a sequence of several tokens as stopping criteria, e.g. only if the model generates something like "User:", generation should be stopped.

Also, it would be good to keep the original eos_token.

from deepspeed-mii.

tokestermw avatar tokestermw commented on June 22, 2024

This PR is merged: huggingface/transformers#20727

Once released, we should be able to do model.generate(..., eos_token_id=[1, 2]).

It's not using stopping_criteria since it looks like jax and tf code doesn't use them, also beam search doesn't work with stopping_criteria.

from deepspeed-mii.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.