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

Got same problem that model only return lots of '\n' #30

Closed
FoxxComz opened this issue Feb 6, 2024 · 5 comments
Closed

Got same problem that model only return lots of '\n' #30

FoxxComz opened this issue Feb 6, 2024 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@FoxxComz
Copy link

FoxxComz commented Feb 6, 2024

I got the same problem when use the quick start script to run an inference task.
Just the same as this issue: #22
what should i do to solve this problem?

@FoxxComz
Copy link
Author

FoxxComz commented Feb 6, 2024

here is my code:

from transformers import pipeline
import torch

MAGICODER_PROMPT = """You are an exceptionally intelligent coding assistant that consistently delivers accurate and reliable responses to user instructions.

@@ Instruction
{instruction}

@@ Response
"""

instruction = "Implement a high-level API for a TODO list application. The API takes as input an operation request and updates the TODO list in place. If the request is invalid, raise an exception."

model_path='/data/MagiCoder'
prompt = MAGICODER_PROMPT.format(instruction=instruction)
generator = pipeline(
    model=model_path,
    task="text-generation",
    torch_dtype=torch.bfloat16,
    device_map="auto",
)
result = generator(prompt, max_length=2048, num_return_sequences=1, temperature=0.0)
print(result[0]["generated_text"])

@UniverseFly
Copy link
Member

Thanks for reporting this. Did you also try to update the package as described in the issue you referred to, and could that help?

@UniverseFly UniverseFly self-assigned this Feb 15, 2024
@UniverseFly UniverseFly added the bug Something isn't working label Feb 15, 2024
@FoxxComz
Copy link
Author

Thanks for reporting this. Did you also try to update the package as described in the issue you referred to, and could that help?

do u have recomended version of packages that magicoder need?

@UniverseFly
Copy link
Member

Yes they are listed in pyproject.toml.

@huiyeruzhou
Copy link

Hi, I believe this is a common problem for deepseek-based model for I suffered this before. Deepseek is very sensitive to prompt formats. You may want to print the token passed to the model to make sure the <|begin_of_sentence|> is correctly added.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants