Sean-Case commited on
Commit
c2bf185
1 Parent(s): 87306c7

LLM model save is failing in Huggingface - attempting instead to save to base folder

Browse files
funcs/representation_model.py CHANGED
@@ -143,10 +143,12 @@ def create_representation_model(representation_type, llm_config, hf_model_name,
143
 
144
  # Check for HF_HOME environment variable and supply a default value if it's not found (typical location for huggingface models)
145
  # Get HF_HOME environment variable or default to "~/.cache/huggingface/hub"
146
- hf_home_value = os.getenv("HF_HOME", "~/.cache/huggingface/hub")
 
147
 
148
  # Expand the user symbol '~' to the full home directory path
149
- hf_home_value = os.path.expanduser(hf_home_value)
 
150
 
151
  # Check if the directory exists, create it if it doesn't
152
  if not os.path.exists(hf_home_value):
 
143
 
144
  # Check for HF_HOME environment variable and supply a default value if it's not found (typical location for huggingface models)
145
  # Get HF_HOME environment variable or default to "~/.cache/huggingface/hub"
146
+ base_folder = "." #"~/.cache/huggingface/hub"
147
+ hf_home_value = os.getenv("HF_HOME", base_folder)
148
 
149
  # Expand the user symbol '~' to the full home directory path
150
+ if "~" in base_folder:
151
+ hf_home_value = os.path.expanduser(hf_home_value)
152
 
153
  # Check if the directory exists, create it if it doesn't
154
  if not os.path.exists(hf_home_value):
funcs/topic_core_funcs.py CHANGED
@@ -181,7 +181,7 @@ def extract_topics(data, in_files, min_docs_slider, in_colnames, max_topics_slid
181
 
182
  progress(0.3, desc= "Embeddings loaded. Creating BERTopic model")
183
 
184
- fail_error_message = "Topic model creation failed. If you have a small dataset, try reducing minimum documents per topic."
185
 
186
  if not candidate_topics:
187
 
 
181
 
182
  progress(0.3, desc= "Embeddings loaded. Creating BERTopic model")
183
 
184
+ fail_error_message = "Topic model creation failed. Try reducing minimum documents per topic on the slider above (try 15 or less), then click 'Extract topics' again."
185
 
186
  if not candidate_topics:
187