Git Product home page Git Product logo

Comments (7)

kechan avatar kechan commented on July 23, 2024

the tokenizer is doing this:

return mx.array([self.tokenize(t, prepend_bos, append_eos) for t in text])

if text is a List[str], and mx.array doesn't like non uniform list of numbers.

I can "hack" this to work by padding this here with EOT. I went over to HF and they seemed to also "hack" this??

pad_token="<|endoftext|>", # hack to enable padding

so just to be consistent with it.

I have this local changes done. I am not sure if this repos is for edu purpose on how to use MLX and not being completely robust and faithful port of huggingface, otherwise, I can do a PR if this fix helps.

from mlx-examples.

awni avatar awni commented on July 23, 2024

I think it would be fine to pad in the tokenizer. Usually we try to keep the examples simple so they are useful for educational purposes / starting points for building from. In this case I don't think it will add much complexity to pad in the tokenizer.

But I guess the clip_loss would be a bit off if you don't consider the padding?

from mlx-examples.

kechan avatar kechan commented on July 23, 2024

Understood. On the way, i took a quick look at the tokenizer and found probably wasn’t the goal to replicate the HF completely. I followed closely what HF and fixed it locally, and it worked fine. HF tokenizer use end-of-Text to pad, so it is at least as correct as HF seemed to have it.

I wasn’t into training yet so not sure if the clip loss wants to be taken into account the padding method.

from mlx-examples.

awni avatar awni commented on July 23, 2024

I wasn’t into training yet so not sure if the clip loss wants to be taken into account the padding method.

Right but we do evaluate the loss in the current example even when not training. I'm not entirely sure why. Maybe we should remove it o/w it would be incorrect in the padded case.

from mlx-examples.

x4080 avatar x4080 commented on July 23, 2024

@kechan where do you add the pad_token="<|endoftext|>", ? Thanks

from mlx-examples.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.