Commit Graph

1961 Commits

Author SHA1 Message Date
George Hotz
76ab379f9b readme updates 2023-06-05 12:20:14 -07:00
cloud11665
43ea1614b0 fix inf/nan codegen (#935)
* fix inf/nan codegen

* remove nasty oneliner, fix -inf

* inf/nan const mul/div tests
2023-06-05 11:24:09 -07:00
Filip Dimitrovski
78460034ff Initial ellipsis support when slicing Tensors (#843)
* Initial ellipsis support when slicing Tensors

* Better comments in ellipsis slicing

* Formatting
2023-06-05 07:52:49 -07:00
M4tthewDE
70f12fdb57 Fix wrong op version being used if versions equal (#934) 2023-06-05 07:45:10 -07:00
Steven Anderson
79613eb83e Test min (#932)
* fix __neg__ defaulting to float32 due to 0.0

* fixed __neg__ always defaulting to float32

* fixed openpilot (OpenCL) Test
2023-06-05 00:03:30 -07:00
kposborne2
00360da05b Update broken docs/abstractions.py for changed ops, and add to CI (#930)
* fix and add to ci

* still have those

* ocd

* update other doc
2023-06-04 19:21:20 -07:00
Tom Edwards
5bbcbd145c Add cumsum with n-dim inputs (#922)
* add cumsum with n-dim inputs, over arbitrary axis + relevant tests

* increased rtol for cumsum test

* move test_cumsum into test_ops

* skip arange test for images as relies on cumsum

* Fix typo

* rewrite cumsum to work with images
2023-06-04 16:55:23 -07:00
wozeparrot
091bd65a68 feat: quick doc fixups (#923) 2023-06-04 11:03:57 -07:00
George Hotz
fbf17f0031 intel benchmark matmul gets 60 TFLOPS? 2023-06-04 17:01:50 +00:00
Steven Anderson
657e642e3a Fixed test suite for Clip (#912)
* Fixed test suite for Clip

* fixed issue with clip when taking large negative numbers as min

* Remove typings
2023-06-04 09:01:01 -07:00
kposborne2
0b88c5f923 Eliminate LoadOps.FROMCPU (#920)
* Add fromCPU method to init LazyBuffer to eliminate LoadOps.FROMCPU

* squish

* remove failing test

* seems logical

* Revert "seems logical"

This reverts commit bbdcdc8713.

* inline and remove assertion

* fromCPU staticmethod, defer non-cpu device to loadop

* restore test
2023-06-04 08:55:50 -07:00
George Hotz
3e0b37f050 randn slow 2023-06-04 08:52:13 -07:00
wozeparrot
e9c1ae3825 Add a quick start guide (#900)
* feat: initial quick start guide

* fix: fix link

* feat: add note about jit

* feat: add note about load/store ops

* feat: add link to discord

* feat: add note about saving and loading models

* fix: correct code for saving and loading

* feat: overhaul docs

* fix: fix link

* feat: wording

* feat: add link to discord

* feat: contributing guidelines

* feat: make contributing section more doc focused

* feat: add link to env_vars from readme

* fix: wording

* feat: move community to bottom

* feat: showcase

* feat: linebreak

* feat: redesigned header

* feat: tweaks

* feat: tweaks

* feat: badge for lines of code

* feat: move installation instructions to repo readme

* feat: readme overhaul number 2

* feat: move visualization to quick start guide

* feat: readme 2 electric boogaloo

* fix: grammar

* fix: formatting

* feat: no ugly line

* feat: add line back

* feat: new load method

* feat: split adding accelerator docs out

* feat: showcase whisper

* feat: smaller tweaks

* feat: bring back oneliner
2023-06-04 08:51:20 -07:00
Alexey Zaytsev
d429553730 Allow Tensor(tuple) (#911) 2023-06-03 23:48:19 -07:00
George Hotz
afd0be8a9c intel example 2023-06-04 06:43:09 +00:00
MohammedAlkhrashi
2b4baa97e9 exclude string type from external_test_onnx_backend.py (#918) 2023-06-03 19:10:52 -07:00
George Hotz
b78addf2f8 Whisper (#919)
* no whispering yet

* whispering

* live whisper

* small support
2023-06-03 18:55:14 -07:00
George Hotz
ed1963b899 Fast DiskTensor to other Tensor (#916)
* make disktensors fast

* loading

* loader for sd and llama
2023-06-03 12:25:41 -07:00
George Hotz
791530045d Refactor LoadOps (#910)
* test

* work

* upd test

* loadops

* cleanups

* real ones

* remove LazyNumpyArray

* fix assign test

* remove range

* np.require

* llama uses arange kernels

* no caching consts

* fix enet

* torch load support

* tests cleanup

* fix shufflenet

* fix image

* fix torch_load test
2023-06-03 09:40:43 -07:00
George Hotz
d58586bb17 safetensors! (#903)
* safetensors test

* safe_save

* load back with real safetensors

* bugfix in device name. add simple torch_load

* it works for llama, but it's slower...

* mmap

* no intermediate

* load mmaped

* readinto speed

* not ready yet

* revert that
2023-06-02 13:41:09 -07:00
Steven Anderson
513aeb2f66 Fixed all ConstantOfShape test suite (#907) 2023-06-02 11:26:40 -07:00
Steven Anderson
301f7b54c6 ConstantOfShape ONNX test fixed. (#890)
* ConstantOfShape ONNX test fixed.

* removed redundant if statement

* value is optional and should default to a float32 tensor with value of 0

* fixed: default parameters are created at function definition, bad for mutable objects.
2023-06-02 07:34:25 -07:00
Alexey Zaytsev
5feee9c94b Fix .std() tests on torch=1.13 (#904) 2023-06-02 07:33:51 -07:00
George Hotz
4d28d55683 add nn layer tests 2023-06-01 21:34:24 -07:00
George Hotz
8a928ed2f3 nn init matches torch (#901) 2023-06-01 21:24:11 -07:00
Peter Ross
27845fd3a3 train_efficientnet: only import datasets.imagenet when IMAGENET is set (#899)
make it work out of the box for new users.

the default configuration of train_efficientnet is to use the smaller cifar
dataset. import datasets.imagenet tries to open imagenet_class_index.json
and will fail, unless user has already downloaded it.
2023-06-01 19:19:52 -07:00
George Hotz
1b42b4e1b8 fix examples/hlb_cifar10.py 2023-06-01 19:03:17 -07:00
wozeparrot
bfea5215e9 Add weight decay to SGD (#883)
* feat: add weight decay to sgd

* fix: fix tests
2023-06-01 13:13:18 -07:00
Nicklas Boman
0e9e0fd718 document environment variables (#887) 2023-06-01 13:11:17 -07:00
SnakeOnex
67a7674787 added conv1d tests -> simple, padding, stride, asymmetric padding (#896)
* added conv1d tests -> simple, padding, stride, asymmetric padding

* fixed linting

* skip conv1d tests for images
2023-06-01 13:10:37 -07:00
Bartłomiej Jargut
ea9d4e6d78 Slightly improved readability of reshape method condition check (#898)
* Added few missing return typehints for tensor.py

* added test for empty tensor for Tensor.numel()

* fixed missing numel call in test_numel

* small change in reshape shape condition check

* Merge from upstream
2023-06-01 13:10:08 -07:00
George Hotz
dd41f3ee40 compact the global dimensions using the shapetracker (#897) 2023-06-01 13:09:54 -07:00
Joqsan
ef129bcb85 Zero dim Tensor support (#777)
* add and reorganize test_slice_* tests

* refactor Tensor.__getitem__()

* preliminary tests for 1) 0D tensors and 2) varargs for Tensor.zeros and Tensor.ones

* always compare shapes of the numpy arrays obtained from tinygrad and torch tensors

* add more tests for 0D support

* remove test_tensor.test_slicing(). All slicing tests at test/test_ops.py

* add zero-dim support

* make test_end2end.py consistent with 0dim support

* add test for tensor with zero in shape

* don't simplify ones if shape is ()

* skip tests that need zero-size tensor support.

- zero-size tensor support not related to 0dim tensors.

* add tests for __getitem__() supporting strides >= 1

* refactor __getitem__: support for strides >= 1

* minor refactors and add comments to __getitem__

* add tests for slices with negative steps

* add support for slices with negative strides
2023-06-01 11:32:02 -07:00
kposborne2
ae83e9844c add output_padding to transposed conv (#875) 2023-06-01 00:03:22 -07:00
Friedrich Carl Eichenroth
740304ef9d Small Onnx Parser Improvements (#885)
* wip

* rename onnx_version to onnx_model_versioN

* add type

* add types

* small cleanup

* revert some changes from before

* add todo

* dumb fix
2023-06-01 00:01:01 -07:00
Tom Edwards
115903a15c Add unbiased std and corresponding tests (#881)
* add unbiased std and corresponding tests

* replaced unbiased with correction + tests
2023-05-31 16:32:36 -07:00
Bartłomiej Jargut
447b5847e2 Added test for empty tensor for Tensor.numel(), added missing numel call (#880)
* Added few missing return typehints for tensor.py

* added test for empty tensor for Tensor.numel()

* fixed missing numel call in test_numel

---------

Co-authored-by: deefi <dee7ine@gmail.com>
2023-05-31 12:28:47 -07:00
Alexey Zaytsev
b58d875937 Add Tensor.ndim .element_size .is_floating_point (#876) 2023-05-31 09:00:35 -07:00
Marcello Fuschi
3924aae8ed Fix ONNX dropout and unify the implementation (#857)
* Fix ONNX dropout and unify the implementation

* Use tensor rand method for dropout

* Change approach for RNG in ONNX Dropout

* Fix style

* Test legacy RNG seeding

* Remove the necessity for legacy RNG in Tensor class
2023-05-31 07:40:47 -07:00
Diogo
1272d8526a Llvm int support (#866)
* added int val support to llvm

* lint fix

* added types

* fix merge issues
2023-05-30 17:49:26 -07:00
Nima Khodaveisi
5670123d88 Add tensor.numel (#869)
* add tensor.numel

* add tensor.numel
2023-05-30 16:08:09 -07:00
skobsman
2e393f7ef2 InstanceNormalization ONNX test fixed. (#870) 2023-05-30 16:07:44 -07:00
Diogo
0dab8edc97 support Int64 type in cstyle gen (#860)
* added metal int64 and some simple tests

* removed bool return type def

* typo in test

* also missing in clang and gpu runtimes

* switched order for opencl

* increased atol and removed new line in kernel prefix
2023-05-30 16:04:46 -07:00
wozeparrot
0fc4cf72a2 feat: add train scaffolding (#859) 2023-05-30 07:10:40 -07:00
Friedrich Carl Eichenroth
f91f28d9e2 fix a bunch of tests (#856) 2023-05-29 17:48:26 -07:00
Ubaidullah Khan
502e33652f add Tensor.full and Tensor.full_like and reuse them (#852)
* add Tensor.ones_like()

* add full_like and full and reuse in zeros,ones

* add tests for full and full_like
2023-05-29 17:48:09 -07:00
leopf
dd1ac5d267 stack based context manager for DEBUG and IMAGE (#844)
* stacked context manager for DEBUG and IMAGE

* remove pointless var in __enter__

* removed context globals

* fix: remove context var constraint

* feat: allow setting context var before init

* fix: formatting

* fix: formatting 2

---------

Co-authored-by: leopf <l.pfob@3-klicks.de>
2023-05-29 17:36:15 -07:00
Rabia Eda Yılmaz
3075988468 Added kaiming_uniform initialization for Conv2d and Linear layers (#756)
* added kaiming_uniform init for conv2d and linear layers

* fix: set getattr

* up

* fix: set getattr

* fix comments

* better does not mean it is good

* more nonlinearities

* added test

checks the distribution of default relu option

* prettier

* fix kernel size

* edit distribution of returned tensor

* complete tests and fix fan_mode

* added higher dim test

* prettier test

* fix silly blank

* just leaky_relu mode

* default fan in and leaky relu

* update params

* fix test

* shorter

* generalize Tensor.uniform and adjust kaiming init

- added low and high parameters to Tensor.uniform function, so it can have a specific range (default is 0 to 1)
- adjusted return line of kaiming_uniform

* range from -1 to 1

* delete comment

* adjusted test_uniform

* fixed

* delete comment
2023-05-29 15:09:55 -07:00
zk-tarts
174c65b7d9 add onnx Binarizer op (#850)
Co-authored-by: zk-tarts <>
2023-05-29 13:15:50 -07:00
M4tthewDE
4408c25e9a Add Onnx op Shrink (#851)
* Add onnx Shrink operation

* Fix soft/hard shrink onnx test
2023-05-29 13:15:39 -07:00