Al04ni commited on
Commit
76864f3
·
verified ·
1 Parent(s): cb4c0ee

Update nllb.py

Browse files

Clarifying the model to use and cleaning the page ui in general.

Files changed (1) hide show
  1. nllb.py +5 -6
nllb.py CHANGED
@@ -7,9 +7,8 @@ model_dict = {}
7
  def load_models(model_name: str):
8
  # build model and tokenizer
9
  model_name_dict = {
10
- "nllb-1.3B": "facebook/nllb-200-1.3B",
11
  "nllb-distilled-1.3B": "facebook/nllb-200-distilled-1.3B",
12
- "nllb-3.3B": "facebook/nllb-200-3.3B",
13
  }[model_name]
14
 
15
  print("\tLoading model: %s" % model_name)
@@ -42,15 +41,12 @@ def translation(model_name: str, source, target, text: str):
42
 
43
  output = output[0]["translation_text"]
44
  result = {
45
- "source": source,
46
- "target": target,
47
  "result": output,
48
  }
49
 
50
  return result
51
 
52
-
53
- NLLB_EXAMPLES = [
54
  ["nllb-distilled-1.3B", "English", "Shan", "Hello, how are you today?"],
55
  ["nllb-distilled-1.3B", "Shan", "English", "မႂ်ႇသုင်ၶႃႈ ယူႇလီယူႇၶႃႈၼေႃႈ"],
56
  [
@@ -59,4 +55,7 @@ NLLB_EXAMPLES = [
59
  "Shan",
60
  "Forming Myanmar’s New Political System Will Remain an Ideal but Never in Practicality",
61
  ],
 
 
 
62
  ]
 
7
  def load_models(model_name: str):
8
  # build model and tokenizer
9
  model_name_dict = {
10
+ # Here we aim to use only Distilled model
11
  "nllb-distilled-1.3B": "facebook/nllb-200-distilled-1.3B",
 
12
  }[model_name]
13
 
14
  print("\tLoading model: %s" % model_name)
 
41
 
42
  output = output[0]["translation_text"]
43
  result = {
 
 
44
  "result": output,
45
  }
46
 
47
  return result
48
 
49
+ '''NLLB_EXAMPLES = [
 
50
  ["nllb-distilled-1.3B", "English", "Shan", "Hello, how are you today?"],
51
  ["nllb-distilled-1.3B", "Shan", "English", "မႂ်ႇသုင်ၶႃႈ ယူႇလီယူႇၶႃႈၼေႃႈ"],
52
  [
 
55
  "Shan",
56
  "Forming Myanmar’s New Political System Will Remain an Ideal but Never in Practicality",
57
  ],
58
+
59
+ '''
60
+
61
  ]