Coder Social home page Coder Social logo

Comments (3)

lopuhin avatar lopuhin commented on July 24, 2024

I'm not yet sure if this might be related to having an extra pad token in the model -- but if I remove it the error is still there and all the weights have original shape. HF is misbehaving so can't download the unmodified model right now.

from gpt-fast.

lopuhin avatar lopuhin commented on July 24, 2024

Reopening as this does not look related to the custom tokenizer -- I can reproduce the issue on the original llama-2-13b-chat-hf model.

from gpt-fast.

lopuhin avatar lopuhin commented on July 24, 2024

A possible fix inspired by Lightning-AI/litgpt#774 is to add a clone() call (committed in 636cd76)

diff --git a/generate.py b/generate.py
index 7f30de0..cb4d7e6 100644
--- a/generate.py
+++ b/generate.py
@@ -161,7 +161,7 @@ def generate(
     seq = empty
     input_pos = torch.arange(0, T, device=device)
 
-    next_token = prefill(model, prompt.view(1, -1), input_pos, **sampling_kwargs)
+    next_token = prefill(model, prompt.view(1, -1), input_pos, **sampling_kwargs).clone()
     if is_speculative:
         prefill(draft_model, prompt.view(1, -1), input_pos, **sampling_kwargs)

This removes the error, but there is no speedup for prompt of 708 tokens when doing --compile_prefill, but it's clear that prefill slow-down is noticeable compared to a shorter prompt.

from gpt-fast.

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.