Instructions to use RichardErkhov/consciousAI_-_question-answering-roberta-base-s-v2-8bits with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use RichardErkhov/consciousAI_-_question-answering-roberta-base-s-v2-8bits with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="RichardErkhov/consciousAI_-_question-answering-roberta-base-s-v2-8bits")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("RichardErkhov/consciousAI_-_question-answering-roberta-base-s-v2-8bits") model = AutoModelForCausalLM.from_pretrained("RichardErkhov/consciousAI_-_question-answering-roberta-base-s-v2-8bits", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use RichardErkhov/consciousAI_-_question-answering-roberta-base-s-v2-8bits with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "RichardErkhov/consciousAI_-_question-answering-roberta-base-s-v2-8bits" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "RichardErkhov/consciousAI_-_question-answering-roberta-base-s-v2-8bits", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/RichardErkhov/consciousAI_-_question-answering-roberta-base-s-v2-8bits
- SGLang
How to use RichardErkhov/consciousAI_-_question-answering-roberta-base-s-v2-8bits with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "RichardErkhov/consciousAI_-_question-answering-roberta-base-s-v2-8bits" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "RichardErkhov/consciousAI_-_question-answering-roberta-base-s-v2-8bits", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "RichardErkhov/consciousAI_-_question-answering-roberta-base-s-v2-8bits" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "RichardErkhov/consciousAI_-_question-answering-roberta-base-s-v2-8bits", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use RichardErkhov/consciousAI_-_question-answering-roberta-base-s-v2-8bits with Docker Model Runner:
docker model run hf.co/RichardErkhov/consciousAI_-_question-answering-roberta-base-s-v2-8bits
YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
Quantization made by Richard Erkhov.
question-answering-roberta-base-s-v2 - bnb 8bits
- Model creator: https://huggingface.co/consciousAI/
- Original model: https://huggingface.co/consciousAI/question-answering-roberta-base-s-v2/
Original model description:
license: apache-2.0 tags: - Question Answering metrics: - squad model-index: - name: consciousAI/question-answering-roberta-base-s-v2 results: []
Question Answering
The model is intended to be used for Q&A task, given the question & context, the model would attempt to infer the answer text, answer span & confidence score.
Model is encoder-only (deepset/roberta-base-squad2) with QuestionAnswering LM Head, fine-tuned on SQUADx dataset with exact_match: 84.83 & f1: 91.80 performance scores.
Live Demo: Question Answering Encoders vs Generative
Please follow this link for Encoder based Question Answering V1
Please follow this link for Generative Question Answering
Example code:
from transformers import pipeline
model_checkpoint = "consciousAI/question-answering-roberta-base-s-v2"
context = """
🤗 Transformers is backed by the three most popular deep learning libraries — Jax, PyTorch and TensorFlow — with a seamless integration
between them. It's straightforward to train your models with one before loading them for inference with the other.
"""
question = "Which deep learning libraries back 🤗 Transformers?"
question_answerer = pipeline("question-answering", model=model_checkpoint)
question_answerer(question=question, context=context)
Training and evaluation data
SQUAD Split
Training procedure
Preprocessing:
- SQUAD Data longer chunks were sub-chunked with input context max-length 384 tokens and stride as 128 tokens.
- Target answers readjusted for sub-chunks, sub-chunks with no-answers or partial answers were set to target answer span as (0,0)
Metrics:
- Adjusted accordingly to handle sub-chunking.
- n best = 20
- skip answers with length zero or higher than max answer length (30)
Training hyperparameters
Custom Training Loop: The following hyperparameters were used during training:
- learning_rate: 2e-5
- train_batch_size: 32
- eval_batch_size: 32
- optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
- lr_scheduler_type: linear
- num_epochs: 2
Training results
{'exact_match': 84.83443708609272, 'f1': 91.79987545811638}
Framework versions
- Transformers 4.23.0.dev0
- Pytorch 1.12.1+cu113
- Datasets 2.5.2
- Tokenizers 0.13.0
- Downloads last month
- 5