Kevin Fink
commited on
Commit
·
40b3dde
1
Parent(s):
726e681
dev
Browse files
app.py
CHANGED
@@ -251,9 +251,6 @@ def predict(text):
|
|
251 |
#initialize_weights(model)
|
252 |
tokenizer = AutoTokenizer.from_pretrained('shorecode/t5-efficient-tiny-nh8-summarizer')
|
253 |
inputs = tokenizer(text, padding='max_length', max_length=512, truncation=True)
|
254 |
-
if torch.cuda.is_available():
|
255 |
-
model = model.to('cuda')
|
256 |
-
inputs = {key: value.to('cuda') for key, value in inputs.items()}
|
257 |
with torch.no_grad(): # Disable gradient calculation for inference
|
258 |
outputs = model.generate(inputs)
|
259 |
predictions = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
|
|
251 |
#initialize_weights(model)
|
252 |
tokenizer = AutoTokenizer.from_pretrained('shorecode/t5-efficient-tiny-nh8-summarizer')
|
253 |
inputs = tokenizer(text, padding='max_length', max_length=512, truncation=True)
|
|
|
|
|
|
|
254 |
with torch.no_grad(): # Disable gradient calculation for inference
|
255 |
outputs = model.generate(inputs)
|
256 |
predictions = tokenizer.decode(outputs[0], skip_special_tokens=True)
|