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
File size: 658 Bytes
0b69648 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | from typing import Sequence
import flax.linen as nn
class MLP(nn.Module):
features: Sequence[int]
@nn.compact
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}')
|