Aleph-Alpha / magma

MAGMA - a GPT-style multimodal model that can understand any combination of images and language. NOTE: The freely available model from this repo is only a demo. For the latest multimodal and multilingual models from Aleph Alpha check out our website https://app.aleph-alpha.com
MIT License
469 stars 55 forks source link

fixing dimensionality error in argmax sampling #43

Closed Golovneva closed 1 year ago

Golovneva commented 1 year ago

Transposing the vector to align with dimensions expected downstream.

When setting up temperature to 0, the error is:

File "magma/magma/sampling.py", line 107, in generate
    out = torch.cat((out, next_token), dim=-1)
RuntimeError: Tensors must have same number of dimensions: got 2 and 1

Example of the next token output:

tensor([ 257,  262,  262,  257,  257,  257, 1279,  257], device='cuda:0')

while the expected output is

tensor([[ 257],
        [ 262],
        [ 262],
        [ 257],
        [ 257],
        [ 257],
        [1279],
        [ 257]], device='cuda:0')
CoEich commented 1 year ago

Hi,

sorry for the late response. Thx for catching this bug.

Best,

Constantin