Instructions to use sharktide/QuakeNet with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Keras
How to use sharktide/QuakeNet with Keras:
# Available backend options are: "jax", "torch", "tensorflow". import os os.environ["KERAS_BACKEND"] = "jax" import keras model = keras.saving.load_model("hf://sharktide/QuakeNet") - Notebooks
- Google Colab
- Kaggle
| import tensorflow as tf | |
| from tensorflow.keras import layers, models | |
| from tensorflow.keras.saving import register_keras_serializable | |
| class StressAmplifier(tf.keras.layers.Layer): | |
| def __init__(self, **kwargs): | |
| super().__init__(**kwargs) | |
| def call(self, inputs): | |
| stress = inputs[:, 2] | |
| slip = inputs[:, 4] | |
| stress_boost = tf.sigmoid((stress - 400) * 0.01) | |
| slip_boost = tf.sigmoid((slip - 8) * 0.5) | |
| modulation = 1.0 + 0.4 * stress_boost * slip_boost | |
| return tf.expand_dims(modulation, axis=-1) | |
| class DepthSuppressor(tf.keras.layers.Layer): | |
| def __init__(self, **kwargs): | |
| super().__init__(**kwargs) | |
| def call(self, inputs): | |
| depth = inputs[:, 3] | |
| suppression = tf.sigmoid((depth - 25) * 0.15) | |
| modulation = 1.0 - 0.3 * suppression | |
| return tf.expand_dims(modulation, axis=-1) | |
| class DisplacementActivator(tf.keras.layers.Layer): | |
| def __init__(self, **kwargs): | |
| super().__init__(**kwargs) | |
| def call(self, inputs): | |
| displacement = inputs[:, 1] | |
| activation = tf.sigmoid((displacement - 30) * 0.08) | |
| modulation = 1.0 + 0.3 * activation | |
| return tf.expand_dims(modulation, axis=-1) | |
| class SoftScale(tf.keras.layers.Layer): | |
| def __init__(self, factor=0.25, **kwargs): | |
| super().__init__(**kwargs) | |
| self.factor = factor | |
| def call(self, inputs): | |
| return 1.0 + self.factor * tf.tanh(inputs - 1.0) | |
| CUSTOM_OBJECTS = { | |
| 'StressAmplifier': StressAmplifier, | |
| 'DepthSuppressor': DepthSuppressor, | |
| 'DisplacementActivator': DisplacementActivator, | |
| 'SoftScale': SoftScale | |
| } |