Model save
Browse files- README.md +2 -2
- config.json +0 -1
- handler.py +27 -0
- pytorch_model.bin +1 -1
- requirments.txt +2 -0
- training_args.bin +1 -1
README.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
---
|
2 |
-
|
3 |
tags:
|
4 |
- generated_from_trainer
|
5 |
model-index:
|
@@ -12,7 +12,7 @@ should probably proofread and complete it, then remove this comment. -->
|
|
12 |
|
13 |
# bert-geolocation-prediction
|
14 |
|
15 |
-
This model is a fine-tuned version of [](https://huggingface.co/) on an unknown dataset.
|
16 |
|
17 |
## Model description
|
18 |
|
|
|
1 |
---
|
2 |
+
license: apache-2.0
|
3 |
tags:
|
4 |
- generated_from_trainer
|
5 |
model-index:
|
|
|
12 |
|
13 |
# bert-geolocation-prediction
|
14 |
|
15 |
+
This model is a fine-tuned version of [bert-base-multilingual-cased](https://huggingface.co/bert-base-multilingual-cased) on an unknown dataset.
|
16 |
|
17 |
## Model description
|
18 |
|
config.json
CHANGED
@@ -11,7 +11,6 @@
|
|
11 |
"intermediate_size": 3072,
|
12 |
"layer_norm_eps": 1e-12,
|
13 |
"max_position_embeddings": 512,
|
14 |
-
"model_type": "bert-geo-regressor",
|
15 |
"num_attention_heads": 12,
|
16 |
"num_hidden_layers": 12,
|
17 |
"pad_token_id": 0,
|
|
|
11 |
"intermediate_size": 3072,
|
12 |
"layer_norm_eps": 1e-12,
|
13 |
"max_position_embeddings": 512,
|
|
|
14 |
"num_attention_heads": 12,
|
15 |
"num_hidden_layers": 12,
|
16 |
"pad_token_id": 0,
|
handler.py
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from typing import Dict, List, Any
|
2 |
+
import torch
|
3 |
+
from transformers import pipeline
|
4 |
+
|
5 |
+
class EndpointHandler():
|
6 |
+
def __init__(self, path=""):
|
7 |
+
self.pipeline = pipeline("geo-regression", model=path)
|
8 |
+
|
9 |
+
def __call__(self, data: Dict[str, Any]) -> List[Dict[str, Any]]:
|
10 |
+
"""
|
11 |
+
data args:
|
12 |
+
inputs (:obj: `str`)
|
13 |
+
date (:obj: `str`)
|
14 |
+
Return:
|
15 |
+
A :obj:`list` | `dict`: will be serialized and returned
|
16 |
+
"""
|
17 |
+
# get inputs
|
18 |
+
inputs = data.pop("inputs", data)
|
19 |
+
# get additional date field
|
20 |
+
date = data.pop("date", None)
|
21 |
+
|
22 |
+
# check if date exists and if it is a holiday
|
23 |
+
|
24 |
+
# run normal prediction
|
25 |
+
prediction = self.pipeline(inputs)
|
26 |
+
return prediction
|
27 |
+
|
pytorch_model.bin
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
size 711543661
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:c09a0aba06c9e94944778dfd371d7dec4d9bcf6dcf60ab2481bbda48ecef0e34
|
3 |
size 711543661
|
requirments.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
pipe
|
2 |
+
handler
|
training_args.bin
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
size 3439
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:5446b669b3602b87aff7a66261257635a4e1337e7d796c9fa0eacad20dfd36e1
|
3 |
size 3439
|