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
  • Merge requests
  • !156

Fix Beam Search

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Administrator requested to merge fix_generation into main Jun 16, 2022
  • Overview 2
  • Commits 3
  • Pipelines 0
  • Changes 2

Created by: klshuster

Patch Description Pytorch would not broadcast the src_tokens correctly to tokens when utilizing beam search with beam_size > 1.

Testing steps Tested with sequence generation and beam search. I included a test but there are several issues going on with testing, and figured i'd just include this PR to help anyone else if they've experienced this

BEFORE, with a beam size of 5

2022-06-16 19:46:05 | INFO | metaseq.hub_utils | Executing generation on input tensor size torch.Size([2, 121])
.
.
.
 File "metaseq_public/metaseq/sequence_generator.py", line 93, in generate
   return self._generate(sample, **kwargs)
 File "metaseq_public/metaseq/sequence_generator.py", line 218, in _generate
   tokens[:, :start_step] = src_tokens
RuntimeError: The expanded size of the tensor (10) must match the existing size (2) at non-singleton dimension 0.  Target sizes: [10, 121].  Tensor sizes: [2, 121]

AFTER It works

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: fix_generation