Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding pre-commit and some formatting #1449

Open
wants to merge 4 commits into
base: staging
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -228,3 +228,4 @@ eva/*
blog.md

tests/integration_tests/short/*.db
test/third_party_tests/*.db
11 changes: 11 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.4.0
hooks:
- id: check-docstring-first

- repo: https://github.com/ambv/black
rev: 24.2.0 # Use the latest stable version of Black
hooks:
- id: black
language_version: python3
25 changes: 14 additions & 11 deletions benchmark/text_summarization/text_summarization_with_evadb.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,35 +5,38 @@


cursor.query("DROP TABLE IF EXISTS cnn_news_test;").df()
cursor.query("""
cursor.query(
"""
CREATE TABLE IF NOT EXISTS cnn_news_test(
id TEXT(128),
article TEXT(4096),
highlights TEXT(1024)
);""").df()
cursor.load('./cnn_news_test.csv', 'cnn_news_test', format="CSV").df()
);"""
).df()
cursor.load("./cnn_news_test.csv", "cnn_news_test", format="CSV").df()

cursor.query("DROP FUNCTION IF EXISTS TextSummarizer;").df()
cursor.query("""CREATE UDF IF NOT EXISTS TextSummarizer
cursor.query(
"""CREATE UDF IF NOT EXISTS TextSummarizer
TYPE HuggingFace
TASK 'summarization'
MODEL 'sshleifer/distilbart-cnn-12-6'
MIN_LENGTH 5
MAX_LENGTH 100;""").df()
MAX_LENGTH 100;"""
).df()


cursor.query("DROP TABLE IF EXISTS cnn_news_summary;").df()

cursor._evadb.config.update_value("executor", "batch_mem_size", 300000)
cursor._evadb.config.update_value("executor", "gpu_ids", [0,1])
cursor._evadb.config.update_value("executor", "gpu_ids", [0, 1])
cursor._evadb.config.update_value("experimental", "ray", True)

start_time = time.perf_counter()
cursor.query("""
cursor.query(
"""
CREATE TABLE IF NOT EXISTS cnn_news_summary AS
SELECT TextSummarizer(article) FROM cnn_news_test;""").df()
SELECT TextSummarizer(article) FROM cnn_news_test;"""
).df()
end_time = time.perf_counter()
print(f"{end_time-start_time:.2f} seconds")



30 changes: 20 additions & 10 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"sphinx_copybutton",
"sphinx.ext.doctest",
"sphinx.ext.coverage",
# "sphinx.ext.autosectionlabel",
# "sphinx.ext.autosectionlabel",
"sphinx.ext.autosummary",
"sphinx.ext.autodoc",
"sphinx.ext.autodoc.typehints",
Expand Down Expand Up @@ -90,11 +90,17 @@
# General information about the project.
project = "EvaDB"
copyright = str(date.today().year) + ", EvaDB."
author = u"EvaDB"
author = "EvaDB"

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store", "README.md", "images/reference/README.md"]
exclude_patterns = [
"_build",
"Thumbs.db",
".DS_Store",
"README.md",
"images/reference/README.md",
]


# The name of the Pygments (syntax highlighting) style to use.
Expand Down Expand Up @@ -129,12 +135,12 @@
"color-background-secondary": "#fff",
"color-sidebar-background-border": "none",
"font-stack": "Inter, Arial, sans-serif",
"font-stack--monospace": "Fira Code, Courier, monospace"
"font-stack--monospace": "Fira Code, Courier, monospace",
},
"dark_css_variables": {
"color-background-secondary": "#000",
"font-stack": "Inter, Arial, sans-serif",
"font-stack--monospace": "Fira Code, Courier, monospace"
"font-stack--monospace": "Fira Code, Courier, monospace",
},
# Add important announcement here
"announcement": "<div class='topnav'></div>",
Expand All @@ -151,18 +157,19 @@
# Adding custom css file
html_static_path = ["_static"]
html_css_files = [
"custom.css",
"custom.css",
"algolia.css",
"https://cdn.jsdelivr.net/npm/@docsearch/css@3",
"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/fontawesome.min.css",
"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/solid.min.css",
"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/brands.min.css"
"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/brands.min.css",
]

# Check link: https://stackoverflow.com/questions/14492743/have-sphinx-report-broken-links/14735060#14735060
nitpicky = True
# BUG: https://stackoverflow.com/questions/11417221/sphinx-autodoc-gives-warning-pyclass-reference-target-not-found-type-warning
nitpick_ignore_regex = [('py:class', r'.*')]
nitpick_ignore_regex = [("py:class", r".*")]


# -- Initialize Sphinx ----------------------------------------------
def setup(app):
Expand All @@ -173,5 +180,8 @@ def setup(app):
)
# Custom JS
app.add_js_file("js/top-navigation.js", defer="defer")
app.add_js_file("https://cdn.jsdelivr.net/npm/@docsearch/js@3.3.3/dist/umd/index.js",defer="defer")
app.add_js_file("js/algolia.js",defer="defer")
app.add_js_file(
"https://cdn.jsdelivr.net/npm/@docsearch/js@3.3.3/dist/umd/index.js",
defer="defer",
)
app.add_js_file("js/algolia.js", defer="defer")
Loading