Skip to content

precision issue #7

Description

@dyhBUPT

Hi, thanks for your work. I'm trying your fa2-cm but it raises error because of the following assertion:

assert do.is_contiguous()
assert q.stride() == k.stride() == v.stride() == o.stride() == do.stride()

I solve this problem by using .contiguous() as follows:

q = q.contiguous()
k = k.contiguous()
v = v.contiguous()
o = o.contiguous()
do = do.contiguous()

Another error is, it only supports fp16 inputs, so I convert q/k/v from fp32 to fp16, and convert the out from fp16 to fp32 after fa2.

After these corrections, I can run fa2-cm normally.
However, the results seem bad, because the gradients explode.
I want to ask the possible reasons. It's because of my aforementioned modifications?

Looking forward to your reply~

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions