Spaces:
Running
Running
fixed unicoil issue
Browse files
app.py
CHANGED
@@ -18,14 +18,14 @@ except Exception as e:
|
|
18 |
print(f"Error loading SPLADE model: {e}")
|
19 |
print("Please ensure you have accepted any user access agreements on the Hugging Face Hub page for 'naver/splade-cocondenser-selfdistil'.")
|
20 |
|
|
|
21 |
# Load UNICOIL model for binary sparse encoding
|
22 |
try:
|
23 |
-
# UNICOIL models are typically just AutoModel as they add a linear layer
|
24 |
-
# on top of a BERT-like encoder to predict weights.
|
25 |
-
# 'castorini/unicoil-msmarco-passage' is a common UNICOIL checkpoint.
|
26 |
unicoil_model_name = "castorini/unicoil-msmarco-passage"
|
27 |
tokenizer_unicoil = AutoTokenizer.from_pretrained(unicoil_model_name)
|
28 |
-
|
|
|
|
|
29 |
model_unicoil.eval() # Set to evaluation mode for inference
|
30 |
print(f"UNICOIL model '{unicoil_model_name}' loaded successfully!")
|
31 |
except Exception as e:
|
|
|
18 |
print(f"Error loading SPLADE model: {e}")
|
19 |
print("Please ensure you have accepted any user access agreements on the Hugging Face Hub page for 'naver/splade-cocondenser-selfdistil'.")
|
20 |
|
21 |
+
# Load UNICOIL model for binary sparse encoding
|
22 |
# Load UNICOIL model for binary sparse encoding
|
23 |
try:
|
|
|
|
|
|
|
24 |
unicoil_model_name = "castorini/unicoil-msmarco-passage"
|
25 |
tokenizer_unicoil = AutoTokenizer.from_pretrained(unicoil_model_name)
|
26 |
+
# --- FIX IS HERE ---
|
27 |
+
model_unicoil = AutoModelForMaskedLM.from_pretrained(unicoil_model_name)
|
28 |
+
# -------------------
|
29 |
model_unicoil.eval() # Set to evaluation mode for inference
|
30 |
print(f"UNICOIL model '{unicoil_model_name}' loaded successfully!")
|
31 |
except Exception as e:
|