AndriiPets commited on
Commit
90748dd
1 Parent(s): 7e83029
generator.py CHANGED
@@ -11,12 +11,14 @@ from utils.api import generate_cook_image
11
  from utils.translators.translate_recepie import translate_recepie
12
  from utils.translators.translate_input import translate_input
13
 
 
 
14
 
15
  model_name_or_path = "flax-community/t5-recipe-generation"
16
  task = "text2text-generation"
17
 
18
  tokenizer = AutoTokenizer.from_pretrained(
19
- model_name_or_path, cache_dir='.\cache')
20
  generator = pipeline(task, model=model_name_or_path,
21
  tokenizer=model_name_or_path)
22
 
 
11
  from utils.translators.translate_recepie import translate_recepie
12
  from utils.translators.translate_input import translate_input
13
 
14
+ os.environ['TRANSFORMERS_CACHE'] = './cache'
15
+
16
 
17
  model_name_or_path = "flax-community/t5-recipe-generation"
18
  task = "text2text-generation"
19
 
20
  tokenizer = AutoTokenizer.from_pretrained(
21
+ model_name_or_path)
22
  generator = pipeline(task, model=model_name_or_path,
23
  tokenizer=model_name_or_path)
24
 
utils/translators/en_ru/en_ru.py CHANGED
@@ -2,9 +2,9 @@
2
  from transformers import FSMTForConditionalGeneration, FSMTTokenizer
3
  mname = "facebook/wmt19-en-ru"
4
  tokenizer = FSMTTokenizer.from_pretrained(
5
- mname, cache_dir='../../../cache')
6
  model = FSMTForConditionalGeneration.from_pretrained(
7
- mname, cache_dir='../../../cache')
8
 
9
 
10
  def translator_en_ru(text):
 
2
  from transformers import FSMTForConditionalGeneration, FSMTTokenizer
3
  mname = "facebook/wmt19-en-ru"
4
  tokenizer = FSMTTokenizer.from_pretrained(
5
+ mname)
6
  model = FSMTForConditionalGeneration.from_pretrained(
7
+ mname)
8
 
9
 
10
  def translator_en_ru(text):
utils/translators/en_ru/ru_en.py CHANGED
@@ -2,9 +2,9 @@
2
  from transformers import FSMTForConditionalGeneration, FSMTTokenizer
3
  mname = "facebook/wmt19-ru-en"
4
  tokenizer = FSMTTokenizer.from_pretrained(
5
- mname, cache_dir='../../../cache')
6
  model = FSMTForConditionalGeneration.from_pretrained(
7
- mname, cache_dir='../../../cache')
8
 
9
 
10
  def translate_ru_en(text):
 
2
  from transformers import FSMTForConditionalGeneration, FSMTTokenizer
3
  mname = "facebook/wmt19-ru-en"
4
  tokenizer = FSMTTokenizer.from_pretrained(
5
+ mname)
6
  model = FSMTForConditionalGeneration.from_pretrained(
7
+ mname)
8
 
9
 
10
  def translate_ru_en(text):