Spaces:
Sleeping
Sleeping
Use the BetterTransformer pipeline for faster inference (#5)
Browse files- add optimum (992ecc8a1442bc463cb5f181758a01895ce8696e)
- use the bettertransformer pipeline (0652b75f4bd681f9bacee44a5451ade2ad67a297)
- app.py +2 -2
- requirements.txt +1 -0
app.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
import gradio as gr
|
2 |
-
from
|
3 |
|
4 |
-
pipeline = pipeline(task="translation", model="lgrobol/m2m100_418M_br_fr")
|
5 |
|
6 |
def predict(texts):
|
7 |
predictions = pipeline(texts.splitlines(), src_lang="br", tgt_lang="fr")
|
|
|
1 |
import gradio as gr
|
2 |
+
from optimum.pipelines import pipeline
|
3 |
|
4 |
+
pipeline = pipeline(task="translation", model="lgrobol/m2m100_418M_br_fr", accelerator="bettertransformer")
|
5 |
|
6 |
def predict(texts):
|
7 |
predictions = pipeline(texts.splitlines(), src_lang="br", tgt_lang="fr")
|
requirements.txt
CHANGED
@@ -1,3 +1,4 @@
|
|
|
|
1 |
sentencepiece
|
2 |
transformers
|
3 |
torch
|
|
|
1 |
+
optimum
|
2 |
sentencepiece
|
3 |
transformers
|
4 |
torch
|