Skip to content
This repository was archived by the owner on Sep 10, 2025. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions torchchat/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,6 @@ def __init__(
"""
))
# fmt: on
# raise RuntimeError("You need to use --is-chat-model to indicate model has chat support.")
self.system_prompt = generator_args.prompt
self.tokenizer = _initialize_tokenizer(self.tokenizer_args)

Expand Down Expand Up @@ -493,7 +492,6 @@ def decode_n_tokens(
next_prob.clone() if next_prob is not None else None
)

# return new_tokens, new_probs

def model_forward(self, model, x, input_pos):
return model(x, input_pos)
Expand Down Expand Up @@ -593,8 +591,6 @@ def generate(
is_speculative = draft_model is not None
device, dtype = prompt.device, prompt.dtype

# create an empty tensor of the expected final shape and
# fill in the current tokens
if len(prompt.shape) > 1:
prompt = prompt.squeeze(0)
T = prompt.size(0)
Expand All @@ -620,11 +616,6 @@ def generate(
if model.config.model_type == ModelType.Flamingo:
model.reset_caches()

# create an empty tensor of the expected final shape and
# fill in the current tokens
empty = torch.empty(T_new, dtype=dtype, device=device)
empty[:T] = prompt

input_pos = torch.arange(
start_pos, T + start_pos, device=device, dtype=torch.int
)
Expand Down
Loading