Explorar o código

Context length reading configuration file (#540)

刘悦 hai 1 ano
pai
achega
79072603b9
Modificáronse 1 ficheiros con 3 adicións e 1 borrados
  1. 3 1
      tools/llama/generate.py

+ 3 - 1
tools/llama/generate.py

@@ -241,7 +241,9 @@ def generate(
 
     codebook_dim = 1 + model.config.num_codebooks
     # create an empty tensor of the expected final shape and fill in the current tokens
-    empty = torch.empty((codebook_dim, max_new_tokens), dtype=dtype, device=device)
+    empty = torch.empty(
+        (codebook_dim, model.config.max_seq_len), dtype=dtype, device=device
+    )
     empty[:, :T] = prompt
     seq = empty
     input_pos = torch.arange(0, T, device=device)