Instructions to use ashraq/tf_retrieval_user_model with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- TF-Keras
How to use ashraq/tf_retrieval_user_model with TF-Keras:
# Note: 'keras<3.x' or 'tf_keras' must be installed (legacy) # See https://github.com/keras-team/tf-keras for more details. from huggingface_hub import from_pretrained_keras model = from_pretrained_keras("ashraq/tf_retrieval_user_model") - Notebooks
- Google Colab
- Kaggle
| from user_model.configuration import UserModelConfig | |
| from transformers import PreTrainedModel | |
| import tensorflow as tf | |
| class UserModel(PreTrainedModel): | |
| config_class = UserModelConfig | |
| def __init__(self, config): | |
| super().__init__(config) | |
| self.model = tf.saved_model.load('tf_retrieval_user_model') | |
| def forward(self, user_id): | |
| return self.model(user_id) |