Instructions to use flax-community/t5-vae-python with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use flax-community/t5-vae-python with Transformers:
# pip install -U transformers accelerate # Load model directly from transformers import T5VaeForAutoencoding model = T5VaeForAutoencoding.from_pretrained("flax-community/t5-vae-python", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Download model/utils.py from flax-community/t5-vae-python: direct link, hf CLI and curl.
- Browser
- Download file 658 Bytes
-
https://huggingface.co/flax-community/t5-vae-python/resolve/2a2a24e12e68b276f3a4cea4e967208172e2cbab/model/utils.py
- Command line
-
hf download hf://flax-community/t5-vae-python@2a2a24e12e68b276f3a4cea4e967208172e2cbab/model/utils.py
-
curl -L -o utils.py https://huggingface.co/flax-community/t5-vae-python/resolve/2a2a24e12e68b276f3a4cea4e967208172e2cbab/model/utils.py
658 Bytes
| from typing import Sequence | |
| import flax.linen as nn | |
| class MLP(nn.Module): | |
| features: Sequence[int] | |
| def __call__(self, x): | |
| for feat in self.features[:-1]: | |
| x = nn.relu(nn.Dense(feat)(x)) | |
| x = nn.Dense(self.features[-1])(x) | |
| return x | |
| def assertEqual(actual, expected, msg, first="Got", second="Expected"): | |
| if actual != expected: | |
| raise ValueError(msg + f' {first}: "{actual}" {second}: "{expected}"') | |
| def assertIn(actual, expected, msg, first="Got", second="Expected one of"): | |
| if actual not in expected: | |
| raise ValueError(msg + f' {first}: "{actual}" {second}: {expected}') | |