Refactor tablesort.js (#20002)

Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>
Co-authored-by: UltralyticsAssistant <web@ultralytics.com>
This commit is contained in:
Glenn Jocher 2025-04-03 20:42:27 +02:00 committed by GitHub
parent 55109fc14c
commit dc6e88db87
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 46 additions and 83 deletions

View file

@ -20,7 +20,7 @@ With more than [10 million users](https://www.kaggle.com/discussions/general/332
Training YOLO11 models on Kaggle is simple and efficient, thanks to the platform's access to powerful GPUs.
To get started, access the [Kaggle YOLO11 Notebook](https://www.kaggle.com/code/glennjocherultralytics/yolo11). Kaggle's environment comes with pre-installed libraries like [TensorFlow](https://www.ultralytics.com/glossary/tensorflow) and [PyTorch](https://www.ultralytics.com/glossary/pytorch), making the setup process hassle-free.
To get started, access the [Kaggle YOLO11 Notebook](https://www.kaggle.com/code/glennjocherultralytics/ultralytics-yolo11-notebook). Kaggle's environment comes with pre-installed libraries like [TensorFlow](https://www.ultralytics.com/glossary/tensorflow) and [PyTorch](https://www.ultralytics.com/glossary/pytorch), making the setup process hassle-free.
![What is the kaggle integration with respect to YOLO11?](https://github.com/ultralytics/docs/releases/download/0/kaggle-integration-yolov8.avif)
@ -28,7 +28,7 @@ Once you sign in to your Kaggle account, you can click on the option to copy and
![Using kaggle for machine learning model training with a GPU](https://github.com/ultralytics/docs/releases/download/0/using-kaggle-for-machine-learning-model-training-with-a-gpu.avif)
On the [official YOLO11 Kaggle notebook page](https://www.kaggle.com/code/glennjocherultralytics/yolo11), if you click on the three dots in the upper right-hand corner, you'll notice more options will pop up.
On the [official YOLO11 Kaggle notebook page](https://www.kaggle.com/code/glennjocherultralytics/ultralytics-yolo11-notebook), if you click on the three dots in the upper right-hand corner, you'll notice more options will pop up.
![Overview of Options From the Official YOLO11 Kaggle Notebook Page](https://github.com/ultralytics/docs/releases/download/0/overview-options-yolov8-kaggle-notebook.avif)
@ -96,7 +96,7 @@ Interested in more YOLO11 integrations? Check out the [Ultralytics integration g
### How do I train a YOLO11 model on Kaggle?
Training a YOLO11 model on Kaggle is straightforward. First, access the [Kaggle YOLO11 Notebook](https://www.kaggle.com/code/glennjocherultralytics/yolo11). Sign in to your Kaggle account, copy and edit the notebook, and select a GPU under the accelerator settings. Run the notebook cells to start training. For more detailed steps, refer to our [YOLO11 Model Training guide](../modes/train.md).
Training a YOLO11 model on Kaggle is straightforward. First, access the [Kaggle YOLO11 Notebook](https://www.kaggle.com/code/glennjocherultralytics/ultralytics-yolo11-notebook). Sign in to your Kaggle account, copy and edit the notebook, and select a GPU under the accelerator settings. Run the notebook cells to start training. For more detailed steps, refer to our [YOLO11 Model Training guide](../modes/train.md).
### What are the benefits of using Kaggle for YOLO11 model training?

View file

@ -2,50 +2,27 @@
// tablesort.filesize.min.js
!(function () {
const filesizeRegex = /^(\d+(\.\d+)?) ?((K|M|G|T|P|E|Z|Y|B$)i?B?)$/i;
function r(t) {
return (
(t = t.match(/^(\d+(\.\d+)?) ?((K|M|G|T|P|E|Z|Y|B$)i?B?)$/i)),
parseFloat(t[1].replace(/[^\-?0-9.]/g, "")) *
(function (t) {
var e = "i" === (t = t.toLowerCase())[1] ? 1024 : 1e3;
switch (t[0]) {
case "k":
return Math.pow(e, 2);
case "m":
return Math.pow(e, 3);
case "g":
return Math.pow(e, 4);
case "t":
return Math.pow(e, 5);
case "p":
return Math.pow(e, 6);
case "e":
return Math.pow(e, 7);
case "z":
return Math.pow(e, 8);
case "y":
return Math.pow(e, 9);
default:
return e;
}
})(t[3])
);
t = t.match(filesizeRegex);
if (!t) return 0;
const value = parseFloat(t[1].replace(/[^\-?0-9.]/g, ""));
const unit = t[3].toLowerCase();
const base = unit[1] === "i" ? 1024 : 1e3;
const powers = { k: 2, m: 3, g: 4, t: 5, p: 6, e: 7, z: 8, y: 9 };
return value * (powers[unit[0]] ? Math.pow(base, powers[unit[0]]) : base);
}
Tablesort.extend(
"filesize",
function (t) {
return /^\d+(\.\d+)? ?(K|M|G|T|P|E|Z|Y|B$)i?B?$/i.test(t);
},
function (t, e) {
return (
(t = r(t)),
(e = r(e)),
(e = e),
(t = t),
(e = parseFloat(e)),
(t = parseFloat(t)),
(e = isNaN(e) ? 0 : e) - (t = isNaN(t) ? 0 : t)
);
(t) => filesizeRegex.test(t),
(t, e) => {
t = r(t);
e = r(e);
return (isNaN(e) ? 0 : e) - (isNaN(t) ? 0 : t);
},
);
})();
@ -53,59 +30,45 @@
// tablesort.dotsep.min.js
Tablesort.extend(
"dotsep",
function (t) {
return /^(\d+\.)+\d+$/.test(t);
},
function (t, r) {
(t = t.split(".")), (r = r.split("."));
for (var e, n, i = 0, s = t.length; i < s; i++)
if ((e = parseInt(t[i], 10)) !== (n = parseInt(r[i], 10))) {
if (n < e) return -1;
if (e < n) return 1;
(t) => /^(\d+\.)+\d+$/.test(t),
(t, r) => {
t = t.split(".");
r = r.split(".");
for (let i = 0, s = t.length; i < s; i++) {
const e = parseInt(t[i], 10);
const n = parseInt(r[i], 10);
if (e !== n) {
return n < e ? -1 : 1;
}
}
return 0;
},
);
// tablesort.number.min.js
(function () {
var cleanNumber = function (i) {
// Remove everything after ± symbol if present
i = i.split("±")[0].trim();
return i.replace(/[^\-?0-9.]/g, "");
},
compareNumber = function (a, b) {
a = parseFloat(a);
b = parseFloat(b);
a = isNaN(a) ? 0 : a;
b = isNaN(b) ? 0 : b;
return a - b;
};
const cleanNumber = (i) =>
i
.split("±")[0]
.trim()
.replace(/[^\-?0-9.]/g, "");
const compareNumber = (a, b) => (parseFloat(a) || 0) - (parseFloat(b) || 0);
Tablesort.extend(
"number",
function (item) {
return (
item.match(/^[-+]?[£\x24Û¢´€]?\d+\s*([,\.]\d{0,2})/) || // Prefixed currency
item.match(/^[-+]?\d+\s*([,\.]\d{0,2})?[£\x24Û¢´€]/) || // Suffixed currency
item.match(/^[-+]?(\d)*-?([,\.]){0,1}-?(\d)+([E,e][\-+][\d]+)?%?$/)
); // Number
},
function (a, b) {
a = cleanNumber(a);
b = cleanNumber(b);
return compareNumber(b, a);
},
(item) =>
item.match(/^[-+]?[£\x24Û¢´€]?\d+\s*([,\.]\d{0,2})/) || // Prefixed currency
item.match(/^[-+]?\d+\s*([,\.]\d{0,2})?[£\x24Û¢´€]/) || // Suffixed currency
item.match(/^[-+]?(\d)*-?([,\.]){0,1}-?(\d)+([E,e][\-+][\d]+)?%?$/), // Number
(a, b) => compareNumber(cleanNumber(b), cleanNumber(a)),
);
})();
// subscribe
document$.subscribe(function () {
var tables = document.querySelectorAll("article table:not([class])");
tables.forEach(function (table) {
document$.subscribe(() => {
document.querySelectorAll("article table:not([class])").forEach((table) => {
new Tablesort(table);
});
});

View file

@ -126,7 +126,7 @@ def benchmark(
assert not isinstance(model, YOLOWorld), "YOLOWorldv2 TensorFlow exports not supported by onnx2tf yet"
if i == 11: # Paddle
assert not isinstance(model, YOLOWorld), "YOLOWorldv2 Paddle exports not supported yet"
assert not model.task == "obb", "Paddle OBB bug https://github.com/PaddlePaddle/Paddle/issues/72024"
assert model.task != "obb", "Paddle OBB bug https://github.com/PaddlePaddle/Paddle/issues/72024"
assert not is_end2end, "End-to-end models not supported by PaddlePaddle yet"
assert LINUX or MACOS, "Windows Paddle exports not supported yet"
if i == 12: # MNN