Segizu commited on
Commit
e5cbd17
·
1 Parent(s): 7b55a3a

notebook v1

Browse files
Files changed (3) hide show
  1. Dockerfile +18 -0
  2. lstm_gpu_demo.ipynb +86 -0
  3. requirements.tct +5 -0
Dockerfile ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Imagen base con soporte de CUDA
2
+ FROM tensorflow/tensorflow:2.12.0-gpu
3
+
4
+ # Crear directorio de trabajo
5
+ WORKDIR /app
6
+
7
+ # Copiar archivos de dependencias
8
+ COPY requirements.txt .
9
+
10
+ # Instalar dependencias
11
+ RUN pip install --upgrade pip && \
12
+ pip install -r requirements.txt
13
+
14
+ # Copiar el notebook o app
15
+ COPY . .
16
+
17
+ # Comando por defecto (puede cambiarse según necesidad)
18
+ CMD ["jupyter", "notebook", "--ip=0.0.0.0", "--allow-root", "--NotebookApp.token=''", "--NotebookApp.password=''", "--no-browser"]
lstm_gpu_demo.ipynb ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": null,
6
+ "metadata": {},
7
+ "outputs": [],
8
+ "source": [
9
+ "import tensorflow as tf\n",
10
+ "import numpy as np\n",
11
+ "import matplotlib.pyplot as plt"
12
+ ]
13
+ },
14
+ {
15
+ "cell_type": "code",
16
+ "execution_count": null,
17
+ "metadata": {},
18
+ "outputs": [],
19
+ "source": [
20
+ "print(\"GPU disponible:\", tf.config.list_physical_devices('GPU'))\n"
21
+ ]
22
+ },
23
+ {
24
+ "cell_type": "code",
25
+ "execution_count": null,
26
+ "metadata": {},
27
+ "outputs": [],
28
+ "source": [
29
+ "N = 10000 # muestras\n",
30
+ "T = 30 # pasos de tiempo\n",
31
+ "F = 10 # features\n",
32
+ "\n",
33
+ "X = np.random.rand(N, T, F)\n",
34
+ "y = np.random.rand(N, 1)"
35
+ ]
36
+ },
37
+ {
38
+ "cell_type": "code",
39
+ "execution_count": null,
40
+ "metadata": {},
41
+ "outputs": [],
42
+ "source": [
43
+ "from tensorflow.keras.models import Sequential\n",
44
+ "from tensorflow.keras.layers import LSTM, Dense\n",
45
+ "\n",
46
+ "model = Sequential([\n",
47
+ " LSTM(64, input_shape=(T, F)),\n",
48
+ " Dense(1)\n",
49
+ "])\n",
50
+ "\n",
51
+ "model.compile(optimizer='adam', loss='mse')"
52
+ ]
53
+ },
54
+ {
55
+ "cell_type": "code",
56
+ "execution_count": null,
57
+ "metadata": {},
58
+ "outputs": [],
59
+ "source": [
60
+ "\n",
61
+ "history = model.fit(X, y, epochs=5, batch_size=64)\n",
62
+ "\n",
63
+ "# 6. Graficar pérdida\n",
64
+ "plt.plot(history.history['loss'])\n",
65
+ "plt.title('Pérdida de entrenamiento')\n",
66
+ "plt.xlabel('Época')\n",
67
+ "plt.ylabel('Loss')\n",
68
+ "plt.grid(True)\n",
69
+ "plt.show()\n"
70
+ ]
71
+ }
72
+ ],
73
+ "metadata": {
74
+ "kernelspec": {
75
+ "display_name": "Python 3",
76
+ "language": "python",
77
+ "name": "python3"
78
+ },
79
+ "language_info": {
80
+ "name": "python",
81
+ "version": "3.11.9"
82
+ }
83
+ },
84
+ "nbformat": 4,
85
+ "nbformat_minor": 2
86
+ }
requirements.tct ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ tensorflow>=2.12
2
+ numpy
3
+ pandas
4
+ matplotlib
5
+ jupyter