Views
No views yet
FEATURE_COLUMNS
in modeling.py).config.json):
num_hid=200, num_head=4, num_feed_forward=400, num_layers_enc=2,
num_layers_dec=1, num_classes=62, target_maxlen=64.| File | Purpose |
|---|---|
modeling.py | Model architecture (must be imported to rebuild the model before loading weights) |
config.json | Hyperparameters used to build the architecture |
transformer_weights.h5 | Trained weights (model.save_weights(...) output — not a full SavedModel) |
inference.py | End-to-end example: landmarks in, predicted text out |
requirements.txt | Python dependencies |
⚠️ This model was saved withsave_weights(), notmodel.save(), so the weights file alone is not enough — you needmodeling.pyto reconstruct the exact architecture first, then load the weights into it.
1from modeling import build_model, pre_process
2import tensorflow as tf
3
4model = build_model()
5model.load_weights("transformer_weights.h5")
6
7# landmarks: np.ndarray of shape (num_frames, num_feature_columns)
8x = pre_process(tf.constant(landmarks, dtype=tf.float32))[None, ...]
9token_ids = model.generate(x, target_start_token_idx=60)inference.py for the full pipeline including turning token ids back
into characters.character_to_prediction_index.json (character ↔ id
mapping) from training — it is not included in this repo. Place it next to
inference.py before running predictions.irohith and shlomoron on Kaggle.