froog 0.5.0__py3-none-any.whl → 0.5.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: froog
|
3
|
-
Version: 0.5.
|
3
|
+
Version: 0.5.2
|
4
4
|
Summary: tensor library with opencl and metal support
|
5
5
|
Author: Kevin Buhler
|
6
6
|
License: MIT
|
@@ -16,23 +16,21 @@ Requires-Dist: matplotlib
|
|
16
16
|
<div align="center" >
|
17
17
|
<img src="https://raw.githubusercontent.com/kevbuh/froog/main/assets/froog.png" alt="froog the frog" height="200">
|
18
18
|
<br/>
|
19
|
-
froog:
|
20
|
-
<br/>
|
21
|
-
a beautifully compact tensor library
|
19
|
+
froog: a gpu accelerated tensor library
|
22
20
|
<br/>
|
23
21
|
<a href="https://github.com/kevbuh/froog">homepage</a> | <a href="https://github.com/kevbuh/froog/tree/main/DOCS.md">documentation</a> | <a href="https://pypi.org/project/froog/">pip</a>
|
24
22
|
<br/>
|
25
23
|
<br/>
|
26
24
|
</div>
|
27
25
|
|
28
|
-
```froog``` is an easy-to-read tensor library (<a href="https://www.pepy.tech/projects/froog">
|
26
|
+
```froog``` is an easy-to-read tensor library (<a href="https://www.pepy.tech/projects/froog">27k pip installs!</a>) with support for GPU acceleration with [OpenCL](https://www.khronos.org/opencl/) and [Apple Metal](https://developer.apple.com/metal/). Inspired by [tinygrad](https://github.com/tinygrad/tinygrad), and [micrograd](https://github.com/karpathy/micrograd).
|
29
27
|
|
30
|
-
|
28
|
+
## Installation
|
31
29
|
```bash
|
32
30
|
pip install froog
|
33
31
|
```
|
34
32
|
|
35
|
-
|
33
|
+
## Features
|
36
34
|
- <a href="https://github.com/kevbuh/froog/blob/main/froog/tensor.py">Custom Tensors</a>
|
37
35
|
- Backpropagation
|
38
36
|
- Automatic Differentiation (autograd)
|
@@ -43,11 +41,9 @@ pip install froog
|
|
43
41
|
- Acceleration methods (Adam)
|
44
42
|
- Avg & Max pooling
|
45
43
|
- <a href="https://github.com/kevbuh/froog/blob/main/models/efficientnet.py">EfficientNet</a> inference
|
46
|
-
- <a href="https://github.com/kevbuh/froog/blob/main/froog/gpu
|
47
|
-
- <a href="https://github.com/kevbuh/froog/blob/main/docs/env.md">Configuration via Environment Variables</a>
|
48
|
-
- and a bunch <a href="https://github.com/kevbuh/froog/tree/main/froog">more</a>
|
44
|
+
- <a href="https://github.com/kevbuh/froog/blob/main/froog/gpu">GPU Support</a>
|
49
45
|
|
50
|
-
|
46
|
+
## Quick Example
|
51
47
|
|
52
48
|
Here's how you set up a simple multilayer perceptron for classification on MNIST. Looks pretty similar to pytorch, right?
|
53
49
|
|
@@ -69,7 +65,7 @@ model = mnistMLP() # create model
|
|
69
65
|
optim = optim.SGD([model.l1, model.l2], lr=0.001) # stochastic gradient descent optimizer
|
70
66
|
```
|
71
67
|
|
72
|
-
|
68
|
+
## GPU Support
|
73
69
|
|
74
70
|
Device management is handled transparently and will automatically select one of ```[METAL, OPENCL, CPU]```. To use the GPU:
|
75
71
|
|
@@ -105,11 +101,12 @@ from froog import set_device
|
|
105
101
|
set_device("METAL") # or "OPENCL"
|
106
102
|
```
|
107
103
|
|
108
|
-
|
104
|
+
## EfficientNet in froog!
|
105
|
+
|
106
|
+
<img src="https://github.com/kevbuh/froog/blob/main/assets/efficientnet_pug.png" alt="pug" height="200">
|
109
107
|
|
110
|
-
|
108
|
+
We have an implementation of [EfficientNet v2](https://arxiv.org/abs/2104.00298) built entirely in ```froog``` using the official PyTorch weights! Running inference on this pug...
|
111
109
|
|
112
|
-
We have an implementation of [EfficientNet v2](https://arxiv.org/abs/2104.00298) built entirely in ```froog``` using the official PyTorch weights! Run inference with:
|
113
110
|
|
114
111
|
```bash
|
115
112
|
python3 models/efficientnet.py <https://optional_image_url>
|
@@ -119,25 +116,25 @@ inference 4.34 s
|
|
119
116
|
|
120
117
|
imagenet class: 254
|
121
118
|
prediction : pug, pug-dog
|
122
|
-
probability : 0.
|
119
|
+
probability : 0.9402361
|
123
120
|
******************************
|
124
121
|
```
|
125
122
|
|
126
123
|
I would recommend checking out the <a href="https://github.com/kevbuh/froog/blob/main/models/efficientnet.py">code</a>, it's highly documented and pretty cool.
|
127
124
|
|
128
|
-
|
125
|
+
<!-- ## Contributing -->
|
129
126
|
<!-- THERES LOT OF STUFF TO WORK ON! VISIT THE <a href="https://github.com/kevbuh/froog/blob/main/docs/bounties.md">BOUNTY SHOP</a> -->
|
130
127
|
|
131
|
-
Pull requests will be merged if they:
|
128
|
+
<!-- Pull requests will be merged if they:
|
132
129
|
* increase simplicity
|
133
130
|
* increase functionality
|
134
131
|
* increase efficiency
|
135
132
|
|
136
|
-
More info on <a href="https://github.com/kevbuh/froog/blob/main/docs/contributing.md">contributing</a>. Make sure to run ```python -m pytest``` before creating a PR.
|
133
|
+
More info on <a href="https://github.com/kevbuh/froog/blob/main/docs/contributing.md">contributing</a>. Make sure to run ```python -m pytest``` before creating a PR. -->
|
137
134
|
|
138
|
-
|
135
|
+
## API
|
139
136
|
|
140
|
-
|
137
|
+
MATH
|
141
138
|
- ```.add(y)``` - Addition with y
|
142
139
|
- ```.sub(y)``` - Subtraction with y
|
143
140
|
- ```.mul(y)``` - Multiplication with y
|
@@ -146,12 +143,10 @@ More info on <a href="https://github.com/kevbuh/froog/blob/main/docs/contributin
|
|
146
143
|
- ```.sum()``` - Sum all elements
|
147
144
|
- ```.mean()``` - Mean of all elements
|
148
145
|
- ```.sqrt()``` - Square root
|
149
|
-
|
150
|
-
## Linear Algebra Operations
|
151
146
|
- ```.dot(y)``` - Matrix multiplication with y
|
152
147
|
- ```.matmul(y)``` - Alias for dot
|
153
148
|
|
154
|
-
|
149
|
+
MACHINE LEARNING
|
155
150
|
- ```.relu()``` - Rectified Linear Unit activation
|
156
151
|
- ```.sigmoid()``` - Sigmoid activation
|
157
152
|
- ```.dropout(p=0.5, training=True)``` - Dropout regularization
|
@@ -159,22 +154,17 @@ More info on <a href="https://github.com/kevbuh/froog/blob/main/docs/contributin
|
|
159
154
|
- ```.swish()``` - Swish activation function (x * sigmoid(x))
|
160
155
|
- ```.conv2d(w, stride=1, groups=1)``` - 2D convolution
|
161
156
|
- ```.im2col2dconv(w)``` - Image to column for convolution
|
162
|
-
|
163
|
-
## Pooling Operations
|
164
157
|
- ```.max_pool2d(kernel_size=(2,2))``` - 2D max pooling
|
165
158
|
- ```.avg_pool2d(kernel_size=(2,2))``` - 2D average pooling
|
166
159
|
|
167
|
-
|
168
|
-
-
|
169
|
-
-
|
170
|
-
-
|
171
|
-
-
|
172
|
-
-
|
173
|
-
- ```.squeeze(dim=None)``` - Remove dimensions of size 1
|
174
|
-
- ```.detach()``` - Returns a tensor detached from computation graph
|
175
|
-
- ```.assign(x)``` - Assign values from tensor x to this tensor
|
160
|
+
TENSOR
|
161
|
+
- ```Tensor.zeros(*shape)``` - Create tensor of zeros
|
162
|
+
- ```Tensor.ones(*shape)``` - Create tensor of ones
|
163
|
+
- ```Tensor.randn(*shape)``` - Create tensor with random normal values
|
164
|
+
- ```Tensor.eye(dim)``` - Create identity matrix
|
165
|
+
- ```Tensor.arange(start, stop=None, step=1)``` - Create tensor with evenly spaced values
|
176
166
|
|
177
|
-
|
167
|
+
TENSOR PROPERTIES
|
178
168
|
- ```.shape``` - The shape of the tensor as a tuple
|
179
169
|
- ```.size``` - Total number of elements in the tensor
|
180
170
|
- ```.ndim``` - Number of dimensions (rank) of the tensor
|
@@ -183,23 +173,22 @@ More info on <a href="https://github.com/kevbuh/froog/blob/main/docs/contributin
|
|
183
173
|
- ```.is_gpu``` - Whether tensor is on GPU
|
184
174
|
- ```.grad``` - Gradient of tensor with respect to some scalar value
|
185
175
|
- ```.data``` - Underlying NumPy array (or GPU buffer)
|
176
|
+
- ```.to_float()``` - Converts tensor to float32 data type
|
177
|
+
- ```.to_int()``` - Converts tensor to int32 data type
|
178
|
+
- ```.to_bool()``` - Converts tensor to boolean data type
|
179
|
+
- ```.reshape(*shape)``` - Change tensor shape
|
180
|
+
- ```.view(*shape)``` - Alternative to reshape
|
181
|
+
- ```.pad2d(padding=None)``` - Pad 2D tensors
|
182
|
+
- ```.flatten()``` - Returns a flattened 1D copy of the tensor
|
183
|
+
- ```.unsqueeze(dim)``` - Add dimension of size 1 at specified position
|
184
|
+
- ```.squeeze(dim=None)``` - Remove dimensions of size 1
|
185
|
+
- ```.detach()``` - Returns a tensor detached from computation graph
|
186
|
+
- ```.assign(x)``` - Assign values from tensor x to this tensor
|
186
187
|
|
187
|
-
|
188
|
+
GPU
|
188
189
|
- ```.to_cpu()``` - Moves tensor to CPU
|
189
190
|
- ```.to_gpu()``` - Moves tensor to GPU
|
190
191
|
- ```.gpu_()``` - In-place GPU conversion (modifies tensor)
|
191
192
|
|
192
|
-
|
193
|
-
- ```.to_float()``` - Converts tensor to float32 data type
|
194
|
-
- ```.to_int()``` - Converts tensor to int32 data type
|
195
|
-
- ```.to_bool()``` - Converts tensor to boolean data type
|
196
|
-
|
197
|
-
## Autograd Operations
|
193
|
+
AUTOGRAD
|
198
194
|
- ```.backward(allow_fill=True)``` - Performs backpropagation
|
199
|
-
|
200
|
-
## Tensor Creation Methods
|
201
|
-
- ```Tensor.zeros(*shape)``` - Create tensor of zeros
|
202
|
-
- ```Tensor.ones(*shape)``` - Create tensor of ones
|
203
|
-
- ```Tensor.randn(*shape)``` - Create tensor with random normal values
|
204
|
-
- ```Tensor.eye(dim)``` - Create identity matrix
|
205
|
-
- ```Tensor.arange(start, stop=None, step=1)``` - Create tensor with evenly spaced values
|
@@ -4,7 +4,7 @@ froog/ops.py,sha256=6CJWxZi9ksSVC_AWrXRBz_ndXC_b7lC206AbeaNYsdc,26241
|
|
4
4
|
froog/optim.py,sha256=rkibUce0rG5O1O4fLsNuS54fd3fzdjQarAyTqK61-1I,5443
|
5
5
|
froog/tensor.py,sha256=jD8rspVMFI__sFMAeKEu_hVhhnfvtgc92oAkNJVKEJg,9688
|
6
6
|
froog/utils.py,sha256=SUXMWOka-yJmib1jeC6KgHI_hOtSzgrakiRA0tCk4vc,3657
|
7
|
-
froog-0.5.
|
8
|
-
froog-0.5.
|
9
|
-
froog-0.5.
|
10
|
-
froog-0.5.
|
7
|
+
froog-0.5.2.dist-info/METADATA,sha256=51IOhneQ4a8NUmrF-LREE945WNHE3_4UAp-mpt1_l6w,7148
|
8
|
+
froog-0.5.2.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
|
9
|
+
froog-0.5.2.dist-info/top_level.txt,sha256=XPz35C_JWu20LlsVxIMdMZn8DD58Ak78LwgWFBGYZwY,6
|
10
|
+
froog-0.5.2.dist-info/RECORD,,
|
File without changes
|
File without changes
|