Menu

gpt2DBStore / Blog: Recent posts

What does GPT2DBStore do?

Integrating SQLite with GPT-2 for Context-Based Question Answering
This article presents a method of using SQLite with GPT-2 to answer questions based on specific contexts stored in the SQLite database.

Initializing the SQLite Database

import sqlite3

def initialize_db(db_name="context_data.db"):
conn = sqlite3.connect(db_name)
cursor = conn.cursor()

# Create a table to store contexts
cursor.execute('''CREATE TABLE IF NOT EXISTS contexts
                 (id INTEGER PRIMARY KEY, context TEXT)''')
conn.commit()
return conn, cursor

Inserting Data into the SQLite Database... read more

Posted by Divyesh 2023-09-10
MongoDB Logo MongoDB