Instructions to use JTSJohnny/pipi0 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Keras
How to use JTSJohnny/pipi0 with Keras:
# !pip install -U keras tensorflow huggingface_hub # Keras needs TensorFlow installed to read "hf://" paths, so the tensorflow backend is selected here; # "jax" and "torch" also work for computation once TensorFlow is installed. import os os.environ["KERAS_BACKEND"] = "tensorflow" import keras model = keras.saving.load_model("hf://JTSJohnny/pipi0") - Notebooks
- Google Colab
- Kaggle
Download tokenizer.py from JTSJohnny/pipi0: direct link, hf CLI and curl.
- Browser
- Download file 654 Bytes
-
https://huggingface.co/JTSJohnny/pipi0/resolve/main/tokenizer.py
- Command line
-
hf download hf://JTSJohnny/pipi0/tokenizer.py
-
curl -L -o tokenizer.py https://huggingface.co/JTSJohnny/pipi0/resolve/main/tokenizer.py
654 Bytes
| from tokenizers import Tokenizer | |
| from tokenizers.models import WordPiece | |
| from tokenizers.pre_tokenizers import Whitespace | |
| from tokenizers.trainers import WordPieceTrainer | |
| def train_tokenizer(files, vocab_size=50000): | |
| tokenizer = Tokenizer(WordPiece(unk_token=":OOV:")) | |
| tokenizer.pre_tokenizer = Whitespace() | |
| trainer = WordPieceTrainer( | |
| vocab_size=vocab_size, | |
| special_tokens=[":OOV:"], | |
| continuing_subword_prefix="##", | |
| ) | |
| tokenizer.train(files, trainer) | |
| return tokenizer | |
| def save_tokenizer(tokenizer, path): | |
| tokenizer.save(path) | |
| def load_tokenizer(path): | |
| return Tokenizer.from_file(path) | |