62 lines
1.0 KiB
Plaintext
62 lines
1.0 KiB
Plaintext
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "448d884d",
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"tensor(0.0140)\n",
|
|
"20\n",
|
|
"cpu\n",
|
|
"cuda\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"import lib\n",
|
|
"\n",
|
|
"import torch\n",
|
|
"\n",
|
|
"T = torch.rand(8, 4)\n",
|
|
"Q = lib.quantize_q4_1(T)\n",
|
|
"\n",
|
|
"dif = T - Q.dequantize()\n",
|
|
"print(abs(dif.sum()))\n",
|
|
"\n",
|
|
"print(Q.nbytes)\n",
|
|
"\n",
|
|
"print(Q.device)\n",
|
|
"\n",
|
|
"Q.to(\"cuda\")\n",
|
|
"print(Q.device)\n"
|
|
]
|
|
}
|
|
],
|
|
"metadata": {
|
|
"kernelspec": {
|
|
"display_name": "pyvenv",
|
|
"language": "python",
|
|
"name": "python3"
|
|
},
|
|
"language_info": {
|
|
"codemirror_mode": {
|
|
"name": "ipython",
|
|
"version": 3
|
|
},
|
|
"file_extension": ".py",
|
|
"mimetype": "text/x-python",
|
|
"name": "python",
|
|
"nbconvert_exporter": "python",
|
|
"pygments_lexer": "ipython3",
|
|
"version": "3.13.5"
|
|
}
|
|
},
|
|
"nbformat": 4,
|
|
"nbformat_minor": 5
|
|
}
|