Downloads · 30 days
34
1% of all-time downloads
RichardErkhov/XBOT-RK_-_distilgpt2-wiki-qa-gguf
XBOT-RK_-_distilgpt2-wiki-qa-gguf is a machine learning model from RichardErkhov. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
Downloads · 30 days
34
1% of all-time downloads
All-time downloads
2.7K
Public
Repo size
1.6 GB
Likes
0
Public
Click a slice to open those files.
.gguf1.9 GB · 100%
From the Hugging Face model README
Quantization made by Richard Erkhov.
distilgpt2-wiki-qa - GGUF
| Name | Quant method | Size |
|---|---|---|
| distilgpt2-wiki-qa.Q2_K.gguf | Q2_K | 0.06GB |
| distilgpt2-wiki-qa.IQ3_XS.gguf | IQ3_XS | 0.07GB |
| distilgpt2-wiki-qa.IQ3_S.gguf | IQ3_S | 0.07GB |
| distilgpt2-wiki-qa.Q3_K_S.gguf | Q3_K_S | 0.07GB |
| distilgpt2-wiki-qa.IQ3_M.gguf | IQ3_M | 0.07GB |
| distilgpt2-wiki-qa.Q3_K.gguf | Q3_K | 0.07GB |
| distilgpt2-wiki-qa.Q3_K_M.gguf | Q3_K_M | 0.07GB |
| distilgpt2-wiki-qa.Q3_K_L.gguf | Q3_K_L | 0.07GB |
| distilgpt2-wiki-qa.IQ4_XS.gguf | IQ4_XS | 0.07GB |
| distilgpt2-wiki-qa.Q4_0.gguf | Q4_0 | 0.08GB |
| distilgpt2-wiki-qa.IQ4_NL.gguf | IQ4_NL | 0.08GB |
| distilgpt2-wiki-qa.Q4_K_S.gguf | Q4_K_S | 0.08GB |
| distilgpt2-wiki-qa.Q4_K.gguf | Q4_K | 0.08GB |
| distilgpt2-wiki-qa.Q4_K_M.gguf | Q4_K_M | 0.08GB |
| distilgpt2-wiki-qa.Q4_1.gguf | Q4_1 | 0.08GB |
| distilgpt2-wiki-qa.Q5_0.gguf | Q5_0 | 0.09GB |
| distilgpt2-wiki-qa.Q5_K_S.gguf | Q5_K_S | 0.09GB |
| distilgpt2-wiki-qa.Q5_K.gguf | Q5_K | 0.09GB |
| distilgpt2-wiki-qa.Q5_K_M.gguf | Q5_K_M | 0.09GB |
| distilgpt2-wiki-qa.Q5_1.gguf | Q5_1 | 0.09GB |
| distilgpt2-wiki-qa.Q6_K.gguf | Q6_K | 0.1GB |
| distilgpt2-wiki-qa.Q8_0.gguf | Q8_0 | 0.12GB |
language:
inference: false
This Question-Answering model was fine-tuned & trained from a generative, left-to-right transformer in the style of GPT-2, the distilgpt2 model. This model was trained on Wiki-QA dataset from Microsoft.
The following code shows how to use the Distil-GPT2-Wiki-QA checkpoint and Transformers to generate Answers.
from transformers import GPT2LMHeadModel, GPT2Tokenizer
import torch
import re
tokenizer = GPT2Tokenizer.from_pretrained("XBOT-RK/distilgpt2-wiki-qa")
model = GPT2LMHeadModel.from_pretrained("XBOT-RK/distilgpt2-wiki-qa")
device = "cuda" if torch.cuda.is_available() else "cpu"
def infer(question):
generated_tensor = model.generate(**tokenizer(question, return_tensors="pt").to(device), max_new_tokens = 50)
generated_text = tokenizer.decode(generated_tensor[0])
return generated_text
def processAnswer(question, result):
answer = result.replace(question, '').strip()
if "<bot>:" in answer:
answer = re.search('<bot>:(.*)', answer).group(1).strip()
if "<endofstring>" in answer:
answer = re.search('(.*)<endofstring>', answer).group(1).strip()
return answer
question = "What is a tropical cyclone?"
result = infer(question)
answer = processAnswer(question, result)
print('Question: ', question)
print('Answer: ', answer)
# Output
"Question: What is a tropical cyclone?"
"Answer: The cyclone is named after the climber Edmond Halley, who described it as the 'most powerful cyclone of the Atlantic'."