QAway-to commited on
Commit
dc0b1bc
·
1 Parent(s): 34fcc83

Change tokenizer v1.0

Browse files
Files changed (1) hide show
  1. core/interviewer.py +6 -4
core/interviewer.py CHANGED
@@ -8,22 +8,24 @@ Generates random MBTI-style questions using a fine-tuned model.
8
  """
9
 
10
  import random, torch, re
11
- from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
12
 
13
  # --------------------------------------------------------------
14
  # 1️⃣ Настройки модели
15
  # --------------------------------------------------------------
16
  QG_MODEL = "f3nsmart/ft-flan-t5-base-qgen"
17
 
18
- tokenizer = AutoTokenizer.from_pretrained(QG_MODEL)
 
19
  model = AutoModelForSeq2SeqLM.from_pretrained(QG_MODEL)
 
20
  device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
21
  model.to(device).eval()
22
 
23
- print(f"✅ Loaded interviewer model: {QG_MODEL}")
24
 
25
  # --------------------------------------------------------------
26
- # 2️⃣ Базовые промпты (легкий "seed", без инструкций)
27
  # --------------------------------------------------------------
28
  PROMPTS = [
29
  "Personality and emotions.",
 
8
  """
9
 
10
  import random, torch, re
11
+ from transformers import AutoModelForSeq2SeqLM, T5Tokenizer
12
 
13
  # --------------------------------------------------------------
14
  # 1️⃣ Настройки модели
15
  # --------------------------------------------------------------
16
  QG_MODEL = "f3nsmart/ft-flan-t5-base-qgen"
17
 
18
+ # Используем "slow" SentencePiece токенайзер
19
+ tokenizer = T5Tokenizer.from_pretrained(QG_MODEL, use_fast=False)
20
  model = AutoModelForSeq2SeqLM.from_pretrained(QG_MODEL)
21
+
22
  device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
23
  model.to(device).eval()
24
 
25
+ print(f"✅ Loaded interviewer model (slow tokenizer): {QG_MODEL}")
26
 
27
  # --------------------------------------------------------------
28
+ # 2️⃣ Базовые seed-промпты (без инструкций)
29
  # --------------------------------------------------------------
30
  PROMPTS = [
31
  "Personality and emotions.",