Thziin mahnerak commited on
Commit
9598689
0 Parent(s):

Duplicate from aimstack/aim

Browse files

Co-authored-by: Mahnerak <mahnerak@users.noreply.huggingface.co>

Files changed (4) hide show
  1. .gitattributes +35 -0
  2. Dockerfile +30 -0
  3. README.md +80 -0
  4. aim_repo.tar.gz +3 -0
.gitattributes ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
+ *.model filter=lfs diff=lfs merge=lfs -text
13
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
14
+ *.npy filter=lfs diff=lfs merge=lfs -text
15
+ *.npz filter=lfs diff=lfs merge=lfs -text
16
+ *.onnx filter=lfs diff=lfs merge=lfs -text
17
+ *.ot filter=lfs diff=lfs merge=lfs -text
18
+ *.parquet filter=lfs diff=lfs merge=lfs -text
19
+ *.pb filter=lfs diff=lfs merge=lfs -text
20
+ *.pickle filter=lfs diff=lfs merge=lfs -text
21
+ *.pkl filter=lfs diff=lfs merge=lfs -text
22
+ *.pt filter=lfs diff=lfs merge=lfs -text
23
+ *.pth filter=lfs diff=lfs merge=lfs -text
24
+ *.rar filter=lfs diff=lfs merge=lfs -text
25
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
26
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
28
+ *.tflite filter=lfs diff=lfs merge=lfs -text
29
+ *.tgz filter=lfs diff=lfs merge=lfs -text
30
+ *.wasm filter=lfs diff=lfs merge=lfs -text
31
+ *.xz filter=lfs diff=lfs merge=lfs -text
32
+ *.zip filter=lfs diff=lfs merge=lfs -text
33
+ *.zst filter=lfs diff=lfs merge=lfs -text
34
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
35
+ aim_repo.tar.gz filter=lfs diff=lfs merge=lfs -text
Dockerfile ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.9
2
+
3
+ RUN useradd -m -u 1000 aim_user
4
+
5
+ # Switch to the "aim_user" user
6
+ USER aim_user
7
+
8
+ # Set home to the user's home directory
9
+ ENV HOME=/home/aim_user \
10
+ PATH=/home/aim_user/.local/bin:$PATH
11
+
12
+ # Set the working directory to the user's home directory
13
+ WORKDIR $HOME
14
+
15
+ # install the `aim` package on the latest version
16
+ RUN pip install aim
17
+
18
+ RUN aim telemetry off
19
+
20
+ ENTRYPOINT ["/bin/sh", "-c"]
21
+
22
+ COPY aim_repo.tar.gz .
23
+ RUN tar xvzf aim_repo.tar.gz
24
+ # have to run `aim init` in the directory that stores aim data for
25
+ # otherwise `aim up` will prompt for confirmation to create the directory itself.
26
+ # We run aim listening on 0.0.0.0 to expose all ports. Also, we run
27
+ # using `--dev` to print verbose logs. Port 43800 is the default port of
28
+ # `aim up` but explicit is better than implicit.
29
+ CMD ["aim up --host 0.0.0.0 --port 7860 --workers 2"]
30
+
README.md ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: Aim
3
+ emoji: 🔥
4
+ colorFrom: purple
5
+ colorTo: blue
6
+ sdk: docker
7
+ license: other
8
+ fullWidth: true
9
+ ---
10
+
11
+ # Aim on Spaces
12
+
13
+ **Hugging Face Spaces** offer a simple way to host ML demo apps directly on your profile or your organization’s profile. This allows you to create your ML portfolio, showcase your projects at conferences or to stakeholders, and work collaboratively with other people in the ML ecosystem.
14
+ Hugging Face Spaces make it easy for you to create and deploy ML-powered demos in minutes.
15
+
16
+ Check out the [Hugging Face Spaces docs](https://huggingface.co/docs/hub/spaces-overview) to learn more about Spaces.
17
+
18
+ ## Deploy Aim on Spaces
19
+
20
+ You can deploy Aim on Spaces with a single click!
21
+
22
+ <a href="https://huggingface.co/new-space?template=aimstack/aim">
23
+ <img src="https://huggingface.co/datasets/huggingface/badges/raw/main/deploy-to-spaces-lg.svg" />
24
+ </a>
25
+
26
+ Once you have created the Space, you'll see the `Building` status, and once it becomes `Running,` your Space is ready to go!
27
+
28
+ <img src="https://user-images.githubusercontent.com/23078323/231592155-869148a0-9a92-475f-8ebe-34d4deb2abc2.png" alt="Creating an Aim Space" width=800 />
29
+
30
+ Now, when you navigate to your Space's **App** section, you can access the Aim UI.
31
+
32
+ ## Compare your experiments with Aim on Spaces
33
+
34
+ Let's use a quick example of a PyTorch CNN trained on MNIST to demonstrate end-to-end Aim on Spaces deployment.
35
+ The full example is in the [Aim repo examples folder](https://github.com/aimhubio/aim/blob/main/examples/pytorch_track.py).
36
+
37
+ ```python
38
+ from aim import Run
39
+ from aim.pytorch import track_gradients_dists, track_params_dists
40
+
41
+ # Initialize a new Run
42
+ aim_run = Run()
43
+ ...
44
+ items = {'accuracy': acc, 'loss': loss}
45
+ aim_run.track(items, epoch=epoch, context={'subset': 'train'})
46
+
47
+ # Track weights and gradients distributions
48
+ track_params_dists(model, aim_run)
49
+ track_gradients_dists(model, aim_run)
50
+ ```
51
+
52
+ The experiments tracked by Aim are stored in the `.aim` folder. **To display the logs with the Aim UI in your Space, you need to compress the `.aim` folder to a `tar.gz` file and upload it to your Space using `git` or the Files and Versions sections of your Space.**
53
+
54
+ Here's a bash command for that:
55
+
56
+ ```bash
57
+ tar -czvf aim_repo.tar.gz .aim
58
+ ```
59
+
60
+ That’s it! Now open the App section of your Space and the Aim UI is available with your logs.
61
+ Here is what to expect:
62
+
63
+ ![Aim UI on HF Hub Spaces](https://user-images.githubusercontent.com/23078323/232034340-0ba3ebbf-0374-4b14-ba80-1d36162fc994.png)
64
+
65
+ Filter your runs using Aim’s Pythonic search. You can write pythonic [queries against](https://aimstack.readthedocs.io/en/latest/using/search.html) EVERYTHING you have tracked - metrics, hyperparams etc. Check out some [examples](https://huggingface.co/aimstack) on HF Hub Spaces.
66
+
67
+ <Tip>
68
+ Note that if your logs are in TensorBoard format, you can easily convert <a href="https://aimstack.readthedocs.io/en/latest/quick_start/convert_data.html#show-tensorboard-logs-in-aim">them to Aim with one command</a> and use the many advanced and high-performant training run comparison features available.
69
+ </Tip>
70
+
71
+ ## More on HF Spaces
72
+
73
+ - [HF Docker spaces](https://github.com/huggingface/hub-docs/blob/main/docs/hub/spaces-sdks-docker.md)
74
+ - [HF Docker space examples](https://github.com/huggingface/hub-docs/blob/main/docs/hub/spaces-sdks-docker.md)
75
+
76
+ ## Feedback and Support
77
+
78
+ If you have improvement suggestions or need support, please open an issue on [Aim GitHub repo](https://github.com/aimhubio/aim).
79
+
80
+ The [Aim community Discord](https://github.com/aimhubio/aim#-community) is also available for community discussions.
aim_repo.tar.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ad85d625c781762b8f127a84d456a8d2f8ae602b37a8ef1dbe4b5dd64c9cff54
3
+ size 1369