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

Request for Iterative Generation in Pipeline (e.g., LLaMA model) #33949

Open
qsunyuan opened this issue Oct 4, 2024 · 1 comment
Open

Request for Iterative Generation in Pipeline (e.g., LLaMA model) #33949

qsunyuan opened this issue Oct 4, 2024 · 1 comment
Labels
Feature request Request for a new feature

Comments

@qsunyuan
Copy link

qsunyuan commented Oct 4, 2024

Feature request

I would like to ask if there is a way to perform iterative generation (n times) within the pipeline, specifically for models like LLMs. If this feature is not available, is there any plan to implement it in the future?

Example:

pipeline = transformers.pipeline(
            "text-generation",
            model="meta-llama/Llama-3.1-8B-Instruct",
            model_kwargs={"torch_dtype": torch.bfloat16},
            device_map="auto",
        ) 

# Generate once
outputs = llama_client(
              messages,
              max_new_tokens=max_tokens
          )
# Generate n times
outputs = llama_client(
              messages,
              max_new_tokens=max_tokens,
              n = n
          )

Similar GPT API

response = client.chat.completions.create(
            model=model,
            messages=messages, 
            max_tokens=max_tokens,
            temperature=temperature, 
            n=n,  
        )

I am also aware that iterative generation can be done using a for loop, but I am wondering if there is a more efficient or optimized way to generate multiple iterations (n times) within the pipeline for models.

https://community.openai.com/t/how-does-n-parameter-work-in-chat-completions/288725

Motivation

build connection between LLM api and transformer pipeline

Your contribution

Request

@qsunyuan qsunyuan added the Feature request Request for a new feature label Oct 4, 2024
@ArthurZucker
Copy link
Collaborator

Sounds interesting, let's see if this is asked by the community ! We usually check activity here 🚀
cc @Rocketknight1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature request Request for a new feature
Projects
None yet
Development

No branches or pull requests

2 participants