From 6c752551ed51e2413b3fd29635691db44ed0e8d6 Mon Sep 17 00:00:00 2001 From: betterbeast2023 Date: Fri, 5 Jun 2026 08:25:33 +0800 Subject: [PATCH] c --- .gitignore | 1 + practice.ipynb | 128 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 129 insertions(+) create mode 100644 practice.ipynb diff --git a/.gitignore b/.gitignore index fba1320..3ba8713 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ __pycache__/ *.pyo .ipynb_checkpoints/ *.whl +.aider* diff --git a/practice.ipynb b/practice.ipynb new file mode 100644 index 0000000..c1ef593 --- /dev/null +++ b/practice.ipynb @@ -0,0 +1,128 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "id": "259a585b", + "metadata": {}, + "outputs": [], + "source": [ + "### heloo" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "e18c006e", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "hello world\n" + ] + } + ], + "source": [ + "print(\"hello world\")" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "id": "fe7bf6eb", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "True\n", + "cuda\n" + ] + } + ], + "source": [ + "import torch\n", + "from torch._C import device\n", + "import torch.nn as nn\n", + "from torch.nn import functional as F\n", + "print(torch.cuda.is_available())\n", + "device = torch.device(\"cuda\" if torch.cuda.is_available() else \"cpu\")\n", + "print(device)\n", + "\n", + "if device == \"cuda\":\n", + " print(\"gpu\", torch.cuda.get_device_name(0))\n" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "id": "4bddedb8", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "1115394\n", + "First Citizen:\n", + "Before we proceed any further, hear me speak.\n", + "\n", + "All:\n", + "Speak, speak.\n", + "\n", + "First Citizen:\n", + "You are all resolved rather to die than to famish?\n", + "\n", + "All:\n", + "Resolved. resolved.\n", + "\n", + "First Citizen:\n", + "First, you know Caius Marcius is chief enemy to the people.\n", + "\n" + ] + } + ], + "source": [ + "with open(\"input.txt\", \"r\", encoding = \"utf-8\") as f:\n", + " text = f.read()\n", + "\n", + "print(len(text))\n", + "print(text[:250])\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "b33dcb00", + "metadata": {}, + "outputs": [], + "source": [ + "set(text)" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": ".venv", + "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.12.10" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +}