khan hanzala areeb

hanzalashahri
·

AI & ML interests

Learning ML

Recent Activity

upvoted an article 3 days ago
Mixture of Experts Explained
liked a model 12 days ago
Qwen/Qwen3-235B-A22B
reacted to aifeifei798's post with 👍 17 days ago
how to load a dataset using the datasets library and save it to an SQLite database. It also includes a function to query the database and print the first five rows. ```python from datasets import load_dataset import sqlite3 # Load the dataset dataset = load_dataset('aifeifei798/song_lyrics_min', split='train') # Define a function to save the dataset to an SQLite database def save_dataset_to_sqlite(dataset, db_path='temp_dataset.db'): # Connect to the SQLite database (creates a new database if it doesn't exist) conn = sqlite3.connect(db_path) cursor = conn.cursor() # Create a table to store the dataset cursor.execute('''CREATE TABLE IF NOT EXISTS songs (id INTEGER PRIMARY KEY, title TEXT, tag TEXT, lyrics TEXT)''') # Insert each row of the dataset into the database table for i, row in enumerate(dataset): cursor.execute("INSERT INTO songs (id, title, tag, lyrics) VALUES (?, ?, ?, ?)", (i, row['title'], row['tag'], row['lyrics'])) # Commit the transaction and close the connection conn.commit() conn.close() # Save the dataset to the SQLite database save_dataset_to_sqlite(dataset) # Define a function to query the database def query_database(db_path='temp_dataset.db'): # Connect to the SQLite database conn = sqlite3.connect(db_path) cursor = conn.cursor() # Query the first five rows of the database cursor.execute("SELECT * FROM songs LIMIT 5") rows = cursor.fetchall() # Print each row for row in rows: print(row) # Close the connection conn.close() # Query the database query_database() ```
View all activity

Organizations

None yet

hanzalashahri's activity

upvoted an article 3 days ago
view article
Article

Mixture of Experts Explained

603
reacted to aifeifei798's post with 👍 17 days ago
view post
Post
556
how to load a dataset using the datasets library and save it to an SQLite database. It also includes a function to query the database and print the first five rows.

from datasets import load_dataset
import sqlite3

# Load the dataset
dataset = load_dataset('aifeifei798/song_lyrics_min', split='train')

# Define a function to save the dataset to an SQLite database
def save_dataset_to_sqlite(dataset, db_path='temp_dataset.db'):
    # Connect to the SQLite database (creates a new database if it doesn't exist)
    conn = sqlite3.connect(db_path)
    cursor = conn.cursor()

    # Create a table to store the dataset
    cursor.execute('''CREATE TABLE IF NOT EXISTS songs
                      (id INTEGER PRIMARY KEY, title TEXT, tag TEXT, lyrics TEXT)''')

    # Insert each row of the dataset into the database table
    for i, row in enumerate(dataset):
        cursor.execute("INSERT INTO songs (id, title, tag, lyrics) VALUES (?, ?, ?, ?)",
                       (i, row['title'], row['tag'], row['lyrics']))

    # Commit the transaction and close the connection
    conn.commit()
    conn.close()

# Save the dataset to the SQLite database
save_dataset_to_sqlite(dataset)

# Define a function to query the database
def query_database(db_path='temp_dataset.db'):
    # Connect to the SQLite database
    conn = sqlite3.connect(db_path)
    cursor = conn.cursor()

    # Query the first five rows of the database
    cursor.execute("SELECT * FROM songs LIMIT 5")
    rows = cursor.fetchall()

    # Print each row
    for row in rows:
        print(row)

    # Close the connection
    conn.close()

# Query the database
query_database()
reacted to ritvik77's post with 👍 about 1 month ago
view post
Post
2297
ritvik77/ContributionChartHuggingFace
It's Ready!

One feature Hugging Face could really benefit from is a contribution heatmap — a visual dashboard to track user engagement and contributions across models, datasets, and models over the year, similar to GitHub’s contribution graph. Guess what, Clem Delangue mentioned idea about using HF API reference for it and we made it for use.

If you are a Hugging Face user add this Space in your collection and it will give you all stats about your contributions and commits nearly same as GitHub. It's still a prototype and still working on it as a product feature.
·