Instructions to use Mr-Vicky-01/GPT-QnA with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Mr-Vicky-01/GPT-QnA with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Mr-Vicky-01/GPT-QnA")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Mr-Vicky-01/GPT-QnA") model = AutoModelForCausalLM.from_pretrained("Mr-Vicky-01/GPT-QnA") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Mr-Vicky-01/GPT-QnA with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Mr-Vicky-01/GPT-QnA" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Mr-Vicky-01/GPT-QnA", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Mr-Vicky-01/GPT-QnA
- SGLang
How to use Mr-Vicky-01/GPT-QnA 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 "Mr-Vicky-01/GPT-QnA" \ --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": "Mr-Vicky-01/GPT-QnA", "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 "Mr-Vicky-01/GPT-QnA" \ --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": "Mr-Vicky-01/GPT-QnA", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Mr-Vicky-01/GPT-QnA with Docker Model Runner:
docker model run hf.co/Mr-Vicky-01/GPT-QnA
INFERENCE
import time
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
finetuned_model = AutoModelForCausalLM.from_pretrained("Mr-Vicky-01/GPT-QnA")
tokenizer = AutoTokenizer.from_pretrained("Mr-Vicky-01/GPT-QnA")
alpaca_prompt = """Below is an instruction that describes a task. Write a response that appropriately completes the request.
### Instruction:
what is depresssion how to overcome
### Response:
"""
s = time.time()
prompt = alpaca_prompt
encodeds = tokenizer(prompt, return_tensors="pt",truncation=True).input_ids
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
finetuned_model.to(device)
inputs = encodeds.to(device)
# Increase max_new_tokens if needed
generated_ids = finetuned_model.generate(inputs, max_new_tokens=256, temperature=0.1, top_p=0.90, do_sample=False,pad_token_id=50259,eos_token_id=50259,num_return_sequences=1)
print(tokenizer.decode(generated_ids[0]).split('### Response:')[1].split('<eos>')[0].strip())
e = time.time()
print(f'time taken:{e-s}')
- Downloads last month
- 4