) -> String {
String::from("
copy#codeCopy\" class=\"material-symbols-outlined btn-code-toolbar\">content_copy
- link
- edit
")
}
diff --git a/pgml-dashboard/static/css/scss/base/_base.scss b/pgml-dashboard/static/css/scss/base/_base.scss
index c6cc402b1..80ca64b33 100644
--- a/pgml-dashboard/static/css/scss/base/_base.scss
+++ b/pgml-dashboard/static/css/scss/base/_base.scss
@@ -41,10 +41,6 @@ pre {
}
}
-pre[data-controller="copy"] {
- padding-top: 2rem;
-}
-
// links
a {
text-decoration: none;
diff --git a/pgml-dashboard/static/css/scss/components/_admonitions.scss b/pgml-dashboard/static/css/scss/components/_admonitions.scss
index 6e3dde527..ed9e13153 100644
--- a/pgml-dashboard/static/css/scss/components/_admonitions.scss
+++ b/pgml-dashboard/static/css/scss/components/_admonitions.scss
@@ -69,9 +69,6 @@
pre {
margin: 0px;
}
- pre[data-controller="copy"] {
- padding-top: 2rem !important;
- }
div.code-block {
border: none !important;
@@ -84,7 +81,6 @@
.execution-time {
border-top: 2px solid #{$gray-100};
- border-bottom: 2px solid #{$gray-100};
background-color: #{$gray-600};
padding: 12px 12px;
margin: 0px !important;
diff --git a/pgml-dashboard/static/css/scss/components/_code.scss b/pgml-dashboard/static/css/scss/components/_code.scss
index f7c97f2a0..a9973069b 100644
--- a/pgml-dashboard/static/css/scss/components/_code.scss
+++ b/pgml-dashboard/static/css/scss/components/_code.scss
@@ -143,7 +143,7 @@ pre {
pre {
background-color: #{$gray-500};
code {
- background-color: #{$gray-500};
+ background-color: #{$gray-600};
}
}
@@ -222,6 +222,7 @@ pre {
pre {
background-color: #{$gray-600};
border-radius: #{$border-radius};
+ border: solid 2px white;
code {
border: none;
diff --git a/pgml-dashboard/static/css/scss/pages/_docs.scss b/pgml-dashboard/static/css/scss/pages/_docs.scss
index 2bf785658..f7a68650e 100644
--- a/pgml-dashboard/static/css/scss/pages/_docs.scss
+++ b/pgml-dashboard/static/css/scss/pages/_docs.scss
@@ -3,16 +3,36 @@
div.results {
overflow-x: auto;
- margin: 24px 24px;
+ margin: 0;
+ padding: 0;
+ border-top: 2px solid white;
.code-toolbar {
- display: none;
+ display: none !important;
}
pre {
- background-color: #{$gray-500};
- code {
- background-color: #{$gray-500};
+ padding: 0 !important;
+ border: none;
+ margin: 0;
+ }
+
+ .overflow-auto {
+ margin: 0;
+ }
+
+ table {
+ margin: 0;
+ border-spacing: 0;
+ background-color: #{$gray-900};
+
+ tr {
+ padding: 0 0.5rem;
+ }
+
+ td, th {
+ border: 1px solid #{$gray-800};
+ padding: 0.1rem 0.5rem;
}
}
@@ -32,13 +52,15 @@
border-start-end-radius: 0px;
}
}
+
+ > * {
+ margin: 0.5rem 1rem;
+ }
}
div.code-block {
overflow-x: auto;
- border: 2px solid $slate-tint-1000;
- border-radius: 8px;
- margin: 24px 0px;
+ border-bottom: 2px solid white;
.title {
background-color: #{$gray-700};
@@ -50,6 +72,8 @@
pre {
margin: 0px;
+ border: none;
+ padding: 0px !important;
}
&.with-title {
@@ -106,10 +130,41 @@
pre {
background-color: #{$gray-600};
border-radius: #{$border-radius};
+ padding: 0;
+ position: relative;
code {
border: none;
white-space: inherit;
+ padding: 0;
+ }
+
+ .code-toolbar {
+ display: none;
+ z-index: 1;
+ border: 2px solid white;
+ border-bottom-left-radius: 8px;
+ border-top-right-radius: 8px;
+ right: -2px;
+ top: -2px;
+ }
+
+ .cm-gutters {
+ background: $gray-800;
+ }
+
+ .cm-activeLineGutter {
+ background: $gray-800;
+ }
+
+ .cm-content {
+ padding: 0.75rem;
+ }
+ }
+
+ pre:hover {
+ .code-toolbar {
+ display: flex;
}
}
@@ -186,15 +241,11 @@
// Codemirror overrideds
.cm-editor {
background: inherit;
-
- // default no line numbers.
- .cm-gutters {
- display: none;
- }
}
.cm-gutters {
background: inherit;
+ border-right: 1px solid #{$white};
}
.code-highlight {
diff --git a/pgml-dashboard/static/images/gym/quick_start.md b/pgml-dashboard/static/images/gym/quick_start.md
index 3662b0c45..026d8ddf8 100644
--- a/pgml-dashboard/static/images/gym/quick_start.md
+++ b/pgml-dashboard/static/images/gym/quick_start.md
@@ -25,7 +25,7 @@ Once you have your PostgresML instance running, we'll be ready to get started.
The first part of machine learning is getting your data in a format you can use. That's usually the hardest part, but thankfully we have a few example datasets we can use. To load one of them, navigate to the IDE tab and run this query:
-```sql
+```postgresql
SELECT * FROM pgml.load_dataset('diabetes');
```
@@ -46,7 +46,7 @@ To load them into PostgresML, use the same function above with the desired datas
The SQL editor you just used can run arbitrary queries on the PostgresML instance. For example,
if we want to see what dataset we just loaded looks like, we can run:
-```sql
+```postgresql
SELECT * FROM pgml.diabetes LIMIT 5;
```
@@ -78,7 +78,7 @@ PostgresML organizes itself into projects. A project is just a name for model(s)
Using the IDE, run:
-```sql
+```postgresql
SELECT * FROM pgml.train(
'My First Project',
task => 'regression',
@@ -106,7 +106,7 @@ Inference is the act of predicting labels that we haven't necessarily used in tr
Let's try and predict some new values. Using the IDE, run:
-```sql
+```postgresql
SELECT pgml.predict(
'My First Project',
ARRAY[
@@ -130,7 +130,7 @@ You should see something like this:
The `prediction` column represents the possible value of the `target` column given the new features we just passed into the `pgml.predict()` function. You can just as easily predict multiple points and compare them to the actual labels in the dataset:
-```sql
+```postgresql
SELECT
pgml.predict('My First Project 2', ARRAY[
age, sex, bmi, bp, s1, s3, s3, s4, s5, s6
@@ -151,7 +151,7 @@ As you can see, we automatically performed some analysis on the data. Visualizin
XGBoost is a good algorithm, but what if there are better ones? Let's try training a few more using the IDE. Run these one at a time:
-```sql
+```postgresql
-- Simple linear regression.
SELECT * FROM pgml.train(
'My First Project',
diff --git a/pgml-extension/examples/regression.sql b/pgml-extension/examples/regression.sql
index e355b6393..dfc469165 100644
--- a/pgml-extension/examples/regression.sql
+++ b/pgml-extension/examples/regression.sql
@@ -81,7 +81,7 @@ SELECT * FROM pgml.train('Diabetes Progression', algorithm => 'random_forest', h
-- gradient boosting
SELECT * FROM pgml.train('Diabetes Progression', algorithm => 'xgboost', hyperparams => '{"n_estimators": 10}');
SELECT * FROM pgml.train('Diabetes Progression', algorithm => 'catboost', hyperparams => '{"n_estimators": 10}');
---SELECT * FROM pgml.train('Diabetes Progression', algorithm => 'xgboost_random_forest', hyperparams => '{"n_estimators": 10}');
+-- SELECT * FROM pgml.train('Diabetes Progression', algorithm => 'xgboost_random_forest', hyperparams => '{"n_estimators": 10}');
-- SELECT * FROM pgml.train('Diabetes Progression', algorithm => 'lightgbm', hyperparams => '{"n_estimators": 1}');
-- Histogram Gradient Boosting is too expensive for normal tests on even a toy dataset
-- SELECT * FROM pgml.train('Diabetes Progression', algorithm => 'hist_gradient_boosting', hyperparams => '{"max_iter": 10}');
diff --git a/pgml-extension/requirements.txt b/pgml-extension/requirements.txt
index 7ec447bc8..8cc64677e 100644
--- a/pgml-extension/requirements.txt
+++ b/pgml-extension/requirements.txt
@@ -45,6 +45,8 @@ sentence-transformers
rouge
sacrebleu
sacremoses
+evaluate
+trl
# Utils
datasets
diff --git a/pgml-extension/src/api.rs b/pgml-extension/src/api.rs
index 623d8f872..14efde32b 100644
--- a/pgml-extension/src/api.rs
+++ b/pgml-extension/src/api.rs
@@ -619,7 +619,7 @@ pub fn embed_batch(
/// Returns `true` if the GPU cache was successfully cleared, `false` otherwise.
/// # Example
///
-/// ```sql
+/// ```postgresql
/// SELECT pgml.clear_gpu_cache(memory_usage => 0.5);
/// ```
#[cfg(all(feature = "python", not(feature = "use_as_lib")))]