mirror of
https://github.com/frankwxu/AI4DigitalForensics.git
synced 2026-04-10 11:23:42 +00:00
add lecture 13
This commit is contained in:
@@ -3,5 +3,16 @@ pip install scikit-learn
|
||||
pip install ultralytics
|
||||
pip install ultralytics opencv-python
|
||||
pip install transformers
|
||||
pip install ipykernel
|
||||
# pip install sentencepiece did not work
|
||||
conda install sentencepiece
|
||||
conda install sentencepiece
|
||||
|
||||
|
||||
For AI Agents
|
||||
- Create a different envirofment: python version 3.11
|
||||
- installl pytorch
|
||||
- pip install browser-use
|
||||
- pip install "browser-use[memory]"
|
||||
- playwright install chromium --with-deps --no-shell
|
||||
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
@@ -10,7 +10,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 69,
|
||||
"execution_count": 30,
|
||||
"id": "2d8b3880",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
@@ -69,7 +69,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 70,
|
||||
"execution_count": 31,
|
||||
"id": "02ff97f3",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
@@ -134,7 +134,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 71,
|
||||
"execution_count": 32,
|
||||
"id": "af64b425",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
@@ -187,7 +187,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 72,
|
||||
"execution_count": 33,
|
||||
"id": "c26b1fa2",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
@@ -229,7 +229,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 73,
|
||||
"execution_count": 34,
|
||||
"id": "8d3cb18e",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
@@ -239,7 +239,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 79,
|
||||
"execution_count": 35,
|
||||
"id": "7e4a9a78",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
@@ -281,6 +281,29 @@
|
||||
"print(f\"Cross-Entropy Loss (One Example): {loss:.4f}\")"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 36,
|
||||
"id": "d4436c0d",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Cross-Entropy Loss (One Example): 0.2191\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"# corss entroy using torch library\n",
|
||||
"# F.cross_entropy expects: [batch_size, num_classes]\n",
|
||||
"import torch\n",
|
||||
"from torch.nn import functional as F\n",
|
||||
"loss= F.cross_entropy(torch.tensor([logits], dtype=torch.float32), torch.tensor([one_hot_target], dtype=torch.float32))\n",
|
||||
"print(f\"Cross-Entropy Loss (One Example): {loss:.4f}\")"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "9000b450",
|
||||
@@ -294,7 +317,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 75,
|
||||
"execution_count": 37,
|
||||
"id": "4d146b28",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
|
||||
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
Reference in New Issue
Block a user