jittor


Namejittor JSON
Version 1.2.2.59 PyPI version JSON
download
home_pagehttp://jittor.org
Summarya Just-in-time(JIT) deep learning framework
upload_time2021-04-09 04:52:05
maintainer
docs_urlNone
authorJittor Group
requires_python>=3.7
license
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Jittor: a Just-in-time(JIT) deep learning framework

[Quickstart](#quickstart) | [Install](#install) | [Tutorial](#tutorial) | [Chinese](./README.cn.md)


Jittor is a high-performance deep learning framework based on JIT compiling and meta-operators. The whole framework and meta-operators are compiled just-in-time. A powerful op compiler and tuner are integrated into Jittor. It allowed us to generate high-performance code with specialized for your model. Jittor also contains a wealth of high-performance model libraries, including: image recognition, detection, segmentation, generation, differentiable rendering, geometric learning, reinforcement learning, etc. .


The front-end language is Python. Module Design and Dynamic Graph Execution is used in the front-end, which is the most popular design for deeplearning framework interface. The back-end is implemented by high performance language, such as CUDA,C++.


Related Links:
*  [Jittor Website](https://cg.cs.tsinghua.edu.cn/jittor/)
*  [Jittor Tutorials](https://cg.cs.tsinghua.edu.cn/jittor/tutorial/)
*  [Jittor Models](https://cg.cs.tsinghua.edu.cn/jittor/resources/)
*  [Jittor Documents](https://cg.cs.tsinghua.edu.cn/jittor/assets/docs/index.html)
*  [Github](https://github.com/jittor/jittor), [Gitee](https://gitee.com/jittor/jittor)



The following example shows how to model a two-layer neural network step by step and train from scratch In a few lines of Python code.


```python
import jittor as jt
from jittor import Module
from jittor import nn
import numpy as np

class Model(Module):
    def __init__(self):
        self.layer1 = nn.Linear(1, 10)
        self.relu = nn.Relu() 
        self.layer2 = nn.Linear(10, 1)
    def execute (self,x) :
        x = self.layer1(x)
        x = self.relu(x)
        x = self.layer2(x)
        return x

def get_data(n): # generate random data for training test.
    for i in range(n):
        x = np.random.rand(batch_size, 1)
        y = x*x
        yield jt.float32(x), jt.float32(y)


learning_rate = 0.1
batch_size = 50
n = 1000

model = Model()
optim = nn.SGD(model.parameters(), learning_rate)

for i,(x,y) in enumerate(get_data(n)):
    pred_y = model(x)
    dy = pred_y - y
    loss = dy * dy
    loss_mean = loss.mean()
    optim.step(loss_mean)
    print(f"step {i}, loss = {loss_mean.data.sum()}")
```

## Contents

* [Quickstart](#quickstart)
* [Install](#install)
* [Tutorial](#tutorial)
* [Contributing](#contributing)
* [The Team](#theteam)
* [License](#license)



## Quickstart


We provide some jupyter notebooks to help you quick start with Jittor.


- [Example: Model definition and training][1]
- [Basics: Op, Var][2]
- [Meta-operator: Implement your own convolution with Meta-operator][3]

## Install









Jittor environment requirements:

* System: **Ubuntu** >= 16.04 (or **Windows** Subsystem of Linux)
* Python version >= 3.7
* CPU compiler (require at least one of the following)
    * g++ (>=5.4.0)
    * clang (>=8.0)
* GPU compiler (optional)
    * nvcc (>=10.0 for g++ or >=10.2 for clang)
* GPU library: cudnn-dev (recommend tar file installation, [reference link](https://docs.nvidia.com/deeplearning/cudnn/install-guide/index.html#installlinux-tar))



Note: Currently Jittor runs on the Windows operating system through WSL. For the installation method of WSL, please refer to [Microsoft official website](https://docs.microsoft.com/en-us/windows/wsl/install-win10). WSL does not yet support CUDA.

Jittor offers three ways to install: docker, pip, or manual.


## Docker Install



We provide a Docker installation method to save you from configuring the environment. The Docker installation method is as follows:

```
# CPU only(Linux)
docker run -it --network host jittor/jittor
# CPU and CUDA(Linux)
docker run -it --network host --gpus all jittor/jittor-cuda
# CPU only(Mac and Windows)
docker run -it -p 8888:8888 jittor/jittor
```



## Pip install


```bash
sudo apt install python3.7-dev libomp-dev
python3.7 -m pip install jittor
# or install from github(latest version)
# python3.7 -m pip install git+https://github.com/Jittor/jittor.git
python3.7 -m jittor.test.test_example
```


## manual install

We will show how to install Jittor in Ubuntu 16.04 step by step, Other Linux distributions may have similar commands.


### Step 1: Choose your back-end compiler


```bash
# g++
sudo apt install g++ build-essential libomp-dev

# OR clang++-8
wget -O - https://raw.githubusercontent.com/Jittor/jittor/master/script/install_llvm.sh > /tmp/llvm.sh
bash /tmp/llvm.sh 8
```
### Step 2: Install Python and python-dev


Jittor need python version >= 3.7.


```bash
sudo apt install python3.7 python3.7-dev
```

### Step 3: Run Jittor


The whole framework is compiled Just-in-time. Let's install jittor via pip


```bash
git clone https://github.com/Jittor/jittor.git
sudo pip3.7 install ./jittor
export cc_path="clang++-8"
# if other compiler is used, change cc_path
# export cc_path="g++"
# export cc_path="icc"

# run a simple test
python3.7 -m jittor.test.test_example
```
if the test is passed, your Jittor is ready.


### Optional Step 4: Enable CUDA


Using CUDA in Jittor is very simple, Just setup environment value `nvcc_path`


```bash
# replace this var with your nvcc location 
export nvcc_path="/usr/local/cuda/bin/nvcc" 
# run a simple cuda test
python3.7 -m jittor.test.test_cuda 
```
if the test is passed, your can use Jittor with CUDA by setting `use_cuda` flag.


```python
import jittor as jt
jt.flags.use_cuda = 1
```

### Optional Step 5: Test Resnet18 training


To check the integrity of Jittor, you can run Resnet18 training test. Note: 6G GPU RAM is requires in this test.


```bash
python3.7 -m jittor.test.test_resnet
```
if those tests are failed, please report bugs for us, and feel free to contribute ^_^


## Tutorial


In the tutorial section, we will briefly explain the basic concept of Jittor.


To train your model with Jittor, there are only three main concepts you need to know:


* Var: basic data type of jittor
* Operations: Jittor'op is simular with numpy

### Var


First, let's get started with Var. Var is the basic data type of jittor. Computation process in Jittor is asynchronous for optimization. If you want to access the data, `Var.data` can be used for synchronous data accessing.


```python
import jittor as jt
a = jt.float32([1,2,3])
print (a)
print (a.data)
# Output: float32[3,]
# Output: [ 1. 2. 3.]
```

And we can give the variable a name.


```python
a.name('a')
print(a.name())
# Output: a
```

### Operations


Jittor'op is simular with numpy. Let's try some operations. We create Var `a` and `b` via operation `jt.float32`, and add them. Printing those variables shows they have the same shape and dtype.


```python
import jittor as jt
a = jt.float32([1,2,3])
b = jt.float32([4,5,6])
c = a*b
print(a,b,c)
print(type(a), type(b), type(c))
# Output: float32[3,] float32[3,] float32[3,]
# Output: <class 'jittor_core.Var'> <class 'jittor_core.Var'> <class 'jittor_core.Var'>
```
Beside that, All the operators we used `jt.xxx(Var, ...)` have alias `Var.xxx(...)`. For example:


```python
c.max() # alias of jt.max(c)
c.add(a) # alias of jt.add(c, a)
c.min(keepdims=True) # alias of jt.min(c, keepdims=True)
```

if you want to know all the operation which Jittor supports. try `help(jt.ops)`. All the operation you found in `jt.ops.xxx`, can be used via alias `jt.xxx`.


```python
help(jt.ops)
# Output:
#   abs(x: core.Var) -> core.Var
#   add(x: core.Var, y: core.Var) -> core.Var
#   array(data: array) -> core.Var
#   binary(x: core.Var, y: core.Var, op: str) -> core.Var
#   ......
```
### More


If you want to know more about Jittor, please check out the notebooks below:


* Quickstart
    - [Example: Model definition and training][1]
    - [Basics: Op, Var][2]
    - [Meta-operator: Implement your own convolution with Meta-operator][3]
* Advanced
    - [Custom Op: write your operator with C++ and CUDA and JIT compile it][4]
    - [Profiler: Profiling your model][5]
    - Jtune: Tool for performance tuning



[1]: notebook/example.src.md	"example"
[2]: notebook/basics.src.md	"basics"
[3]: notebook/meta_op.src.md	"meta_op"
[4]: notebook/custom_op.src.md	"custom_op"
[5]: notebook/profiler.src.md	"profiler"

Those notebooks can be started in your own computer by `python3.7 -m jittor.notebook`


## Contributing


Jittor is still young. It may contain bugs and issues. Please report them in our bug track system. Contributions are welcome. Besides, if you have any ideas about Jittor, please let us know.




You can help Jittor in the following ways:

* Citing Jittor in your paper
* recommend Jittor to your friends
* Contributing code
* Contributed tutorials and documentation
* File an issue
* Answer jittor related questions
* Light up the stars
* Keep an eye on jittor
* ......

## Contact Us





Website: http://cg.cs.tsinghua.edu.cn/jittor/

Email: jittor@qq.com

File an issue: https://github.com/Jittor/jittor/issues

QQ Group: 761222083


<img src="https://cg.cs.tsinghua.edu.cn/jittor/images/news/2020-12-8-21-19-1_2_2/fig4.png" width="200"/>

## The Team


Jittor is currently maintained by the [Tsinghua CSCG Group](https://cg.cs.tsinghua.edu.cn/). If you are also interested in Jittor and want to improve it, Please join us!


## Citation


```
@article{hu2020jittor,
  title={Jittor: a novel deep learning framework with meta-operators and unified graph execution},
  author={Hu, Shi-Min and Liang, Dun and Yang, Guo-Ye and Yang, Guo-Wei and Zhou, Wen-Yang},
  journal={Information Sciences},
  volume={63},
  number={222103},
  pages={1--21},
  year={2020}
}
```

## License


Jittor is Apache 2.0 licensed, as found in the LICENSE.txt file.
            

Raw data

            {
    "_id": null,
    "home_page": "http://jittor.org",
    "name": "jittor",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "",
    "author": "Jittor Group",
    "author_email": "ran.donglang@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/f3/84/de09f1d8e8f217e04d7159161e0147c807c071208458feafac87c0bb51d4/jittor-1.2.2.59.tar.gz",
    "platform": "",
    "description": "# Jittor: a Just-in-time(JIT) deep learning framework\n\n[Quickstart](#quickstart) | [Install](#install) | [Tutorial](#tutorial) | [Chinese](./README.cn.md)\n\n\nJittor is a high-performance deep learning framework based on JIT compiling and meta-operators. The whole framework and meta-operators are compiled just-in-time. A powerful op compiler and tuner are integrated into Jittor. It allowed us to generate high-performance code with specialized for your model. Jittor also contains a wealth of high-performance model libraries, including: image recognition, detection, segmentation, generation, differentiable rendering, geometric learning, reinforcement learning, etc. .\n\n\nThe front-end language is Python. Module Design and Dynamic Graph Execution is used in the front-end, which is the most popular design for deeplearning framework interface. The back-end is implemented by high performance language, such as CUDA,C++.\n\n\nRelated Links:\n*  [Jittor Website](https://cg.cs.tsinghua.edu.cn/jittor/)\n*  [Jittor Tutorials](https://cg.cs.tsinghua.edu.cn/jittor/tutorial/)\n*  [Jittor Models](https://cg.cs.tsinghua.edu.cn/jittor/resources/)\n*  [Jittor Documents](https://cg.cs.tsinghua.edu.cn/jittor/assets/docs/index.html)\n*  [Github](https://github.com/jittor/jittor), [Gitee](https://gitee.com/jittor/jittor)\n\n\n\nThe following example shows how to model a two-layer neural network step by step and train from scratch In a few lines of Python code.\n\n\n```python\nimport jittor as jt\nfrom jittor import Module\nfrom jittor import nn\nimport numpy as np\n\nclass Model(Module):\n    def __init__(self):\n        self.layer1 = nn.Linear(1, 10)\n        self.relu = nn.Relu() \n        self.layer2 = nn.Linear(10, 1)\n    def execute (self,x) :\n        x = self.layer1(x)\n        x = self.relu(x)\n        x = self.layer2(x)\n        return x\n\ndef get_data(n): # generate random data for training test.\n    for i in range(n):\n        x = np.random.rand(batch_size, 1)\n        y = x*x\n        yield jt.float32(x), jt.float32(y)\n\n\nlearning_rate = 0.1\nbatch_size = 50\nn = 1000\n\nmodel = Model()\noptim = nn.SGD(model.parameters(), learning_rate)\n\nfor i,(x,y) in enumerate(get_data(n)):\n    pred_y = model(x)\n    dy = pred_y - y\n    loss = dy * dy\n    loss_mean = loss.mean()\n    optim.step(loss_mean)\n    print(f\"step {i}, loss = {loss_mean.data.sum()}\")\n```\n\n## Contents\n\n* [Quickstart](#quickstart)\n* [Install](#install)\n* [Tutorial](#tutorial)\n* [Contributing](#contributing)\n* [The Team](#theteam)\n* [License](#license)\n\n\n\n## Quickstart\n\n\nWe provide some jupyter notebooks to help you quick start with Jittor.\n\n\n- [Example: Model definition and training][1]\n- [Basics: Op, Var][2]\n- [Meta-operator: Implement your own convolution with Meta-operator][3]\n\n## Install\n\n\n\n\n\n\n\n\n\nJittor environment requirements:\n\n* System: **Ubuntu** >= 16.04 (or **Windows** Subsystem of Linux)\n* Python version >= 3.7\n* CPU compiler (require at least one of the following)\n    * g++ (>=5.4.0)\n    * clang (>=8.0)\n* GPU compiler (optional)\n    * nvcc (>=10.0 for g++ or >=10.2 for clang)\n* GPU library: cudnn-dev (recommend tar file installation, [reference link](https://docs.nvidia.com/deeplearning/cudnn/install-guide/index.html#installlinux-tar))\n\n\n\nNote: Currently Jittor runs on the Windows operating system through WSL. For the installation method of WSL, please refer to [Microsoft official website](https://docs.microsoft.com/en-us/windows/wsl/install-win10). WSL does not yet support CUDA.\n\nJittor offers three ways to install: docker, pip, or manual.\n\n\n## Docker Install\n\n\n\nWe provide a Docker installation method to save you from configuring the environment. The Docker installation method is as follows:\n\n```\n# CPU only(Linux)\ndocker run -it --network host jittor/jittor\n# CPU and CUDA(Linux)\ndocker run -it --network host --gpus all jittor/jittor-cuda\n# CPU only(Mac and Windows)\ndocker run -it -p 8888:8888 jittor/jittor\n```\n\n\n\n## Pip install\n\n\n```bash\nsudo apt install python3.7-dev libomp-dev\npython3.7 -m pip install jittor\n# or install from github(latest version)\n# python3.7 -m pip install git+https://github.com/Jittor/jittor.git\npython3.7 -m jittor.test.test_example\n```\n\n\n## manual install\n\nWe will show how to install Jittor in Ubuntu 16.04 step by step, Other Linux distributions may have similar commands.\n\n\n### Step 1: Choose your back-end compiler\n\n\n```bash\n# g++\nsudo apt install g++ build-essential libomp-dev\n\n# OR clang++-8\nwget -O - https://raw.githubusercontent.com/Jittor/jittor/master/script/install_llvm.sh > /tmp/llvm.sh\nbash /tmp/llvm.sh 8\n```\n### Step 2: Install Python and python-dev\n\n\nJittor need python version >= 3.7.\n\n\n```bash\nsudo apt install python3.7 python3.7-dev\n```\n\n### Step 3: Run Jittor\n\n\nThe whole framework is compiled Just-in-time. Let's install jittor via pip\n\n\n```bash\ngit clone https://github.com/Jittor/jittor.git\nsudo pip3.7 install ./jittor\nexport cc_path=\"clang++-8\"\n# if other compiler is used, change cc_path\n# export cc_path=\"g++\"\n# export cc_path=\"icc\"\n\n# run a simple test\npython3.7 -m jittor.test.test_example\n```\nif the test is passed, your Jittor is ready.\n\n\n### Optional Step 4: Enable CUDA\n\n\nUsing CUDA in Jittor is very simple, Just setup environment value `nvcc_path`\n\n\n```bash\n# replace this var with your nvcc location \nexport nvcc_path=\"/usr/local/cuda/bin/nvcc\" \n# run a simple cuda test\npython3.7 -m jittor.test.test_cuda \n```\nif the test is passed, your can use Jittor with CUDA by setting `use_cuda` flag.\n\n\n```python\nimport jittor as jt\njt.flags.use_cuda = 1\n```\n\n### Optional Step 5: Test Resnet18 training\n\n\nTo check the integrity of Jittor, you can run Resnet18 training test. Note: 6G GPU RAM is requires in this test.\n\n\n```bash\npython3.7 -m jittor.test.test_resnet\n```\nif those tests are failed, please report bugs for us, and feel free to contribute ^_^\n\n\n## Tutorial\n\n\nIn the tutorial section, we will briefly explain the basic concept of Jittor.\n\n\nTo train your model with Jittor, there are only three main concepts you need to know:\n\n\n* Var: basic data type of jittor\n* Operations: Jittor'op is simular with numpy\n\n### Var\n\n\nFirst, let's get started with Var. Var is the basic data type of jittor. Computation process in Jittor is asynchronous for optimization. If you want to access the data, `Var.data` can be used for synchronous data accessing.\n\n\n```python\nimport jittor as jt\na = jt.float32([1,2,3])\nprint (a)\nprint (a.data)\n# Output: float32[3,]\n# Output: [ 1. 2. 3.]\n```\n\nAnd we can give the variable a name.\n\n\n```python\na.name('a')\nprint(a.name())\n# Output: a\n```\n\n### Operations\n\n\nJittor'op is simular with numpy. Let's try some operations. We create Var `a` and `b` via operation `jt.float32`, and add them. Printing those variables shows they have the same shape and dtype.\n\n\n```python\nimport jittor as jt\na = jt.float32([1,2,3])\nb = jt.float32([4,5,6])\nc = a*b\nprint(a,b,c)\nprint(type(a), type(b), type(c))\n# Output: float32[3,] float32[3,] float32[3,]\n# Output: <class 'jittor_core.Var'> <class 'jittor_core.Var'> <class 'jittor_core.Var'>\n```\nBeside that, All the operators we used `jt.xxx(Var, ...)` have alias `Var.xxx(...)`. For example:\n\n\n```python\nc.max() # alias of jt.max(c)\nc.add(a) # alias of jt.add(c, a)\nc.min(keepdims=True) # alias of jt.min(c, keepdims=True)\n```\n\nif you want to know all the operation which Jittor supports. try `help(jt.ops)`. All the operation you found in `jt.ops.xxx`, can be used via alias `jt.xxx`.\n\n\n```python\nhelp(jt.ops)\n# Output:\n#   abs(x: core.Var) -> core.Var\n#   add(x: core.Var, y: core.Var) -> core.Var\n#   array(data: array) -> core.Var\n#   binary(x: core.Var, y: core.Var, op: str) -> core.Var\n#   ......\n```\n### More\n\n\nIf you want to know more about Jittor, please check out the notebooks below:\n\n\n* Quickstart\n    - [Example: Model definition and training][1]\n    - [Basics: Op, Var][2]\n    - [Meta-operator: Implement your own convolution with Meta-operator][3]\n* Advanced\n    - [Custom Op: write your operator with C++ and CUDA and JIT compile it][4]\n    - [Profiler: Profiling your model][5]\n    - Jtune: Tool for performance tuning\n\n\n\n[1]: notebook/example.src.md\t\"example\"\n[2]: notebook/basics.src.md\t\"basics\"\n[3]: notebook/meta_op.src.md\t\"meta_op\"\n[4]: notebook/custom_op.src.md\t\"custom_op\"\n[5]: notebook/profiler.src.md\t\"profiler\"\n\nThose notebooks can be started in your own computer by `python3.7 -m jittor.notebook`\n\n\n## Contributing\n\n\nJittor is still young. It may contain bugs and issues. Please report them in our bug track system. Contributions are welcome. Besides, if you have any ideas about Jittor, please let us know.\n\n\n\n\nYou can help Jittor in the following ways:\n\n* Citing Jittor in your paper\n* recommend Jittor to your friends\n* Contributing code\n* Contributed tutorials and documentation\n* File an issue\n* Answer jittor related questions\n* Light up the stars\n* Keep an eye on jittor\n* ......\n\n## Contact Us\n\n\n\n\n\nWebsite: http://cg.cs.tsinghua.edu.cn/jittor/\n\nEmail: jittor@qq.com\n\nFile an issue: https://github.com/Jittor/jittor/issues\n\nQQ Group: 761222083\n\n\n<img src=\"https://cg.cs.tsinghua.edu.cn/jittor/images/news/2020-12-8-21-19-1_2_2/fig4.png\" width=\"200\"/>\n\n## The Team\n\n\nJittor is currently maintained by the [Tsinghua CSCG Group](https://cg.cs.tsinghua.edu.cn/). If you are also interested in Jittor and want to improve it, Please join us!\n\n\n## Citation\n\n\n```\n@article{hu2020jittor,\n  title={Jittor: a novel deep learning framework with meta-operators and unified graph execution},\n  author={Hu, Shi-Min and Liang, Dun and Yang, Guo-Ye and Yang, Guo-Wei and Zhou, Wen-Yang},\n  journal={Information Sciences},\n  volume={63},\n  number={222103},\n  pages={1--21},\n  year={2020}\n}\n```\n\n## License\n\n\nJittor is Apache 2.0 licensed, as found in the LICENSE.txt file.",
    "bugtrack_url": null,
    "license": "",
    "summary": "a Just-in-time(JIT) deep learning framework",
    "version": "1.2.2.59",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "69461d89d81c8beec1011c0cb12bbdd0",
                "sha256": "55c3bf596c306355f3a5395927aa8bb8727d767f86fb9959abb5c784d3f9b3fa"
            },
            "downloads": -1,
            "filename": "jittor-1.2.2.59.tar.gz",
            "has_sig": false,
            "md5_digest": "69461d89d81c8beec1011c0cb12bbdd0",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 945516,
            "upload_time": "2021-04-09T04:52:05",
            "upload_time_iso_8601": "2021-04-09T04:52:05.322854Z",
            "url": "https://files.pythonhosted.org/packages/f3/84/de09f1d8e8f217e04d7159161e0147c807c071208458feafac87c0bb51d4/jittor-1.2.2.59.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2021-04-09 04:52:05",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "lcname": "jittor"
}
        
Elapsed time: 0.27552s