arya-ai-model commited on
Commit
5d13b40
·
1 Parent(s): 812fce0

updated model.py

Browse files
Files changed (1) hide show
  1. model.py +2 -2
model.py CHANGED
@@ -22,14 +22,14 @@ model = AutoModelForCausalLM.from_pretrained(
22
  ).to(device)
23
 
24
  def generate_code(prompt: str, max_tokens: int = 256):
25
- formatted_prompt = f"# Python\n{prompt}\n\n" # Ensure the model understands it's code
26
 
27
  inputs = tokenizer(
28
  formatted_prompt,
29
  return_tensors="pt",
30
  padding=True,
31
  truncation=True,
32
- max_length=1024 # Explicit max length to prevent issues
33
  ).to(device)
34
 
35
  output = model.generate(
 
22
  ).to(device)
23
 
24
  def generate_code(prompt: str, max_tokens: int = 256):
25
+ formatted_prompt = f"{prompt}\n### Code:\n" # Ensure the model understands it's code
26
 
27
  inputs = tokenizer(
28
  formatted_prompt,
29
  return_tensors="pt",
30
  padding=True,
31
  truncation=True,
32
+ max_length=512 # Explicit max length to prevent issues
33
  ).to(device)
34
 
35
  output = model.generate(