Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -11,7 +11,6 @@ llamma_template = """<s>[INST]<<SYS>>I want you to act as document language tran
|
|
11 |
{query}
|
12 |
End of the document.[/INST]
|
13 |
{target} translated document:
|
14 |
-
|
15 |
"""
|
16 |
|
17 |
starchat_template = """<|system|>I want you to act as document language translator. You do translation {source} texts in document into then you return to me the translated document AND DO NOTHING ELSE.<</SYS>>
|
@@ -20,15 +19,14 @@ Begin of the document:
|
|
20 |
End of the document<|end|>
|
21 |
<|assistant|>
|
22 |
{target} translated document:
|
23 |
-
|
24 |
"""
|
25 |
|
26 |
bloom_template = """Translate bellow {source} text into {target}:
|
27 |
{query}
|
28 |
======
|
29 |
{target} translated text:
|
30 |
-
|
31 |
"""
|
|
|
32 |
model_kwargs={
|
33 |
"max_new_tokens":2048,
|
34 |
"temperature": 0.01,
|
@@ -48,8 +46,6 @@ bloom_model_kwargs={
|
|
48 |
llm1 = HuggingFaceHub(repo_id=llama_repo, task="text-generation", model_kwargs=model_kwargs)
|
49 |
llm2 = HuggingFaceHub(repo_id=starchat_repo, task="text-generation", model_kwargs=model_kwargs)
|
50 |
llm3 = HuggingFaceHub(repo_id=bloom_repo, task="text-generation", model_kwargs=bloom_model_kwargs)
|
51 |
-
|
52 |
-
client = InferenceClient()
|
53 |
|
54 |
def translation(source, target, text):
|
55 |
response = text
|
|
|
11 |
{query}
|
12 |
End of the document.[/INST]
|
13 |
{target} translated document:
|
|
|
14 |
"""
|
15 |
|
16 |
starchat_template = """<|system|>I want you to act as document language translator. You do translation {source} texts in document into then you return to me the translated document AND DO NOTHING ELSE.<</SYS>>
|
|
|
19 |
End of the document<|end|>
|
20 |
<|assistant|>
|
21 |
{target} translated document:
|
|
|
22 |
"""
|
23 |
|
24 |
bloom_template = """Translate bellow {source} text into {target}:
|
25 |
{query}
|
26 |
======
|
27 |
{target} translated text:
|
|
|
28 |
"""
|
29 |
+
|
30 |
model_kwargs={
|
31 |
"max_new_tokens":2048,
|
32 |
"temperature": 0.01,
|
|
|
46 |
llm1 = HuggingFaceHub(repo_id=llama_repo, task="text-generation", model_kwargs=model_kwargs)
|
47 |
llm2 = HuggingFaceHub(repo_id=starchat_repo, task="text-generation", model_kwargs=model_kwargs)
|
48 |
llm3 = HuggingFaceHub(repo_id=bloom_repo, task="text-generation", model_kwargs=bloom_model_kwargs)
|
|
|
|
|
49 |
|
50 |
def translation(source, target, text):
|
51 |
response = text
|