This commit is contained in:
2024-06-04 18:38:36 +00:00
parent 1d6b5e62c9
commit 78c437cfb3
8 changed files with 141 additions and 1104 deletions
+2
View File
@@ -0,0 +1,2 @@
ROOT_DIR=/opt/jupyter_gpu/test
JUPYTER_PORT=7777
+25
View File
@@ -0,0 +1,25 @@
# -------------------------------------------------------
# Relies on JUPYTER_PORT being set in docker-compose.yml
# -------------------------------------------------------
FROM pytorch/pytorch:latest
# RUN useradd -m -s /bin/bash oleg
# Install packages
RUN pip install jupyterlab ipywidgets
# RUN pip install pandas
# RUN pip install numpy
# Set environment variables, etc.
#ENV MY_ENV_VAR=myvalue
# Set the working directory
WORKDIR /workspace
# Expose the port for JupyterLab
EXPOSE ${JUPYTER_PORT}
# Command to run JupyterLab
CMD ["sh", "-c", "jupyter-lab --ip=0.0.0.0 --port=7777 --no-browser --allow-root --NotebookApp.token=''"]
+25
View File
@@ -0,0 +1,25 @@
version: '3.8'
#==================================================
# Relies on the file `.env` content for varables:
# ROOT_DIR
# JUPYTER_PORT
#==================================================
services:
jupyter:
# user: "oleg"
build: ${ROOT_DIR}
image: cvtt/test:v0.0.0
container_name: jupyter_gpu_test
runtime: nvidia
environment:
- JUPYTER_ENABLE_LAB=yes
volumes:
- ${ROOT_DIR}/notebooks:/workspace
- ${ROOT_DIR}/jupyter_settings/user-settings:/root/.jupyter/lab/user-settings
- ${ROOT_DIR}/jupyter_settings/workspaces:/root/.jupyter/lab/workspaces
- ${ROOT_DIR}/.cache/torch:/root/.cache/torch
ports:
- "${JUPYTER_PORT}:${JUPYTER_PORT}"
shm_size: "8gb"
+83
View File
@@ -0,0 +1,83 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 4,
"id": "275a869c-e8a3-4f6b-9b57-fc2f7168fd35",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"5"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "89039be9d80d47e28620bcb141326986",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"interactive(children=(IntSlider(value=5, description='x', max=10), Output()), _dom_classes=('widget-interact',…"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Done\n"
]
}
],
"source": [
"import ipywidgets\n",
"from ipywidgets import interact, IntSlider\n",
"\n",
"def f(x):\n",
" return x\n",
"\n",
"interact(f, x=IntSlider(min=0, max=10, step=1, value=5))\n",
"print(\"Done\")\n"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "5096e77c-b350-4512-96c3-9cef0534bf35",
"metadata": {},
"outputs": [],
"source": [
"!pip freeze | grep ipwidget"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"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.10.13"
}
},
"nbformat": 4,
"nbformat_minor": 5
}