Skip to content

Commit

Permalink
Add dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
gyusang committed Oct 11, 2023
1 parent db10ec1 commit fe9f4cd
Show file tree
Hide file tree
Showing 19 changed files with 4,160 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,5 @@ RUN curl -sSL https://pdm.fming.dev/install-pdm.py | python - \
&& mkdir ${ZSH_CUSTOM}/plugins/pdm \
&& pdm completion zsh > ${ZSH_CUSTOM}/plugins/pdm/_pdm \
&& sed -i "s|^plugins=(|&pdm |" ${HOME}/.zshrc \
&& echo 'eval $(pdm venv activate)' >>${HOME}/.zshrc
&& echo 'eval $(pdm venv activate in-project)' >>${HOME}/.zshrc \
&& echo 'export COMPUTE_PLATFORM=cpu'
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// 👇 Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
// 👇 Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "",
"postCreateCommand": "cd /workspaces/LuX-AI-Season-2 && pdm use -f && pdm venv create && eval $(pdm venv activate in-project) && pdm update",
// 👇 Configure tool-specific properties.
"customizations": {
"vscode": {
Expand Down
23 changes: 22 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,30 @@ authors = [
]
dependencies = [
"jaxlib @ https://storage.googleapis.com/jax-releases/cuda11/jaxlib-0.4.7+cuda11.cudnn82-cp310-cp310-manylinux2014_x86_64.whl",
"jax==0.4.7",
"jax[cuda11_cudnn82]==0.4.7",
"rich>=13.6.0",
"juxai-s2>=3.0.0",
"vec-noise @ file:///${PROJECT_ROOT}/vec_noise-1.1.4",
"torch>=2.1.0",
"torchvision>=0.16.0",
"torchaudio>=2.1.0",
]
requires-python = ">=3.10,<3.11"
readme = "README.md"
license = {text = "NOLICENSE"}

[tool.pdm.dev-dependencies]
dev = [
"jupyter>=1.0.0",
"opencv-python-headless>=4.8.1.78",
]

[[tool.pdm.source]]
name = "torch"
url = "https://download.pytorch.org/whl/${COMPUTE_PLATFORM}"
verify_ssl = true

[[tool.pdm.source]]
name = "jaxlib"
url = "https://storage.googleapis.com/jax-releases/jax_cuda_releases.html"
verify_ssl = true
1,752 changes: 1,752 additions & 0 deletions tutorial.ipynb

Large diffs are not rendered by default.

23 changes: 23 additions & 0 deletions vec_noise-1.1.4/CHANGES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
1.1.4 -- August 1, 2017

- Fix Python 3 crash

1.1.3 -- June 8, 2017

- Add build-time dependency on numpy

1.1.2 -- May 8, 2017

- Fix scalar fallback detection

1.1.1 -- May 8, 2017

- Dummy version for re-upload to PyPI

1.1.0 -- May 8, 2017

- Add vectorized versions of the simplex noise functions

1.0.0 -- April 11, 2017

- Initial fork from https://github.com/caseman/noise
20 changes: 20 additions & 0 deletions vec_noise-1.1.4/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Original work (noise library) Copyright (c) 2008 Casey Duncan
Modified work (vec_noise library) Copyright (c) 2017 Zev Benjamin

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
3 changes: 3 additions & 0 deletions vec_noise-1.1.4/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
global-exclude *.pyc *.pyo *.o
include *.py *.c *.h *.txt MANIFEST.in MANIFEST
recursive-include examples *.txt *.py *.png *.jpg
37 changes: 37 additions & 0 deletions vec_noise-1.1.4/PKG-INFO
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
Metadata-Version: 1.1
Name: vec_noise
Version: 1.1.4
Summary: Vectorized Perlin noise for Python
Home-page: https://github.com/zbenjamin/vec_noise
Author: Zev Benjamin
Author-email: [email protected]
License: UNKNOWN
Description: This is a fork of Casey Duncan's noise library that vectorizes all of the noise
functions using NumPy. It is much faster than the original for computing noise
values at many coordinates.

Perlin noise is ubiquitous in modern CGI. Used for procedural texturing,
animation, and enhancing realism, Perlin noise has been called the "salt" of
procedural content. Perlin noise is a type of gradient noise, smoothly
interpolating across a pseudo-random matrix of values.

The vec_noise library includes native-code implementations of Perlin "improved"
noise and Perlin simplex noise. It also includes a fast implementation of
Perlin noise in GLSL, for use in OpenGL shaders. The shader code and many of
the included examples require Pyglet (http://www.pyglet.org), the native-code
noise functions themselves do not, however.

The Perlin improved noise functions can also generate fBm (fractal Brownian
motion) noise by combining multiple octaves of Perlin noise. Shader functions
for convenient generation of turbulent noise are also included.

Platform: UNKNOWN
Classifier: Development Status :: 4 - Beta
Classifier: Topic :: Multimedia :: Graphics
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: MacOS :: MacOS X
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX
Classifier: Programming Language :: C
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 3
65 changes: 65 additions & 0 deletions vec_noise-1.1.4/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
Vectorized native-code and shader implementations of Perlin noise for Python
============================================================================

This is a fork of Casey Duncan's `noise
library <https://github.com/caseman/noise>`_ that vectorizes all of the noise
functions using `NumPy <http://www.numpy.org>`_. It is much faster than the
original for computing noise values at many coordinates.

This package is designed to give you simple to use, fast functions for
generating Perlin noise in your Python programs. Perlin noise is famously
called the "salt" of procedural generation, as it adds considerable flavor in
its application. Noise is commonly used for imparting realism in textures,
animation and other procedural content generation -- placement of hairs,
heights of mountains, density of forests, waving of a flag, etc. etc..

Background
==========

Ken Perlin invented the technique implemented in these algorithms following
his work on the CGI for the movie Tron. Over time Perlin noise has become
ubiquitous in CGI, and greatly contributed to the huge leap in realism that
followed.

An excellent "from the horse's mouth" overview of Perlin noise can be found
here: http://www.noisemachine.com/talk1/

An excellent discussion of simplex noise can be found here:
http://zach.in.tu-clausthal.de/teaching/cg2_08/literatur/simplexnoise.pdf

The vec_noise library includes native-code implementations of Perlin "improved"
noise and Perlin simplex noise. It also includes a fast implementation of
Perlin noise in GLSL, for use in OpenGL shaders. The shader code and many of
the included examples require Pyglet (http://www.pyglet.org), the native-code
noise functions themselves do not, however.

The Perlin improved noise functions can also generate fBm (fractal Brownian
motion) noise by combining multiple octaves of Perlin noise. Functions for
convenient generation of turbulent noise in shaders are also included.

Installation
============

Installation uses the standard Python distutils regime::

python setup.py install


This will compile and install the noise package into your Python site
packages.

Usage
=====

The functions and their signatures are documented in their respective
docstrings. Use the Python help() function to read them::

>>> import vec_noise
>>> help(vec_noise)

The examples directory contains sample programs using the noise functions.

Thanks
======

Blue planet texture used for atmosphere example courtesy NASA
20 changes: 20 additions & 0 deletions vec_noise-1.1.4/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
"""Noise functions for procedural generation of content
Contains native code implementations of Perlin improved noise (with
fBm capabilities) and Perlin simplex noise. Also contains a fast
"fake noise" implementation in GLSL for execution in shaders.
Copyright (c) 2008, Casey Duncan (casey dot duncan at gmail dot com)
Copyright (c) 2017, Zev Benjamin <[email protected]>
"""

__version__ = "1.1.4"

from . import _perlin, _simplex

snoise2 = _simplex.noise2
snoise3 = _simplex.noise3
snoise4 = _simplex.noise4
pnoise1 = _perlin.noise1
pnoise2 = _perlin.noise2
pnoise3 = _perlin.noise3
108 changes: 108 additions & 0 deletions vec_noise-1.1.4/_noise.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
// -*- mode: c; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; -*-
//
// Copyright (c) 2008, Casey Duncan (casey dot duncan at gmail dot com)
// see LICENSE.txt for details

#include <math.h>

#if defined(_MSC_VER)
#define inline _inline
#define M_1_PI 0.31830988618379067154
#endif

const float GRAD3[][3] = {
{1,1,0},{-1,1,0},{1,-1,0},{-1,-1,0},
{1,0,1},{-1,0,1},{1,0,-1},{-1,0,-1},
{0,1,1},{0,-1,1},{0,1,-1},{0,-1,-1},
{1,0,-1},{-1,0,-1},{0,-1,1},{0,1,1}};

const float GRAD4[][4] = {
{0,1,1,1}, {0,1,1,-1}, {0,1,-1,1}, {0,1,-1,-1},
{0,-1,1,1}, {0,-1,1,-1}, {0,-1,-1,1}, {0,-1,-1,-1},
{1,0,1,1}, {1,0,1,-1}, {1,0,-1,1}, {1,0,-1,-1},
{-1,0,1,1}, {-1,0,1,-1}, {-1,0,-1,1}, {-1,0,-1,-1},
{1,1,0,1}, {1,1,0,-1}, {1,-1,0,1}, {1,-1,0,-1},
{-1,1,0,1}, {-1,1,0,-1}, {-1,-1,0,1}, {-1,-1,0,-1},
{1,1,1,0}, {1,1,-1,0}, {1,-1,1,0}, {1,-1,-1,0},
{-1,1,1,0}, {-1,1,-1,0}, {-1,-1,1,0}, {-1,-1,-1,0}};

// At the possible cost of unaligned access, we use char instead of
// int here to try to ensure that this table fits in L1 cache
const unsigned char PERM[] = {
151, 160, 137, 91, 90, 15, 131, 13, 201, 95, 96, 53, 194, 233, 7, 225, 140,
36, 103, 30, 69, 142, 8, 99, 37, 240, 21, 10, 23, 190, 6, 148, 247, 120,
234, 75, 0, 26, 197, 62, 94, 252, 219, 203, 117, 35, 11, 32, 57, 177, 33,
88, 237, 149, 56, 87, 174, 20, 125, 136, 171, 168, 68, 175, 74, 165, 71,
134, 139, 48, 27, 166, 77, 146, 158, 231, 83, 111, 229, 122, 60, 211, 133,
230, 220, 105, 92, 41, 55, 46, 245, 40, 244, 102, 143, 54, 65, 25, 63, 161,
1, 216, 80, 73, 209, 76, 132, 187, 208, 89, 18, 169, 200, 196, 135, 130,
116, 188, 159, 86, 164, 100, 109, 198, 173, 186, 3, 64, 52, 217, 226, 250,
124, 123, 5, 202, 38, 147, 118, 126, 255, 82, 85, 212, 207, 206, 59, 227,
47, 16, 58, 17, 182, 189, 28, 42, 223, 183, 170, 213, 119, 248, 152, 2, 44,
154, 163, 70, 221, 153, 101, 155, 167, 43, 172, 9, 129, 22, 39, 253, 19, 98,
108, 110, 79, 113, 224, 232, 178, 185, 112, 104, 218, 246, 97, 228, 251, 34,
242, 193, 238, 210, 144, 12, 191, 179, 162, 241, 81, 51, 145, 235, 249, 14,
239, 107, 49, 192, 214, 31, 181, 199, 106, 157, 184, 84, 204, 176, 115, 121,
50, 45, 127, 4, 150, 254, 138, 236, 205, 93, 222, 114, 67, 29, 24, 72, 243,
141, 128, 195, 78, 66, 215, 61, 156, 180, 151, 160, 137, 91, 90, 15, 131,
13, 201, 95, 96, 53, 194, 233, 7, 225, 140, 36, 103, 30, 69, 142, 8, 99, 37,
240, 21, 10, 23, 190, 6, 148, 247, 120, 234, 75, 0, 26, 197, 62, 94, 252,
219, 203, 117, 35, 11, 32, 57, 177, 33, 88, 237, 149, 56, 87, 174, 20, 125,
136, 171, 168, 68, 175, 74, 165, 71, 134, 139, 48, 27, 166, 77, 146, 158,
231, 83, 111, 229, 122, 60, 211, 133, 230, 220, 105, 92, 41, 55, 46, 245,
40, 244, 102, 143, 54, 65, 25, 63, 161, 1, 216, 80, 73, 209, 76, 132, 187,
208, 89, 18, 169, 200, 196, 135, 130, 116, 188, 159, 86, 164, 100, 109, 198,
173, 186, 3, 64, 52, 217, 226, 250, 124, 123, 5, 202, 38, 147, 118, 126,
255, 82, 85, 212, 207, 206, 59, 227, 47, 16, 58, 17, 182, 189, 28, 42, 223,
183, 170, 213, 119, 248, 152, 2, 44, 154, 163, 70, 221, 153, 101, 155, 167,
43, 172, 9, 129, 22, 39, 253, 19, 98, 108, 110, 79, 113, 224, 232, 178, 185,
112, 104, 218, 246, 97, 228, 251, 34, 242, 193, 238, 210, 144, 12, 191, 179,
162, 241, 81, 51, 145, 235, 249, 14, 239, 107, 49, 192, 214, 31, 181, 199,
106, 157, 184, 84, 204, 176, 115, 121, 50, 45, 127, 4, 150, 254, 138, 236,
205, 93, 222, 114, 67, 29, 24, 72, 243, 141, 128, 195, 78, 66, 215, 61, 156,
180};

const unsigned char SIMPLEX[][4] = {
{0,1,2,3},{0,1,3,2},{0,0,0,0},{0,2,3,1},{0,0,0,0},{0,0,0,0},{0,0,0,0},
{1,2,3,0},{0,2,1,3},{0,0,0,0},{0,3,1,2},{0,3,2,1},{0,0,0,0},{0,0,0,0},
{0,0,0,0},{1,3,2,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},
{0,0,0,0},{0,0,0,0},{0,0,0,0},{1,2,0,3},{0,0,0,0},{1,3,0,2},{0,0,0,0},
{0,0,0,0},{0,0,0,0},{2,3,0,1},{2,3,1,0},{1,0,2,3},{1,0,3,2},{0,0,0,0},
{0,0,0,0},{0,0,0,0},{2,0,3,1},{0,0,0,0},{2,1,3,0},{0,0,0,0},{0,0,0,0},
{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{2,0,1,3},
{0,0,0,0},{0,0,0,0},{0,0,0,0},{3,0,1,2},{3,0,2,1},{0,0,0,0},{3,1,2,0},
{2,1,0,3},{0,0,0,0},{0,0,0,0},{0,0,0,0},{3,1,0,2},{0,0,0,0},{3,2,0,1},
{3,2,1,0}};

#define fastfloor(n) (int)(n) - (((n) < 0.0f) & ((n) != (int)(n)))

// Fast sine/cosine functions from
// http://devmaster.net/forums/topic/4648-fast-and-accurate-sinecosine/page__st__80
// Note the input to these functions is not radians
// instead x = [0, 2] for r = [0, 2*PI]

inline float fast_sin(float x)
{
// Convert the input value to a range of -1 to 1
// x = x * (1.0f / PI);

// Wrap around
volatile float z = (x + 25165824.0f);
x = x - (z - 25165824.0f);

#if LOW_SINE_PRECISION
return 4.0f * (x - x * fabsf(x));
#else
{
float y = x - x * fabsf(x);
const float Q = 3.1f;
const float P = 3.6f;
return y * (Q + P * fabsf(y));
}
#endif
}

inline float fast_cos(float x)
{
return fast_sin(x + 0.5f);
}
Loading

0 comments on commit fe9f4cd

Please sign in to comment.