Downloads · 30 days
8
2% of all-time downloads
Naveengo/gpt2-medium-on-sql-create-context
gpt2-medium-on-sql-create-context is a question answering model from Naveengo. Use it when the input is a question plus a passage. It is set up for peft. The card lists the license as apache-2.0.
Model Description: GPT-2 Medium is the 355M parameter version of GPT-2, a transformer-based language model created and released by OpenAI. The model is a pretrained model on English language using a causal language mo…
Downloads · 30 days
8
2% of all-time downloads
All-time downloads
514
Public
Repo size
3.2 MB
Likes
0
Public
Click a slice to open those files.
.bin3.2 MB · 100%
From the Hugging Face model README
Model Description: GPT-2 Medium is the 355M parameter version of GPT-2, a transformer-based language model created and released by OpenAI. The model is a pretrained model on English language using a causal language modeling (CLM) objective.
Parameter-Efficient Fine-tuning (PEFT) is a technique used to improve the performance of pre-trained language models (LLMs) on specific downstream tasks without fine-tuning all the model's parameters. This is done by freezing most of the model's parameters and only fine-tuning a small number of parameters that are specific to the downstream task.
the model is trained on 'b-mc2/sql-create-context' dataset upto 5000rows
please install transformers, and peft:
!pip install transformers peft
To use the model, you can run the following:
import torch
from peft import PeftModel, PeftConfig
from transformers import AutoModelForCausalLM, AutoTokenizer
config = PeftConfig.from_pretrained("Naveengo/gpt2-medium-on-sql-create-context")
model = AutoModelForCausalLM.from_pretrained(config.base_model_name_or_path, return_dict=True, load_in_8bit=False)
tokenizer = AutoTokenizer.from_pretrained(config.base_model_name_or_path)
# Load the Lora model
model = PeftModel.from_pretrained(model,"Naveengo/gpt2-medium-on-sql-create-context")
from IPython.display import display, Markdown
def make_inference(question, context):
batch = tokenizer(f"Below is an SQL instruction that describes a task, paired with an input that provides further context. Write an SQL query that appropriately completes the request using your expertise in SQL. ### Instruction: {question}### Input: {context}### Response:", return_tensors='pt')
with torch.cuda.amp.autocast():
output_tokens = model.generate(**batch, max_new_tokens=100)
display(Markdown((tokenizer.decode(output_tokens[0], skip_special_tokens=True))))
#give question and context to function
make_inference(your_question_here, your_context_here)
The following bitsandbytes quantization config was used during training:
The following bitsandbytes quantization config was used during training:
PEFT 0.5.0
PEFT 0.5.0