Downloads · 30 days
11
2% of all-time downloads
2KKLabs/Kaleidoscope_small_v1
Kaleidoscope_small_v1 is a document question answering model from 2KKLabs. Use it for the document question answering task on the model card, and read the license before you ship it in a product. It is set up for transformers. The card lists the license as cc-by-nc-4.0.
Downloads · 30 days
11
2% of all-time downloads
All-time downloads
650
Public
Parameters
178M
711 MB on disk
Likes
1
Public
Click a slice to open those files.
.safetensors711 MB · 99%
From the Hugging Face model README

This model is a fine-tuned version of sberbank-ai/ruBert-base designed for the task of document question answering. It has been adapted specifically for extracting answers from a provided document context and fine-tuned on a custom JSON dataset containing context, question, and answer triples.
The model was fine-tuned using the Transformers library with a custom training pipeline. Key aspects of the training process include:
Custom Dataset: A loader reads a JSON file containing context, question, and answer triples.
While primarily focused on Russian texts, the model also supports English language inputs. The model also supports English language, but its support was not tested
import torch
from transformers import AutoTokenizer, AutoModelForQuestionAnswering
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
tokenizer = AutoTokenizer.from_pretrained("LaciaStudio/Kaleidoscope_small_v1")
model = AutoModelForQuestionAnswering.from_pretrained("LaciaStudio/Kaleidoscope_small_v1")
model.to(device)
file_path = input("Enter document path: ")
with open(file_path, "r", encoding="utf-8") as f:
context = f.read()
while True:
question = input("Enter question (or 'exit' to quit): ")
if question.lower() == "exit":
break
inputs = tokenizer(question, context, return_tensors="pt", truncation=True, max_length=384)
inputs = {k: v.to(device) for k, v in inputs.items()}
outputs = model(**inputs)
start_logits = outputs.start_logits
end_logits = outputs.end_logits
start_index = torch.argmax(start_logits)
end_index = torch.argmax(end_logits)
answer_tokens = inputs["input_ids"][0][start_index:end_index + 1]
answer = tokenizer.decode(answer_tokens, skip_special_tokens=True)
print("Answer:", answer)
RU Context:
Альберт Эйнштейн разработал теорию относительности.
Question:
Кто разработал теорию относительности?
Answer:
альберт эинштеин
EN Context:
I had a red car.
Question:
What kind of car did I have?
Answer:
a red car
Finetuned by LaciaStudio | LaciaAI