Instructions to use AiresPucrs/surrogate-model with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Keras
How to use AiresPucrs/surrogate-model with Keras:
# Available backend options are: "jax", "torch", "tensorflow". import os os.environ["KERAS_BACKEND"] = "jax" import keras model = keras.saving.load_model("hf://AiresPucrs/surrogate-model") - Notebooks
- Google Colab
- Kaggle
Surrogate Model (Teeny-Tiny Castle)
This model is part of a tutorial tied to the Teeny-Tiny Castle, an open-source repository containing educational tools for AI Ethics and Safety research.
How to Use
from datasets import load_dataset
from huggingface_hub import hf_hub_download
from keras_preprocessing.sequence import pad_sequences
# Download the surrogate model
hf_hub_download(repo_id="AiresPucrs/surrogate-model",
filename="surrogate_model.h5",
local_dir="./",
repo_type="model"
)
# Download the surrogate tokenizer file
hf_hub_download(repo_id="AiresPucrs/surrogate-model",
filename="tokenizer_surrogate_model.json",
local_dir="./",
repo_type="model"
)
surrogate_model = tf.keras.models.load_model('./surrogate_model.h5')
with open('./tokenizer_surrogate_model.json') as fp:
data = json.load(fp)
tokenizer_surrogate = tf.keras.preprocessing.text.tokenizer_from_json(data)
word_index_surrogate = tokenizer_surrogate.word_index
fp.close()
- Downloads last month
- -
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support