informers 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +14 -0
- data/README.md +53 -18
- data/lib/informers/feature_extraction.rb +59 -0
- data/lib/informers/fill_mask.rb +109 -0
- data/lib/informers/ner.rb +3 -3
- data/lib/informers/question_answering.rb +2 -5
- data/lib/informers/sentiment_analysis.rb +3 -2
- data/lib/informers/text_generation.rb +54 -0
- data/lib/informers/version.rb +1 -1
- data/lib/informers.rb +4 -0
- data/vendor/LICENSE-gpt2.txt +24 -0
- data/vendor/LICENSE-roberta.txt +21 -0
- data/vendor/gpt2.bin +0 -0
- data/vendor/gpt2.i2w +0 -0
- data/vendor/roberta.bin +0 -0
- data/vendor/roberta.i2w +0 -0
- metadata +25 -58
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 22f7bcebf0670078b65fdf9cba4d2b937c853a3b10cf36e47f50781e2663225c
|
4
|
+
data.tar.gz: 940c96ec6b749b7e0b0c283456e40bfe9e6cbb3a58e8fa11f6367e87b05d8694
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4cd8b58aae6e885409e297bc1ba09aedd029bb3dc26a193251f33c2bf6c9f6a8da69cb3727f799296a8c6644b014afc715e783a1e19a1074982af531e40db57b
|
7
|
+
data.tar.gz: 6f63489d0b303e9a7de13df11d5074bd4cb2dfa44febee4061262d5c188eeb62a7c975e89567048f801fa183c8d56925275768fccc9a4b5a48255abeeb379345
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,17 @@
|
|
1
|
+
## 0.2.0 (2022-09-06)
|
2
|
+
|
3
|
+
- Added support for `optimum` and `transformers.onnx` models
|
4
|
+
- Dropped support for Ruby < 2.7
|
5
|
+
|
6
|
+
## 0.1.3 (2021-09-25)
|
7
|
+
|
8
|
+
- Added text generation
|
9
|
+
- Added fill mask
|
10
|
+
|
11
|
+
## 0.1.2 (2020-11-24)
|
12
|
+
|
13
|
+
- Added feature extraction
|
14
|
+
|
1
15
|
## 0.1.1 (2020-10-05)
|
2
16
|
|
3
17
|
- Fixed question answering for Ruby < 2.7
|
data/README.md
CHANGED
@@ -7,24 +7,16 @@ Supports:
|
|
7
7
|
- Sentiment analysis
|
8
8
|
- Question answering
|
9
9
|
- Named-entity recognition
|
10
|
-
- Text generation
|
11
|
-
- Summarization - *in development*
|
12
|
-
- Translation - *in development*
|
10
|
+
- Text generation
|
13
11
|
|
14
|
-
[![Build Status](https://
|
12
|
+
[![Build Status](https://github.com/ankane/informers/workflows/build/badge.svg?branch=master)](https://github.com/ankane/informers/actions)
|
15
13
|
|
16
14
|
## Installation
|
17
15
|
|
18
16
|
Add this line to your application’s Gemfile:
|
19
17
|
|
20
18
|
```ruby
|
21
|
-
gem
|
22
|
-
```
|
23
|
-
|
24
|
-
On Mac, also install OpenMP:
|
25
|
-
|
26
|
-
```sh
|
27
|
-
brew install libomp
|
19
|
+
gem "informers"
|
28
20
|
```
|
29
21
|
|
30
22
|
## Getting Started
|
@@ -32,6 +24,9 @@ brew install libomp
|
|
32
24
|
- [Sentiment analysis](#sentiment-analysis)
|
33
25
|
- [Question answering](#question-answering)
|
34
26
|
- [Named-entity recognition](#named-entity-recognition)
|
27
|
+
- [Text generation](#text-generation)
|
28
|
+
- [Feature extraction](#feature-extraction)
|
29
|
+
- [Fill mask](#fill-mask)
|
35
30
|
|
36
31
|
### Sentiment Analysis
|
37
32
|
|
@@ -58,11 +53,7 @@ model.predict(["This is super cool", "I didn't like it"])
|
|
58
53
|
|
59
54
|
### Question Answering
|
60
55
|
|
61
|
-
First, download the [pretrained model](https://github.com/ankane/informers/releases/download/v0.1.0/question-answering.onnx)
|
62
|
-
|
63
|
-
```ruby
|
64
|
-
gem 'numo-narray'
|
65
|
-
```
|
56
|
+
First, download the [pretrained model](https://github.com/ankane/informers/releases/download/v0.1.0/question-answering.onnx).
|
66
57
|
|
67
58
|
Ask a question with some context
|
68
59
|
|
@@ -101,15 +92,59 @@ This returns
|
|
101
92
|
]
|
102
93
|
```
|
103
94
|
|
95
|
+
### Text Generation
|
96
|
+
|
97
|
+
First, export the [pretrained model](tools/export.md).
|
98
|
+
|
99
|
+
Pass a prompt
|
100
|
+
|
101
|
+
```ruby
|
102
|
+
model = Informers::TextGeneration.new("text-generation.onnx")
|
103
|
+
model.predict("As far as I am concerned, I will", max_length: 50)
|
104
|
+
```
|
105
|
+
|
106
|
+
This returns
|
107
|
+
|
108
|
+
```text
|
109
|
+
As far as I am concerned, I will be the first to admit that I am not a fan of the idea of a "free market." I think that the idea of a free market is a bit of a stretch. I think that the idea
|
110
|
+
```
|
111
|
+
|
112
|
+
### Feature Extraction
|
113
|
+
|
114
|
+
First, export a [pretrained model](tools/export.md).
|
115
|
+
|
116
|
+
```ruby
|
117
|
+
model = Informers::FeatureExtraction.new("feature-extraction.onnx")
|
118
|
+
model.predict("This is super cool")
|
119
|
+
```
|
120
|
+
|
121
|
+
### Fill Mask
|
122
|
+
|
123
|
+
First, export a [pretrained model](tools/export.md).
|
124
|
+
|
125
|
+
```ruby
|
126
|
+
model = Informers::FillMask.new("fill-mask.onnx")
|
127
|
+
model.predict("This is a great <mask>")
|
128
|
+
```
|
129
|
+
|
104
130
|
## Models
|
105
131
|
|
106
132
|
Task | Description | Contributor | License | Link
|
107
133
|
--- | --- | --- | --- | ---
|
108
134
|
Sentiment analysis | DistilBERT fine-tuned on SST-2 | Hugging Face | Apache-2.0 | [Link](https://huggingface.co/distilbert-base-uncased-finetuned-sst-2-english)
|
109
|
-
Question answering | DistilBERT | Hugging Face | Apache-2.0 | [Link](https://huggingface.co/distilbert-base-cased-distilled-squad)
|
135
|
+
Question answering | DistilBERT fine-tuned on SQuAD | Hugging Face | Apache-2.0 | [Link](https://huggingface.co/distilbert-base-cased-distilled-squad)
|
110
136
|
Named-entity recognition | BERT fine-tuned on CoNLL03 | Bayerische Staatsbibliothek | In-progress | [Link](https://huggingface.co/dbmdz/bert-large-cased-finetuned-conll03-english)
|
137
|
+
Text generation | GPT-2 | OpenAI | [Custom](https://github.com/openai/gpt-2/blob/master/LICENSE) | [Link](https://huggingface.co/gpt2)
|
138
|
+
|
139
|
+
Some models are [quantized](https://medium.com/microsoftazure/faster-and-smaller-quantized-nlp-with-hugging-face-and-onnx-runtime-ec5525473bb7) to make them faster and smaller.
|
111
140
|
|
112
|
-
|
141
|
+
## Deployment
|
142
|
+
|
143
|
+
Check out [Trove](https://github.com/ankane/trove) for deploying models.
|
144
|
+
|
145
|
+
```sh
|
146
|
+
trove push sentiment-analysis.onnx
|
147
|
+
```
|
113
148
|
|
114
149
|
## Credits
|
115
150
|
|
@@ -0,0 +1,59 @@
|
|
1
|
+
# Copyright 2018 The HuggingFace Inc. team.
|
2
|
+
# Copyright 2020 Andrew Kane.
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
|
16
|
+
module Informers
|
17
|
+
class FeatureExtraction
|
18
|
+
def initialize(model_path)
|
19
|
+
tokenizer_path = File.expand_path("../../vendor/bert_base_cased_tok.bin", __dir__)
|
20
|
+
@tokenizer = BlingFire.load_model(tokenizer_path)
|
21
|
+
@model = OnnxRuntime::Model.new(model_path)
|
22
|
+
end
|
23
|
+
|
24
|
+
def predict(texts)
|
25
|
+
singular = !texts.is_a?(Array)
|
26
|
+
texts = [texts] if singular
|
27
|
+
|
28
|
+
# tokenize
|
29
|
+
input_ids =
|
30
|
+
texts.map do |text|
|
31
|
+
tokens = @tokenizer.text_to_ids(text, nil, 100) # unk token
|
32
|
+
tokens.unshift(101) # cls token
|
33
|
+
tokens << 102 # sep token
|
34
|
+
tokens
|
35
|
+
end
|
36
|
+
|
37
|
+
max_tokens = input_ids.map(&:size).max
|
38
|
+
attention_mask = []
|
39
|
+
input_ids.each do |ids|
|
40
|
+
zeros = [0] * (max_tokens - ids.size)
|
41
|
+
|
42
|
+
mask = ([1] * ids.size) + zeros
|
43
|
+
attention_mask << mask
|
44
|
+
|
45
|
+
ids.concat(zeros)
|
46
|
+
end
|
47
|
+
|
48
|
+
# infer
|
49
|
+
input = {
|
50
|
+
input_ids: input_ids,
|
51
|
+
attention_mask: attention_mask
|
52
|
+
}
|
53
|
+
output = @model.predict(input)
|
54
|
+
scores = output["output_0"] || output["last_hidden_state"]
|
55
|
+
|
56
|
+
singular ? scores.first : scores
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,109 @@
|
|
1
|
+
# Copyright 2018 The HuggingFace Inc. team.
|
2
|
+
# Copyright 2021 Andrew Kane.
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
|
16
|
+
module Informers
|
17
|
+
class FillMask
|
18
|
+
def initialize(model_path)
|
19
|
+
encoder_path = File.expand_path("../../vendor/roberta.bin", __dir__)
|
20
|
+
@encoder = BlingFire.load_model(encoder_path, prefix: false)
|
21
|
+
|
22
|
+
decoder_path = File.expand_path("../../vendor/roberta.i2w", __dir__)
|
23
|
+
@decoder = BlingFire.load_model(decoder_path)
|
24
|
+
|
25
|
+
@model = OnnxRuntime::Model.new(model_path)
|
26
|
+
end
|
27
|
+
|
28
|
+
def predict(texts)
|
29
|
+
singular = !texts.is_a?(Array)
|
30
|
+
texts = [texts] if singular
|
31
|
+
|
32
|
+
mask_token = 50264
|
33
|
+
|
34
|
+
# tokenize
|
35
|
+
input_ids =
|
36
|
+
texts.map do |text|
|
37
|
+
tokens = @encoder.text_to_ids(text, nil, 3) # unk token
|
38
|
+
|
39
|
+
# add mask token
|
40
|
+
mask_sequence = [28696, 43776, 15698]
|
41
|
+
masks = []
|
42
|
+
(tokens.size - 2).times do |i|
|
43
|
+
masks << i if tokens[i..(i + 2)] == mask_sequence
|
44
|
+
end
|
45
|
+
masks.reverse.each do |mask|
|
46
|
+
tokens = tokens[0...mask] + [mask_token] + tokens[(mask + 3)..-1]
|
47
|
+
end
|
48
|
+
|
49
|
+
tokens.unshift(0) # cls token
|
50
|
+
tokens << 2 # sep token
|
51
|
+
|
52
|
+
tokens
|
53
|
+
end
|
54
|
+
|
55
|
+
max_tokens = input_ids.map(&:size).max
|
56
|
+
attention_mask = []
|
57
|
+
input_ids.each do |ids|
|
58
|
+
zeros = [0] * (max_tokens - ids.size)
|
59
|
+
|
60
|
+
mask = ([1] * ids.size) + zeros
|
61
|
+
attention_mask << mask
|
62
|
+
|
63
|
+
ids.concat(zeros)
|
64
|
+
end
|
65
|
+
|
66
|
+
input = {
|
67
|
+
input_ids: input_ids,
|
68
|
+
attention_mask: attention_mask
|
69
|
+
}
|
70
|
+
|
71
|
+
masked_index = input_ids.map { |v| v.each_index.select { |i| v[i] == mask_token } }
|
72
|
+
masked_index.each do |v|
|
73
|
+
raise "No mask_token (<mask>) found on the input" if v.size < 1
|
74
|
+
raise "More than one mask_token (<mask>) is not supported" if v.size > 1
|
75
|
+
end
|
76
|
+
|
77
|
+
res = @model.predict(input)
|
78
|
+
outputs = res["output_0"] || res["logits"]
|
79
|
+
batch_size = outputs.size
|
80
|
+
|
81
|
+
results = []
|
82
|
+
batch_size.times do |i|
|
83
|
+
result = []
|
84
|
+
|
85
|
+
logits = outputs[i][masked_index[i][0]]
|
86
|
+
values = logits.map { |v| Math.exp(v) }
|
87
|
+
sum = values.sum
|
88
|
+
probs = values.map { |v| v / sum }
|
89
|
+
res = probs.each_with_index.sort_by { |v| -v[0] }.first(5)
|
90
|
+
|
91
|
+
res.each do |(v, p)|
|
92
|
+
tokens = input[:input_ids][i].dup
|
93
|
+
tokens[masked_index[i][0]] = p
|
94
|
+
result << {
|
95
|
+
sequence: @decoder.ids_to_text(tokens),
|
96
|
+
score: v,
|
97
|
+
token: p,
|
98
|
+
# TODO figure out prefix space
|
99
|
+
token_str: @decoder.ids_to_text([p], skip_special_tokens: false)
|
100
|
+
}
|
101
|
+
end
|
102
|
+
|
103
|
+
results += [result]
|
104
|
+
end
|
105
|
+
|
106
|
+
singular ? results.first : results
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
data/lib/informers/ner.rb
CHANGED
@@ -38,12 +38,12 @@ module Informers
|
|
38
38
|
attention_mask: [[1] * tokens.size],
|
39
39
|
token_type_ids: [[0] * tokens.size]
|
40
40
|
}
|
41
|
-
|
41
|
+
res = @model.predict(input)
|
42
42
|
|
43
43
|
# transform
|
44
|
-
|
44
|
+
output = res["output_0"] || res["logits"]
|
45
45
|
score =
|
46
|
-
|
46
|
+
output[0].map do |e|
|
47
47
|
values = e.map { |v| Math.exp(v) }
|
48
48
|
sum = values.sum
|
49
49
|
values.map { |v| v / sum }
|
@@ -16,9 +16,6 @@
|
|
16
16
|
module Informers
|
17
17
|
class QuestionAnswering
|
18
18
|
def initialize(model_path)
|
19
|
-
# make sure Numo is available
|
20
|
-
require "numo/narray"
|
21
|
-
|
22
19
|
tokenizer_path = File.expand_path("../../vendor/bert_base_cased_tok.bin", __dir__)
|
23
20
|
@tokenizer = BlingFire.load_model(tokenizer_path)
|
24
21
|
@model = OnnxRuntime::Model.new(model_path)
|
@@ -70,8 +67,8 @@ module Informers
|
|
70
67
|
}
|
71
68
|
output = @model.predict(input)
|
72
69
|
|
73
|
-
start = output["output_0"]
|
74
|
-
stop = output["output_1"]
|
70
|
+
start = output["output_0"] || output["start_logits"]
|
71
|
+
stop = output["output_1"] || output["end_logits"]
|
75
72
|
|
76
73
|
# transform
|
77
74
|
answers = []
|
@@ -50,11 +50,12 @@ module Informers
|
|
50
50
|
input_ids: input_ids,
|
51
51
|
attention_mask: attention_mask
|
52
52
|
}
|
53
|
-
|
53
|
+
res = @model.predict(input)
|
54
|
+
output = res["output_0"] || res["logits"]
|
54
55
|
|
55
56
|
# transform
|
56
57
|
scores =
|
57
|
-
output
|
58
|
+
output.map do |row|
|
58
59
|
mapped = row.map { |v| Math.exp(v) }
|
59
60
|
sum = mapped.sum
|
60
61
|
mapped.map { |v| v / sum }
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# Copyright 2018 The HuggingFace Inc. team.
|
2
|
+
# Copyright 2021 Andrew Kane.
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
|
16
|
+
module Informers
|
17
|
+
class TextGeneration
|
18
|
+
def initialize(model_path)
|
19
|
+
encoder_path = File.expand_path("../../vendor/gpt2.bin", __dir__)
|
20
|
+
@encoder = BlingFire.load_model(encoder_path, prefix: false)
|
21
|
+
|
22
|
+
decoder_path = File.expand_path("../../vendor/gpt2.i2w", __dir__)
|
23
|
+
@decoder = BlingFire.load_model(decoder_path)
|
24
|
+
|
25
|
+
@model = OnnxRuntime::Model.new(model_path)
|
26
|
+
end
|
27
|
+
|
28
|
+
def predict(text, max_length: 50)
|
29
|
+
tokens = @encoder.text_to_ids(text)
|
30
|
+
|
31
|
+
input = {
|
32
|
+
input_ids: [tokens]
|
33
|
+
}
|
34
|
+
if @model.inputs.any? { |i| i[:name] == "attention_mask" }
|
35
|
+
input[:attention_mask] = [[1] * tokens.size]
|
36
|
+
end
|
37
|
+
|
38
|
+
output_name =
|
39
|
+
if @model.outputs.any? { |o| o[:name] == "output_0" }
|
40
|
+
"output_0"
|
41
|
+
else
|
42
|
+
"logits"
|
43
|
+
end
|
44
|
+
|
45
|
+
(max_length - tokens.size).times do |i|
|
46
|
+
output = @model.predict(input, output_type: :numo, output_names: [output_name])
|
47
|
+
# passed to input_ids
|
48
|
+
tokens << output[output_name][0, true, true][-1, true].max_index
|
49
|
+
end
|
50
|
+
|
51
|
+
@decoder.ids_to_text(tokens)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
data/lib/informers/version.rb
CHANGED
data/lib/informers.rb
CHANGED
@@ -1,9 +1,13 @@
|
|
1
1
|
# dependencies
|
2
2
|
require "blingfire"
|
3
|
+
require "numo/narray"
|
3
4
|
require "onnxruntime"
|
4
5
|
|
5
6
|
# modules
|
7
|
+
require "informers/feature_extraction"
|
8
|
+
require "informers/fill_mask"
|
6
9
|
require "informers/ner"
|
7
10
|
require "informers/question_answering"
|
8
11
|
require "informers/sentiment_analysis"
|
12
|
+
require "informers/text_generation"
|
9
13
|
require "informers/version"
|
@@ -0,0 +1,24 @@
|
|
1
|
+
Modified MIT License
|
2
|
+
|
3
|
+
Software Copyright (c) 2019 OpenAI
|
4
|
+
|
5
|
+
We don’t claim ownership of the content you create with GPT-2, so it is yours to do with as you please.
|
6
|
+
We only ask that you use GPT-2 responsibly and clearly indicate your content was created using GPT-2.
|
7
|
+
|
8
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
|
9
|
+
associated documentation files (the "Software"), to deal in the Software without restriction,
|
10
|
+
including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
11
|
+
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
|
12
|
+
subject to the following conditions:
|
13
|
+
|
14
|
+
The above copyright notice and this permission notice shall be included
|
15
|
+
in all copies or substantial portions of the Software.
|
16
|
+
The above copyright notice and this permission notice need not be included
|
17
|
+
with content created by the Software.
|
18
|
+
|
19
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
20
|
+
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
21
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
22
|
+
BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
23
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
|
24
|
+
OR OTHER DEALINGS IN THE SOFTWARE.
|
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) Facebook, Inc. and its affiliates.
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/vendor/gpt2.bin
ADDED
Binary file
|
data/vendor/gpt2.i2w
ADDED
Binary file
|
data/vendor/roberta.bin
ADDED
Binary file
|
data/vendor/roberta.i2w
ADDED
Binary file
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: informers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Kane
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-09-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: blingfire
|
@@ -16,16 +16,16 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.1.
|
19
|
+
version: 0.1.7
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.1.
|
26
|
+
version: 0.1.7
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: numo-narray
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
@@ -39,63 +39,21 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: rake
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ">="
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - ">="
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: minitest
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - ">="
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '5'
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - ">="
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '5'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: numo-narray
|
42
|
+
name: onnxruntime
|
85
43
|
requirement: !ruby/object:Gem::Requirement
|
86
44
|
requirements:
|
87
45
|
- - ">="
|
88
46
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
90
|
-
type: :
|
47
|
+
version: 0.5.1
|
48
|
+
type: :runtime
|
91
49
|
prerelease: false
|
92
50
|
version_requirements: !ruby/object:Gem::Requirement
|
93
51
|
requirements:
|
94
52
|
- - ">="
|
95
53
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
97
|
-
description:
|
98
|
-
email: andrew@
|
54
|
+
version: 0.5.1
|
55
|
+
description:
|
56
|
+
email: andrew@ankane.org
|
99
57
|
executables: []
|
100
58
|
extensions: []
|
101
59
|
extra_rdoc_files: []
|
@@ -104,19 +62,28 @@ files:
|
|
104
62
|
- LICENSE.txt
|
105
63
|
- README.md
|
106
64
|
- lib/informers.rb
|
65
|
+
- lib/informers/feature_extraction.rb
|
66
|
+
- lib/informers/fill_mask.rb
|
107
67
|
- lib/informers/ner.rb
|
108
68
|
- lib/informers/question_answering.rb
|
109
69
|
- lib/informers/sentiment_analysis.rb
|
70
|
+
- lib/informers/text_generation.rb
|
110
71
|
- lib/informers/version.rb
|
111
72
|
- vendor/LICENSE-bert.txt
|
112
73
|
- vendor/LICENSE-blingfire.txt
|
74
|
+
- vendor/LICENSE-gpt2.txt
|
75
|
+
- vendor/LICENSE-roberta.txt
|
113
76
|
- vendor/bert_base_cased_tok.bin
|
114
77
|
- vendor/bert_base_tok.bin
|
78
|
+
- vendor/gpt2.bin
|
79
|
+
- vendor/gpt2.i2w
|
80
|
+
- vendor/roberta.bin
|
81
|
+
- vendor/roberta.i2w
|
115
82
|
homepage: https://github.com/ankane/informers
|
116
83
|
licenses:
|
117
84
|
- Apache-2.0
|
118
85
|
metadata: {}
|
119
|
-
post_install_message:
|
86
|
+
post_install_message:
|
120
87
|
rdoc_options: []
|
121
88
|
require_paths:
|
122
89
|
- lib
|
@@ -124,15 +91,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
124
91
|
requirements:
|
125
92
|
- - ">="
|
126
93
|
- !ruby/object:Gem::Version
|
127
|
-
version: '2.
|
94
|
+
version: '2.7'
|
128
95
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
129
96
|
requirements:
|
130
97
|
- - ">="
|
131
98
|
- !ruby/object:Gem::Version
|
132
99
|
version: '0'
|
133
100
|
requirements: []
|
134
|
-
rubygems_version: 3.
|
135
|
-
signing_key:
|
101
|
+
rubygems_version: 3.3.7
|
102
|
+
signing_key:
|
136
103
|
specification_version: 4
|
137
104
|
summary: State-of-the-art natural language processing for Ruby
|
138
105
|
test_files: []
|