Joshua Perk commited on
Commit
b13dd2b
•
1 Parent(s): d66da82

Revert to deepset model only

Browse files
config.json CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:affcab423cf457c5772f3964841cde223b6e8bf0beb34624ed70174bc3752f35
3
- size 1707
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e1d8e25d7e2253e2cdf052086eb65616b5c239cfa17febbeb22c28cb9601b9c8
3
+ size 1703
decoder_model.onnx DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:ff3b4a6bb62ddd4fe4f9b541a9c6197326118fb855ea2785bb66d1687b0d86d8
3
- size 1222666655
 
 
 
decoder_with_past_model.onnx DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:ea74662431a57df2675e9d950d629e42aab2fa18c929094135e7c80203f6f627
3
- size 1121888515
 
 
 
encoder_model.onnx DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:1b1a5e7021e95441c44514c23c4316548c4bd1e428559aea2c9359787ca67a7f
3
- size 814841685
 
 
 
old/export_model.py → export_model.py RENAMED
@@ -1,11 +1,22 @@
 
 
 
 
 
 
 
 
1
  from optimum.onnxruntime import ORTModelForSeq2SeqLM
2
  from transformers import AutoTokenizer
 
3
  model_checkpoint = "getvector/earnings-transcript-summary"
4
  save_directory = "tmp/onnx/"
5
  huggingface_auth_token = "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"
 
6
  # Load a model from transformers and export it to ONNX
7
  ort_model = ORTModelForSeq2SeqLM.from_pretrained(model_checkpoint, from_transformers=True, use_auth_token=huggingface_auth_token)
8
  tokenizer = AutoTokenizer.from_pretrained(model_checkpoint, use_auth_token=huggingface_auth_token)
 
9
  # Save the onnx model and tokenizer
10
  ort_model.save_pretrained(save_directory)
11
  tokenizer.save_pretrained(save_directory)
1
+ '''
2
+ A script to convert this normal/deepset model into an onnx model for further optimization.
3
+ Use the local .env and install the requirements
4
+ Make sure the model checkpoint name is correct (or convert to do this locally)
5
+ Make sure the auth token has access to the model
6
+ '''
7
+
8
+
9
  from optimum.onnxruntime import ORTModelForSeq2SeqLM
10
  from transformers import AutoTokenizer
11
+
12
  model_checkpoint = "getvector/earnings-transcript-summary"
13
  save_directory = "tmp/onnx/"
14
  huggingface_auth_token = "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"
15
+
16
  # Load a model from transformers and export it to ONNX
17
  ort_model = ORTModelForSeq2SeqLM.from_pretrained(model_checkpoint, from_transformers=True, use_auth_token=huggingface_auth_token)
18
  tokenizer = AutoTokenizer.from_pretrained(model_checkpoint, use_auth_token=huggingface_auth_token)
19
+
20
  # Save the onnx model and tokenizer
21
  ort_model.save_pretrained(save_directory)
22
  tokenizer.save_pretrained(save_directory)
handler.py DELETED
@@ -1,17 +0,0 @@
1
- from optimum.onnxruntime import ORTModelForSeq2SeqLM
2
- from transformers import pipeline, AutoTokenizer
3
-
4
- class EndpointHandler():
5
- def __init__(self, path=""):
6
- model = ORTModelForSeq2SeqLM.from_pretrained(path)
7
- tokenizer = AutoTokenizer.from_pretrained(path)
8
- self.pipeline = pipeline("summarization", model=model, tokenizer=tokenizer)
9
-
10
- def __call__(self, data):
11
- inputs = data.pop("inputs", data)
12
- parameters = data.pop("parameters", None)
13
- if parameters is not None:
14
- summary = self.pipeline(inputs, **parameters)
15
- else:
16
- summary = self.pipeline(inputs)
17
- return summary
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
old-req.txt DELETED
@@ -1,24 +0,0 @@
1
- certifi==2022.9.24
2
- charset-normalizer==2.1.1
3
- coloredlogs==15.0.1
4
- filelock==3.8.0
5
- huggingface-hub==0.10.0
6
- humanfriendly==10.0
7
- idna==3.4
8
- mpmath==1.2.1
9
- numpy==1.23.3
10
- optimum==1.4.0
11
- packaging==21.3
12
- protobuf==3.20.1
13
- pyparsing==3.0.9
14
- PyYAML==6.0
15
- regex==2022.9.13
16
- requests==2.28.1
17
- sentencepiece==0.1.97
18
- sympy==1.11.1
19
- tokenizers==0.12.1
20
- torch==1.12.1
21
- tqdm==4.64.1
22
- transformers==4.22.2
23
- typing_extensions==4.3.0
24
- urllib3==1.26.12
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
old/config.json DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:e1d8e25d7e2253e2cdf052086eb65616b5c239cfa17febbeb22c28cb9601b9c8
3
- size 1703
 
 
 
old/merges.txt DELETED
The diff for this file is too large to render. See raw diff
old/special_tokens_map.json DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:06e405a36dfe4b9604f484f6a1e619af1a7f7d09e34a8555eb0b77b66318067f
3
- size 280
 
 
 
old/tokenizer.json DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:4dcc90e1c6bea98fde74f85a2a307a1935fe9067bd4c9d6623c520965efce58f
3
- size 2108689
 
 
 
old/tokenizer_config.json DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:c3d09c165ebe460bc0c338606208e725ce9e1c24df798a156d43cd854fff12db
3
- size 375
 
 
 
old/vocab.json DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:ed19656ea1707df69134c4af35c8ceda2cc9860bf2c3495026153a133670ab5e
3
- size 798293
 
 
 
old/pytorch_model.bin → pytorch_model.bin RENAMED
File without changes
requirements.txt CHANGED
@@ -1 +1,24 @@
1
- optimum[onnxruntime]==1.4.0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ certifi==2022.9.24
2
+ charset-normalizer==2.1.1
3
+ coloredlogs==15.0.1
4
+ filelock==3.8.0
5
+ huggingface-hub==0.10.0
6
+ humanfriendly==10.0
7
+ idna==3.4
8
+ mpmath==1.2.1
9
+ numpy==1.23.3
10
+ optimum==1.4.0
11
+ packaging==21.3
12
+ protobuf==3.20.1
13
+ pyparsing==3.0.9
14
+ PyYAML==6.0
15
+ regex==2022.9.13
16
+ requests==2.28.1
17
+ sentencepiece==0.1.97
18
+ sympy==1.11.1
19
+ tokenizers==0.12.1
20
+ torch==1.12.1
21
+ tqdm==4.64.1
22
+ transformers==4.22.2
23
+ typing_extensions==4.3.0
24
+ urllib3==1.26.12
tokenizer_config.json CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:9c88e5132bac58e796a8cd076e7c9d3bd93f701c1bf5454486f7d24846150025
3
- size 403
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c3d09c165ebe460bc0c338606208e725ce9e1c24df798a156d43cd854fff12db
3
+ size 375