certik / fastGPT

Fast GPT-2 inference written in Fortran
MIT License
180 stars 16 forks source link

minloc, maxloc #48

Closed certik closed 1 year ago

certik commented 1 year ago

https://github.com/certik/fastGPT/commit/d4c6190414e45d421df89180cfa92d89d93a4803

https://github.com/certik/fastGPT/commit/0e01ebc87d8602be07054762a8141c6d7e34ca9f

Smit-create commented 1 year ago

maxloc open PR by @Thirumalai-Shaktivel: https://github.com/lfortran/lfortran/pull/1328. I suppose minloc will have identical implementation too. @Thirumalai-Shaktivel can you please take this up and try to get the open PR merged?

Thirumalai-Shaktivel commented 1 year ago

Sorry for the delay, I will finish both by the end of the day!

certik commented 1 year ago

Thank you @Thirumalai-Shaktivel! It doesn't need to be implemented in full generality, just what is needed for fastGPT:

    merge_pair_idx = minloc(pair_scores, 1)
    next_id = maxloc(logits(:,n_seq_x), dim=1)-1

Both seem to be just 1D arrays.

certik commented 1 year ago

Fixed by https://github.com/lfortran/lfortran/pull/1328.