File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -762,7 +762,7 @@ def embed(
762
762
"""
763
763
assert self ._ctx .ctx is not None
764
764
n_embd = self .n_embd ()
765
- n_ctx = self .n_ctx ()
765
+ n_batch = self .n_batch
766
766
767
767
if self .context_params .embedding == False :
768
768
raise RuntimeError (
@@ -807,19 +807,19 @@ def decode_batch(n_seq: int):
807
807
for text in inputs :
808
808
tokens = self .tokenize (text .encode ("utf-8" ))
809
809
if truncate :
810
- tokens = tokens [:n_ctx ]
810
+ tokens = tokens [:n_batch ]
811
811
812
812
n_tokens = len (tokens )
813
813
total_tokens += n_tokens
814
814
815
815
# check for overrun
816
- if n_tokens > n_ctx :
816
+ if n_tokens > n_batch :
817
817
raise ValueError (
818
- f"Requested tokens ({ n_tokens } ) exceed context window of { n_ctx } "
818
+ f"Requested tokens ({ n_tokens } ) exceed batch size of { n_batch } "
819
819
)
820
820
821
821
# time to eval batch
822
- if t_batch + n_tokens > self . _n_ctx :
822
+ if t_batch + n_tokens > n_batch :
823
823
decode_batch (p_batch )
824
824
t_batch = 0
825
825
p_batch = 0
You can’t perform that action at this time.
0 commit comments