Instructions to use psikosen/snow_spike with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use psikosen/snow_spike with MLX:
# Make sure mlx-lm is installed # pip install --upgrade mlx-lm # if on a CUDA device, also pip install mlx[cuda] # Generate text with mlx-lm from mlx_lm import load, generate model, tokenizer = load("psikosen/snow_spike") prompt = "Once upon a time in" text = generate(model, tokenizer, prompt=prompt, verbose=True) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- MLX LM
How to use psikosen/snow_spike with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Generate some text mlx_lm.generate --model "psikosen/snow_spike" --prompt "Once upon a time"
- Atomic Chat
File size: 5,787 Bytes
1e12712 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 | """
Example usage of the normalization module.
"""
from src.normalization import (
normalize_logic_check, normalize_cross_check, normalize_corroboration_signal,
min_max_scale, calculate_trust_delta, SignalTracker
)
from src.utils.common import CrossCheckType
import numpy as np
import matplotlib.pyplot as plt
def main():
print("Normalization Example")
print("--------------------")
# Logic check normalization
print("\nLogic Check Normalization:")
logic_values = [0, 1, True, False, "1", "0", "", []]
for value in logic_values:
try:
normalized = normalize_logic_check(value)
print(f" Raw: {value} ({type(value).__name__}) -> Normalized: {normalized}")
except ValueError as e:
print(f" Raw: {value} ({type(value).__name__}) -> Error: {e}")
# Cross-check normalization
print("\nCross-Check Normalization:")
# Cosine similarity examples
cos_sims = [-1.0, -0.5, 0.0, 0.5, 0.99]
print(" Cosine Similarity:")
for sim in cos_sims:
normalized = normalize_cross_check(sim, CrossCheckType.COSINE_SIMILARITY)
print(f" Raw: {sim} -> Normalized: {normalized}")
# General score examples
scores = [0, 50, 100, 150]
max_score = 100
print(f" General Score (max = {max_score}):")
for score in scores:
normalized = normalize_cross_check(score, CrossCheckType.GENERAL_SCORE, max_score)
print(f" Raw: {score} -> Normalized: {normalized}")
# Corroboration signal normalization
print("\nCorroboration Signal Normalization:")
corroborators = [0, 1, 2, 5, 10, 20, 50]
kappa_values = [0.1, 0.5, 1.0]
for kappa in kappa_values:
print(f" Kappa = {kappa}:")
for n in corroborators:
normalized = normalize_corroboration_signal(n, kappa)
print(f" Corroborators: {n} -> Normalized: {normalized:.4f}")
# Min-max scaling
print("\nMin-Max Scaling:")
values = [10, 20, 30, 40, 50]
min_val, max_val = min(values), max(values)
print(f" Range: [{min_val}, {max_val}]")
for value in values + [0, 60]: # Include values outside the range
scaled = min_max_scale(value, min_val, max_val)
print(f" Raw: {value} -> Scaled: {scaled}")
# Signal tracker
print("\nSignal Tracker:")
tracker = SignalTracker()
stream = np.random.normal(10, 5, 10) # 10 random values
print(" Updating with stream of values:")
for i, value in enumerate(stream):
tracker.update(value)
print(f" Update {i+1}: {value:.2f} -> Range: [{tracker.min_value:.2f}, {tracker.max_value:.2f}]")
print(" Normalizing values:")
test_values = [tracker.min_value, tracker.max_value, (tracker.min_value + tracker.max_value)/2]
for value in test_values:
normalized = tracker.get_normalized(value)
print(f" Raw: {value:.2f} -> Normalized: {normalized}")
# Trust delta calculation
print("\nTrust Delta Calculation:")
test_cases = [
{"L": 1.0, "C": 0.8, "R": 0.6, "α": 0.3, "β": 0.4, "γ": 0.3},
{"L": 0.0, "C": 0.5, "R": 1.0, "α": 0.2, "β": 0.3, "γ": 0.5},
{"L": 0.5, "C": 0.5, "R": 0.5, "α": 0.4, "β": 0.4, "γ": 0.2}
]
for i, case in enumerate(test_cases):
delta = calculate_trust_delta(
case["L"], case["C"], case["R"], case["α"], case["β"], case["γ"]
)
print(f" Case {i+1}: L={case['L']}, C={case['C']}, R={case['R']}")
print(f" α={case['α']}, β={case['β']}, γ={case['γ']}")
print(f" ΔT = {delta}")
# Verify the result
expected = case["L"]*case["α"] + case["C"]*case["β"] + case["R"]*case["γ"]
print(f" Expected: {expected} (matches: {delta == expected})")
# Visualize corroboration normalization
try:
plt.figure(figsize=(15, 5))
# Plot 1: Corroboration normalization for different kappa values
plt.subplot(1, 3, 1)
corr_range = np.linspace(0, 20, 100)
for kappa in kappa_values:
norm_values = [normalize_corroboration_signal(n, kappa) for n in corr_range]
plt.plot(corr_range, norm_values, label=f'κ = {kappa}')
plt.xlabel('Number of Corroborators')
plt.ylabel('Normalized Value')
plt.title('Corroboration Normalization')
plt.legend()
plt.grid(True)
# Plot 2: Cosine similarity normalization
plt.subplot(1, 3, 2)
sim_range = np.linspace(-1, 1, 100)
norm_values = [normalize_cross_check(s, CrossCheckType.COSINE_SIMILARITY) for s in sim_range]
plt.plot(sim_range, norm_values)
plt.xlabel('Cosine Similarity')
plt.ylabel('Normalized Value')
plt.title('Cosine Similarity Normalization')
plt.grid(True)
# Plot 3: Trust delta calculation with varying L
plt.subplot(1, 3, 3)
L_range = np.linspace(0, 1, 100)
C, R = 0.7, 0.5 # Fixed values for C and R
alpha, beta, gamma = 0.4, 0.3, 0.3 # Weights
delta_values = [calculate_trust_delta(L, C, R, alpha, beta, gamma) for L in L_range]
plt.plot(L_range, delta_values)
plt.xlabel('Logic Check Value (L)')
plt.ylabel('Trust Delta (ΔT)')
plt.title(f'Trust Delta with C={C}, R={R}\nα={alpha}, β={beta}, γ={gamma}')
plt.grid(True)
plt.tight_layout()
plt.savefig('normalization_example.png')
print("\nVisualization saved as 'normalization_example.png'")
except Exception as e:
print(f"\nCould not create visualization: {e}")
if __name__ == "__main__":
main()
|