Instructions to use programmersd/movie_nerd with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Keras
How to use programmersd/movie_nerd 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://programmersd/movie_nerd") - Notebooks
- Google Colab
- Kaggle
Download extract_tokenizer.py from programmersd/movie_nerd: direct link, hf CLI and curl.
- Browser
- Download file 904 Bytes
-
https://huggingface.co/programmersd/movie_nerd/resolve/main/extract_tokenizer.py
- Command line
-
hf download hf://programmersd/movie_nerd/extract_tokenizer.py
-
curl -L -o extract_tokenizer.py https://huggingface.co/programmersd/movie_nerd/resolve/main/extract_tokenizer.py
904 Bytes
| import pickle | |
| import json | |
| import sys | |
| import string | |
| class SimpleTokenizer: | |
| def __init__(self, vocab=None): | |
| self.vocab = vocab or {} | |
| def is_clean_token(t): | |
| return isinstance(t, str) and t.isprintable() and not any(c in t for c in "\u0000\uFFFD") | |
| try: | |
| with open("tokenizer.pkl", "rb") as f: | |
| tokenizer_obj = pickle.load(f) | |
| vocab = tokenizer_obj.vocab if hasattr(tokenizer_obj, "vocab") else tokenizer_obj | |
| clean_vocab = { | |
| k: v for k, v in vocab.items() | |
| if is_clean_token(k) | |
| } | |
| with open("tokenizer_vocab.json", "w", encoding="utf-8") as f: | |
| json.dump(clean_vocab, f, indent=2, ensure_ascii=True) | |
| print("✓ Clean vocab extracted") | |
| print(f"✓ Original size: {len(vocab)}") | |
| print(f"✓ Clean size: {len(clean_vocab)}") | |
| except Exception as e: | |
| print(f"✗ Error: {e}") | |
| sys.exit(1) | |