AhmedSSoliman commited on
Commit
a3126ee
·
1 Parent(s): 1e6688b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -8,8 +8,8 @@ model = AutoModelForSeq2SeqLM.from_pretrained("AhmedSSoliman/MarianCG_NL2Code")
8
 
9
  def generate_code(NL):
10
  inputs = tokenizer([NL], padding="max_length", truncation=True, max_length=512, return_tensors="pt")
11
- input_ids = inputs.input_ids.to("cuda")
12
- attention_mask = inputs.attention_mask.to("cuda")
13
  outputs = new_model.generate(input_ids, attention_mask=attention_mask)
14
  # all special tokens including will be removed
15
  output_code = tokenizer.batch_decode(outputs, skip_special_tokens=True)
 
8
 
9
  def generate_code(NL):
10
  inputs = tokenizer([NL], padding="max_length", truncation=True, max_length=512, return_tensors="pt")
11
+ input_ids = inputs.input_ids
12
+ attention_mask = inputs.attention_mask
13
  outputs = new_model.generate(input_ids, attention_mask=attention_mask)
14
  # all special tokens including will be removed
15
  output_code = tokenizer.batch_decode(outputs, skip_special_tokens=True)