rwightman HF staff commited on
Commit
2bf5d6e
·
verified ·
1 Parent(s): cf634f8

Upload folder using huggingface_hub

Browse files
Files changed (5) hide show
  1. Dockerfile +3 -1
  2. _welcome.ipynb +52 -0
  3. on_startup.sh +3 -0
  4. requirements.txt +1 -1
  5. start_server.sh +2 -0
Dockerfile CHANGED
@@ -91,7 +91,8 @@ RUN pip install --no-cache-dir --upgrade \
91
  ipywidgets
92
 
93
  # Copy some context we need now / later into app folder
94
- COPY 'packages.txt' 'requirements.txt' 'login.html' 'on_build.sh' 'start_server.sh' $HOME/app/
 
95
  COPY 'setup_timm_dev' 'setup_timm_scripts' $HOME/bin/
96
 
97
  #######################################
@@ -112,6 +113,7 @@ RUN mkdir /data/.cache
112
  RUN chown -R user:user /data
113
 
114
  RUN chmod +x $HOME/app/start_server.sh
 
115
  RUN chmod 755 $HOME/bin/*
116
  #######################################
117
  # End root user section
 
91
  ipywidgets
92
 
93
  # Copy some context we need now / later into app folder
94
+ COPY 'packages.txt' 'requirements.txt' 'login.html' '_welcome.ipynb' \
95
+ 'on_build.sh' 'on_startup.sh' 'start_server.sh' $HOME/app/
96
  COPY 'setup_timm_dev' 'setup_timm_scripts' $HOME/bin/
97
 
98
  #######################################
 
113
  RUN chown -R user:user /data
114
 
115
  RUN chmod +x $HOME/app/start_server.sh
116
+ RUN chmod +x $HOME/app/on_startup.sh
117
  RUN chmod 755 $HOME/bin/*
118
  #######################################
119
  # End root user section
_welcome.ipynb ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "markdown",
5
+ "id": "d2b58eda-06bc-4f2a-9e8d-fb850811b104",
6
+ "metadata": {},
7
+ "source": [
8
+ "# Welcome to the `timm` optimized Jupyter Space\n",
9
+ "\n",
10
+ "This is a re-worked version of the JuptyerLab template: https://huggingface.co/spaces/SpacesExamples/jupyterlab\n",
11
+ "\n",
12
+ "Key changes:\n",
13
+ "* Cleaned up Dockerfile\n",
14
+ "* Update to newer Ubuntu CUDA image, Python 3.12\n",
15
+ "* Removed Pillow and build & install Pillow-SIMD instead (better CPU utilization for workloads with image pre-processing)\n",
16
+ "* Pre-install Torch, `datasets`, `transformers`, and of course `timm`\n",
17
+ "* A `setup_timm_scripts` script to download train, validate, benchmark, and inference scripts from the current release to your `CWD`\n",
18
+ "* A `setup_timm_dev` script to checkout timm into folder in your `CWD` and pip install in editable model. Link scripts to `CWD`\n",
19
+ "* Default to `/data` for terminal launch to match default notebook folder\n"
20
+ ]
21
+ },
22
+ {
23
+ "cell_type": "code",
24
+ "execution_count": null,
25
+ "id": "bb6b9a86-17d5-474a-baf6-85403a9c9e1e",
26
+ "metadata": {},
27
+ "outputs": [],
28
+ "source": []
29
+ }
30
+ ],
31
+ "metadata": {
32
+ "kernelspec": {
33
+ "display_name": "Python 3 (ipykernel)",
34
+ "language": "python",
35
+ "name": "python3"
36
+ },
37
+ "language_info": {
38
+ "codemirror_mode": {
39
+ "name": "ipython",
40
+ "version": 3
41
+ },
42
+ "file_extension": ".py",
43
+ "mimetype": "text/x-python",
44
+ "name": "python",
45
+ "nbconvert_exporter": "python",
46
+ "pygments_lexer": "ipython3",
47
+ "version": "3.12.8"
48
+ }
49
+ },
50
+ "nbformat": 4,
51
+ "nbformat_minor": 5
52
+ }
on_startup.sh ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ #!/bin/bash
2
+ # Write some commands here that will run when the Space is started, before launching Jupyter
3
+ cp $HOME/app/_welcome.ipynb /data/
requirements.txt CHANGED
@@ -6,4 +6,4 @@ datasets
6
  webdataset==0.2.86
7
  hf-transfer
8
  transformers
9
- timm
 
6
  webdataset==0.2.86
7
  hf-transfer
8
  transformers
9
+ timm
start_server.sh CHANGED
@@ -1,6 +1,8 @@
1
  #!/bin/bash
2
  JUPYTER_TOKEN="${JUPYTER_TOKEN:=huggingface}"
3
 
 
 
4
  NOTEBOOK_DIR="/data"
5
 
6
  jupyter labextension disable "@jupyterlab/apputils-extension:announcements"
 
1
  #!/bin/bash
2
  JUPYTER_TOKEN="${JUPYTER_TOKEN:=huggingface}"
3
 
4
+ . $HOME/app/on_startup.sh
5
+
6
  NOTEBOOK_DIR="/data"
7
 
8
  jupyter labextension disable "@jupyterlab/apputils-extension:announcements"