Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • M metaseq
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 95
    • Issues 95
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 41
    • Merge requests 41
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Administrator
  • metaseq
  • Issues
  • #526
Closed
Open
Issue created Nov 19, 2022 by Administrator@rootOwner

How to prevent duplicate output? Repeated sentences? I want to generate longer texts

Created by: FurkanGozukara

Hello. I am experimenting with the model and the generated output is all repeated sentences? How can I prevent that?

Here my simple input and generated output. I want to generate longer texts

from transformers import GPT2Tokenizer, OPTForCausalLM

model = OPTForCausalLM.from_pretrained("facebook/opt-350m")
tokenizer = GPT2Tokenizer.from_pretrained("facebook/opt-350m")

prompt = "How to do proper deadlift?"
inputs = tokenizer(prompt, return_tensors="pt")

# Generate
generate_ids = model.generate(inputs.input_ids, max_length=300)
tokenizer.batch_decode(generate_ids, skip_special_tokens=True, clean_up_tokenization_spaces=False)[0]

'How to do proper deadlift?\n\nI have been doing deadlift for about a year now and I have been doing it for about a month now. I have been doing it for about a month now and I have been doing it for about a month now. I have been doing it for about a month now and I have been doing it for about a month now. I have been doing it for about a month now and I have been doing it for about a month now. I have been doing it for about a month now and I have been doing it for about a month now. I have been doing it for about a month now and I have been doing it for about a month now. I have been doing it for about a month now and I have been doing it for about a month now. I have been doing it for about a month now and I have been doing it for about a month now. I have been doing it for about a month now and I have been doing it for about a month now. I have been doing it for about a month now and I have been doing it for about a month now. I have been doing it for about a month now and I have been doing it for about a month now. I have been doing it for about a month now and I have been doing it for about a month now. I have been doing it for about a month now and I have been doing it for about a month now. I have been'

Assignee
Assign to
Time tracking