We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1f5f9cd commit 1f5a352Copy full SHA for 1f5a352
test/python/testpipeline/testtext/testtranslation.py
@@ -3,6 +3,9 @@
3
"""
4
5
import unittest
6
+import time
7
+
8
+import requests
9
10
from txtai.pipeline import Translation
11
@@ -20,6 +23,19 @@ def setUpClass(cls):
20
23
21
24
cls.translate = Translation()
22
25
26
+ # Preload list of models. Handle HF Hub errors.
27
+ complete, wait = False, 1
28
+ while not complete:
29
+ try:
30
+ cls.translate.lookup("en", "es")
31
+ complete = True
32
+ except requests.exceptions.HTTPError:
33
+ # Exponential backoff
34
+ time.sleep(wait)
35
36
+ # Wait up to 16 seconds
37
+ wait = min(wait * 2, 16)
38
39
def testDetect(self):
40
41
Test language detection
0 commit comments