idkash1 commited on
Commit
02fde74
·
verified ·
1 Parent(s): a042ddf

Update human_text_detect.py

Browse files
Files changed (1) hide show
  1. human_text_detect.py +6 -8
human_text_detect.py CHANGED
@@ -98,18 +98,16 @@ def detect_human_text(model_name, topic, text):
98
 
99
  print('Create dir')
100
  # Use a writable directory inside the Hugging Face Space
101
- os.makedirs("/tmp/cacheHuggingface/PHI2", exist_ok=True)
102
- os.makedirs("/tmp/cacheHuggingface/GPT2XL", exist_ok=True)
103
 
104
  # Init model
105
- print('Init model')
106
  lm_name = 'gpt2-xl' if model_name == 'GPT2XL' else 'microsoft/phi-2'
107
- tokenizer = AutoTokenizer.from_pretrained(lm_name, cache_dir=cache_dir)
108
-
109
- print("Save tokenizer")
110
- tokenizer.save_pretrained(cache_dir)
111
 
112
- model = AutoModelForCausalLM.from_pretrained(lm_name, cache_dir=cache_dir)
 
113
 
114
  print("Save model")
115
  model.save_pretrained(cache_dir)
 
98
 
99
  print('Create dir')
100
  # Use a writable directory inside the Hugging Face Space
101
+ # os.makedirs("/tmp/cacheHuggingface/PHI2", exist_ok=True)
102
+ # os.makedirs("/tmp/cacheHuggingface/GPT2XL", exist_ok=True)
103
 
104
  # Init model
105
+ print('Init tokenizer')
106
  lm_name = 'gpt2-xl' if model_name == 'GPT2XL' else 'microsoft/phi-2'
107
+ tokenizer = AutoTokenizer.from_pretrained(cache_dir) # lm_name, cache_dir=cache_dir
 
 
 
108
 
109
+ print('Init model')
110
+ model = AutoModelForCausalLM.from_pretrained(lm_name) #, cache_dir=cache_dir
111
 
112
  print("Save model")
113
  model.save_pretrained(cache_dir)