Git Product home page Git Product logo

Comments (4)

alextrott16 avatar alextrott16 commented on May 16, 2024

I believe this is due to the model having a default max_seq_len of 2048. Our mosaicml/mpt-7b-chat model should be able to extrapolate to longer sequences, but you have to set a different max_seq_len via the script arguments.
For example
python hf_chat.py -n mosaicml/mpt-7b-chat --max_seq_len 4096 ...

from llm-foundry.

patrickhwood avatar patrickhwood commented on May 16, 2024

I think it'll eventually overflow unless the history is periodically pruned.

from llm-foundry.

alextrott16 avatar alextrott16 commented on May 16, 2024

True. Thanks for the suggestion.

We would need to add logic for that into the model's source code on the HF hub. I don't think we can make that change via llm-foundry code, so I'll close this issue for now and see if automatic pruning is an option for later.

Feel free to add more comments if other issues arise and I'll reopen if necessary.

from llm-foundry.

patrickhwood avatar patrickhwood commented on May 16, 2024

One possibility would be to prune the conversation in the ht_chat.py script to some number of previous Q/A pairs, e.g.,

 def conversation(model, tokenizer: Tokenizer, user_inp: str, history: str,
                  **generate_kwargs: Dict[str, Any]) -> Tuple[str, str, float]:
     if history != '':
+        if len(history.split("<|im_start|>")) > 12:
+            # note first element from split is the empty string
+            # so skip that and first user input and assistant response
+            newhistory = "<|im_start|>" + history.split("<|im_start|>")[1]
+            for y in history.split("<|im_start|>")[4:]:
+                newhistory += "<|im_start|>" + y
+            history = newhistory

(A little ugly, but it works for me.)

from llm-foundry.

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.