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

Generate Token in Yuan2.0 #98

Open
hungptit123 opened this issue Jan 19, 2024 · 3 comments
Open

Generate Token in Yuan2.0 #98

hungptit123 opened this issue Jan 19, 2024 · 3 comments

Comments

@hungptit123
Copy link

hungptit123 commented Jan 19, 2024

I see the code generate token. But I want to generate more tokens (2, 3, 4, 5 tokens) in one inference. But the code can do it.
You can help me generate more tokens in one inference.

The step = 1 in loop

for context_length in range(prompt_length, final_sequence_length, 1):

        # Pick the slice that we need to pass through the network.
        tokens2use = tokens[:, prev_context_length:context_length]
        positions2use = position_ids[:, prev_context_length:context_length]
        attention_mask2use = attention_mask[
            ..., prev_context_length:context_length, :context_length]

        # logits will be meanigful only in the last pipeline stage.
        logits = forward_step(tokens2use, positions2use, attention_mask2use)

-> That OK
But step = 2 in loop , this is error.

for context_length in range(prompt_length, final_sequence_length, 2):

        # Pick the slice that we need to pass through the network.
        tokens2use = tokens[:, prev_context_length:context_length]
        positions2use = position_ids[:, prev_context_length:context_length]
        attention_mask2use = attention_mask[
            ..., prev_context_length:context_length, :context_length]

        # logits will be meanigful only in the last pipeline stage.
        logits = forward_step(tokens2use, positions2use, attention_mask2use)
@Shawn-IEITSystems
Copy link
Collaborator

@zhaoxudong01-ieisystem

@zhaoxudong01
Copy link
Collaborator

Can you give more error message or full log file.

@Shawn-IEITSystems
Copy link
Collaborator

@hungptit123 Have you fixed this issue?

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

No branches or pull requests

3 participants