eljanmahammadli commited on
Commit
924cb86
·
1 Parent(s): 7f46ae3

merged adapter and base model for XL

Browse files
__pycache__/ai_generate.cpython-39.pyc DELETED
Binary file (3.85 kB)
 
__pycache__/app.cpython-39.pyc DELETED
Binary file (19.2 kB)
 
__pycache__/humanize.cpython-39.pyc DELETED
Binary file (2.58 kB)
 
humanize.py CHANGED
@@ -26,23 +26,16 @@ batch_size = 64
26
  model_config = {
27
  "Base Model": "polygraf-ai/poly-humanizer-base",
28
  "Large Model": "polygraf-ai/poly-humanizer-large",
29
- "XL Model": "polygraf-ai/poly-humanizer-XL-adapter-v2",
30
  }
31
 
32
  # cache the base models, tokenizers, and adapters
33
  # initialize model and tokenizer
34
  models, tokenizers = {}, {}
35
  for name, path in model_config.items():
36
- if name == "XL Model":
37
- model = T5ForConditionalGeneration.from_pretrained("google/flan-t5-xl", torch_dtype=torch.bfloat16).to(device)
38
- model = PeftModel.from_pretrained(model, path, torch_dtype=torch.bfloat16, is_trainable=False)
39
- model = model.merge_and_unload()
40
- models[name] = model
41
- tokenizers[name] = T5Tokenizer.from_pretrained("google/flan-t5-xl")
42
- else:
43
- model = T5ForConditionalGeneration.from_pretrained(path, torch_dtype=torch.bfloat16).to(device)
44
- models[name] = model
45
- tokenizers[name] = T5Tokenizer.from_pretrained(path)
46
  print(f"Loaded model: {name}, Num. params: {model.num_parameters()}")
47
 
48
 
 
26
  model_config = {
27
  "Base Model": "polygraf-ai/poly-humanizer-base",
28
  "Large Model": "polygraf-ai/poly-humanizer-large",
29
+ "XL Model": "polygraf-ai/poly-humanizer-XL-merged-v2",
30
  }
31
 
32
  # cache the base models, tokenizers, and adapters
33
  # initialize model and tokenizer
34
  models, tokenizers = {}, {}
35
  for name, path in model_config.items():
36
+ model = T5ForConditionalGeneration.from_pretrained(path, torch_dtype=torch.bfloat16).to(device)
37
+ tokenizers[name] = T5Tokenizer.from_pretrained(path)
38
+ models[name] = model
 
 
 
 
 
 
 
39
  print(f"Loaded model: {name}, Num. params: {model.num_parameters()}")
40
 
41