michailroussos commited on
Commit
e82c023
·
1 Parent(s): 0787acc
Files changed (1) hide show
  1. app.py +9 -4
app.py CHANGED
@@ -50,15 +50,20 @@ def respond(
50
  tokenize=True,
51
  add_generation_prompt=True,
52
  return_tensors="pt",
53
- ).to("cuda")
 
 
 
 
54
 
55
  # Debug: Print tokenized inputs
56
- print("[DEBUG] Tokenized inputs:", inputs)
 
57
 
58
  # Generate response
59
  output_ids = model.generate(
60
- input_ids=inputs["input_ids"],
61
- attention_mask=inputs["attention_mask"],
62
  max_new_tokens=max_tokens,
63
  temperature=temperature,
64
  top_p=top_p,
 
50
  tokenize=True,
51
  add_generation_prompt=True,
52
  return_tensors="pt",
53
+ )
54
+
55
+ # Ensure tensor shapes are correct
56
+ input_ids = inputs["input_ids"].squeeze(0).to("cuda")
57
+ attention_mask = inputs["attention_mask"].squeeze(0).to("cuda")
58
 
59
  # Debug: Print tokenized inputs
60
+ print("[DEBUG] Tokenized input_ids shape:", input_ids.shape)
61
+ print("[DEBUG] Tokenized attention_mask shape:", attention_mask.shape)
62
 
63
  # Generate response
64
  output_ids = model.generate(
65
+ input_ids=input_ids,
66
+ attention_mask=attention_mask,
67
  max_new_tokens=max_tokens,
68
  temperature=temperature,
69
  top_p=top_p,