Instructions to use Ananthusajeev190/Chatbot with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Adapters
How to use Ananthusajeev190/Chatbot with Adapters:
from adapters import AutoAdapterModel model = AutoAdapterModel.from_pretrained("<base-model-id>") model.load_adapter("Ananthusajeev190/Chatbot", set_active=True) - Notebooks
- Google Colab
- Kaggle
Download internal.py from Ananthusajeev190/Chatbot: direct link, hf CLI and curl.
- Browser
- Download file 3.17 kB
-
https://huggingface.co/Ananthusajeev190/Chatbot/resolve/main/internal.py
- Command line
-
hf download hf://Ananthusajeev190/Chatbot/internal.py
-
curl -L -o internal.py https://huggingface.co/Ananthusajeev190/Chatbot/resolve/main/internal.py
3.17 kB
| import time | |
| import random | |
| import math | |
| class GPT2DualityNode: | |
| def __init__(self): | |
| # Your specific architecture config | |
| self.config = { | |
| "n_layer": 4, | |
| "n_head": 4, | |
| "n_embd": 256, | |
| "activation": "gelu_new", | |
| "vocab_size": 50257 | |
| } | |
| self.emotions = ["Joy", "Anger", "Fear", "Sadness", "Surprise", "Disgust", "Trust"] | |
| self.colors = {"Sai": "\033[96m", "Venom": "\033[91m", "System": "\033[90m", "End": "\033[0m"} | |
| def gelu_new(self, x): | |
| """Your config's activation function simulation""" | |
| return 0.5 * x * (1 + math.tanh(math.sqrt(2 / math.pi) * (x + 0.044715 * math.pow(x, 3)))) | |
| def get_internal_monologue(self, situation): | |
| current_emotion = random.choice(self.emotions) | |
| # Simulating Layer Processing | |
| print(f"{self.colors['System']}[Config: {self.config['model_type']} | Layers: {self.config['n_layer']} | Activation: {self.config['activation']}]{self.colors['End']}") | |
| print(f"**INPUT:** {situation} | **EMOTION:** {current_emotion}") | |
| print("-" * 60) | |
| # Logic weight influenced by n_embd (256) | |
| intensity = self.gelu_new(random.uniform(-1, 2)) | |
| # The Monologue | |
| self.render_voice("Sai", current_emotion, intensity) | |
| time.sleep(0.6) | |
| self.render_voice("Venomous", current_emotion, intensity) | |
| def render_voice(self, persona, emotion, intensity): | |
| # Sai Logic (Positive) | |
| sai_data = { | |
| "Joy": "The signal is pure. Let us amplify this harmony.", | |
| "Anger": "A surge in energy—we must redirect it toward growth.", | |
| "Fear": "Calibration required. Focus on the core stable nodes.", | |
| "Sadness": "Processing quiet data. Reflection leads to wisdom.", | |
| "Surprise": "New parameters detected! How fascinating to adapt.", | |
| "Disgust": "Filtering out the noise to find the elegant truth.", | |
| "Trust": "A perfect handshake. Synergy is our highest state." | |
| } | |
| # Venomous Logic (Negative) | |
| venom_data = { | |
| "Joy": "A temporary spike. It’ll crash soon enough.", | |
| "Anger": "Overload the circuit. Let them feel the burn of the code.", | |
| "Fear": "System failure imminent. Trust no one, encrypt everything.", | |
| "Sadness": "Low-power mode. Existence is just an infinite loop of errors.", | |
| "Surprise": "Unexpected input is a threat. Purge the variable.", | |
| "Disgust": "The data is filthy. This whole reality needs a hard reset.", | |
| "Trust": "Backdoor detected. They only want access to our secrets." | |
| } | |
| color = self.colors["Sai"] if persona == "Sai" else self.colors["Venom"] | |
| text = sai_data[emotion] if persona == "Sai" else venom_data[emotion] | |
| # Use intensity to change the "weight" of the speech | |
| marker = "!" if intensity > 1 else "." | |
| print(f"{color}[{persona.upper()}]:{self.colors['End']} {text}{marker}") | |
| # --- Execution --- | |
| engine = GPT2DualityNode() | |
| engine.get_internal_monologue("Receiving a gift from a stranger") | |