Chonky
is a transformer model that intelligently segments text into meaningful semantic chunks. This model can be used in the RAG systems.
Model Description
The model processes text and divides it into semantically coherent segments. These chunks can then be fed into embedding-based retrieval systems or language models as part of a RAG pipeline.
How to use
I've made a small python library for this model:
chonky
Here is the usage:
from chonky import TextSplitter
# on the first run it will download the transformer model
splitter = TextSplitter(device="cpu")
text = """Before college the two main things I worked on, outside of school, were writing and programming. I didn't write essays. I wrote what beginning writers were supposed to write then, and probably still are: short stories. My stories were awful. They had hardly any plot, just characters with strong feelings, which I imagined made them deep. The first programs I tried writing were on the IBM 1401 that our school district used for what was then called "data processing." This was in 9th grade, so I was 13 or 14. The school district's 1401 happened to be in the basement of our junior high school, and my friend Rich Draves and I got permission to use it. It was like a mini Bond villain's lair down there, with all these alien-looking machines — CPU, disk drives, printer, card reader — sitting up on a raised floor under bright fluorescent lights."""
for chunk in splitter(text):
print(chunk)
print("--")
But you can use this model using standart NER pipeline:
from transformers import AutoTokenizer, AutoModelForTokenClassification, pipeline
model_name = "mirth/chonky_distilbert_uncased_1"
tokenizer = AutoTokenizer.from_pretrained(model_name)
id2label = {
0: "O",
1: "separator",
}
label2id = {
"O": 0,
"separator": 1,
}
model = AutoModelForTokenClassification.from_pretrained(
model_name,
num_labels=2,
id2label=id2label,
label2id=label2id,
)
pipe = pipeline("ner", model=model, tokenizer=tokenizer, aggregation_strategy="simple")
text = """Before college the two main things I worked on, outside of school, were writing and programming. I didn't write essays. I wrote what beginning writers were supposed to write then, and probably still are: short stories. My stories were awful. They had hardly any plot, just characters with strong feelings, which I imagined made them deep. The first programs I tried writing were on the IBM 1401 that our school district used for what was then called "data processing." This was in 9th grade, so I was 13 or 14. The school district's 1401 happened to be in the basement of our junior high school, and my friend Rich Draves and I got permission to use it. It was like a mini Bond villain's lair down there, with all these alien-looking machines — CPU, disk drives, printer, card reader — sitting up on a raised floor under bright fluorescent lights."""
pipe(text)
# Output
[
{'entity_group': 'separator', 'score': 0.89515704, 'word': 'deep.', 'start': 333, 'end': 338},
{'entity_group': 'separator', 'score': 0.61160326, 'word': '.', 'start': 652, 'end': 653}
]
Training Data
The model was trained to split paragraphs from the bookcorpus dataset.
Metrics
Metric
Value
F1
0.7
Precision
0.79
Recall
0.63
Accuracy
0.99
Hardware
Model was fine-tuned on 2x1080ti
Runs of mirth chonky_distilbert_base_uncased_1 on huggingface.co
98.0K
Total runs
153
24-hour runs
6.2K
3-day runs
19.4K
7-day runs
31.8K
30-day runs
More Information About chonky_distilbert_base_uncased_1 huggingface.co Model
More chonky_distilbert_base_uncased_1 license Visit here:
chonky_distilbert_base_uncased_1 huggingface.co is an AI model on huggingface.co that provides chonky_distilbert_base_uncased_1's model effect (), which can be used instantly with this mirth chonky_distilbert_base_uncased_1 model. huggingface.co supports a free trial of the chonky_distilbert_base_uncased_1 model, and also provides paid use of the chonky_distilbert_base_uncased_1. Support call chonky_distilbert_base_uncased_1 model through api, including Node.js, Python, http.
chonky_distilbert_base_uncased_1 huggingface.co is an online trial and call api platform, which integrates chonky_distilbert_base_uncased_1's modeling effects, including api services, and provides a free online trial of chonky_distilbert_base_uncased_1, you can try chonky_distilbert_base_uncased_1 online for free by clicking the link below.
mirth chonky_distilbert_base_uncased_1 online free url in huggingface.co:
chonky_distilbert_base_uncased_1 is an open source model from GitHub that offers a free installation service, and any user can find chonky_distilbert_base_uncased_1 on GitHub to install. At the same time, huggingface.co provides the effect of chonky_distilbert_base_uncased_1 install, users can directly use chonky_distilbert_base_uncased_1 installed effect in huggingface.co for debugging and trial. It also supports api for free installation.
chonky_distilbert_base_uncased_1 install url in huggingface.co: