Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -8,17 +8,19 @@ model_name = "TuringsSolutions/TechLegalV1"
|
|
8 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
9 |
|
10 |
# Load adapter configuration manually
|
11 |
-
|
12 |
-
|
13 |
|
14 |
-
|
|
|
|
|
15 |
adapter_config = json.load(f)
|
16 |
|
17 |
# Initialize the model with the adapter configuration
|
18 |
model = AutoModel.from_pretrained(model_name, trust_remote_code=True)
|
19 |
|
20 |
# Load adapter weights
|
21 |
-
model.load_adapter(
|
22 |
|
23 |
# Function to make predictions
|
24 |
def predict(text):
|
|
|
8 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
9 |
|
10 |
# Load adapter configuration manually
|
11 |
+
adapter_config_url = "https://huggingface.co/TuringsSolutions/TechLegalV1/resolve/main/adapter_config.json"
|
12 |
+
adapter_model_url = "https://huggingface.co/TuringsSolutions/TechLegalV1/resolve/main/adapter_model.safetensors"
|
13 |
|
14 |
+
# Download and load the adapter configuration
|
15 |
+
adapter_config = torch.hub.download_url_to_file(adapter_config_url, 'adapter_config.json')
|
16 |
+
with open(adapter_config, 'r') as f:
|
17 |
adapter_config = json.load(f)
|
18 |
|
19 |
# Initialize the model with the adapter configuration
|
20 |
model = AutoModel.from_pretrained(model_name, trust_remote_code=True)
|
21 |
|
22 |
# Load adapter weights
|
23 |
+
model.load_adapter(adapter_model_url, config=adapter_config)
|
24 |
|
25 |
# Function to make predictions
|
26 |
def predict(text):
|