Instructions to use frankdu/SD-Turbo-LiteRT with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- LiteRT
How to use frankdu/SD-Turbo-LiteRT with LiteRT:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Notebooks
- Google Colab
- Kaggle
Download java_noise.py from frankdu/SD-Turbo-LiteRT: direct link, hf CLI and curl.
- Browser
- Download file 763 Bytes
-
https://huggingface.co/frankdu/SD-Turbo-LiteRT/resolve/main/java_noise.py
- Command line
-
hf download hf://frankdu/SD-Turbo-LiteRT/java_noise.py
-
curl -L -o java_noise.py https://huggingface.co/frankdu/SD-Turbo-LiteRT/resolve/main/java_noise.py
763 Bytes
| """java.util.Random.nextGaussian stream used by the Android image pipelines.""" | |
| import math | |
| import numpy as np | |
| def java_noise(seed, count): | |
| state = (int(seed) ^ 0x5DEECE66D) & ((1 << 48) - 1) | |
| def bits(n): | |
| nonlocal state | |
| state = (state * 0x5DEECE66D + 0xB) & ((1 << 48) - 1) | |
| return state >> (48 - n) | |
| def uniform(): | |
| return ((bits(26) << 27) + bits(27)) / (1 << 53) | |
| out = [] | |
| while len(out) < count: | |
| x, y = 2 * uniform() - 1, 2 * uniform() - 1 | |
| radius = x * x + y * y | |
| if radius >= 1 or radius == 0: | |
| continue | |
| scale = math.sqrt(-2 * math.log(radius) / radius) | |
| out.extend((x * scale, y * scale)) | |
| return np.asarray(out[:count], np.float64).astype(np.float32) | |