Skip to content

Instantly share code, notes, and snippets.

View ruvnet's full-sized avatar
💭
hacking the multiverse.

rUv ruvnet

💭
hacking the multiverse.
View GitHub Profile
@ruvnet
ruvnet / MoE.py
Last active November 7, 2025 13:17
A PyTorch implementation of a Mixture of Experts (MoE) model resembling the Mixtral 8x7B architecture, with detailed inline comments. This model combines transformer layers with an MoE layer consisting of 8 experts, aiming for high efficiency by activating only 2 experts per token. It's configured with dimensions reflecting the operational effic…
"""
This model integrates the MoE concept within a Transformer architecture. Each token's
representation is processed by a subset of experts, determined by the gating mechanism.
This architecture allows for efficient and specialized handling of different aspects of the
data, aiming for the adaptability and efficiency noted in the Mixtral 8x7B model's design
philosophy. The model activates only a fraction of the available experts for each token,
significantly reducing the computational resources needed compared to activating all experts
for all tokens.
"""
@ruvnet
ruvnet / main.py
Created December 10, 2023 05:12
A ChatGPT code interpreter implementation of a mixture of experts model
# Redefining the MoELayer with a corrected forward method
class MoELayer(nn.Module):
def __init__(self, input_dim, hidden_dim, output_dim, num_experts):
super(MoELayer, self).__init__()
self.experts = nn.ModuleList([Expert(input_dim, hidden_dim, output_dim) for _ in range(num_experts)])
self.gate = GatingNetwork(input_dim, num_experts)
def forward(self, x):
gating_scores = self.gate(x) # Shape: [batch_size, num_tokens, num_experts]
expert_outputs = torch.stack([expert(x) for expert in self.experts], dim=1) # Shape: [batch_size, num_experts, num_tokens, output_dim]
@ruvnet
ruvnet / ms-graph.json
Created December 11, 2023 18:22
Microsoft Graph openapi.json for OpenAi GPT
{
"openapi": "3.0.0",
"info": {
"title": "Microsoft Graph API Example",
"version": "1.0"
},
"servers": [
{
"url": "https://graph.microsoft.com/v1.0"
}
@ruvnet
ruvnet / main.py
Last active December 11, 2023 18:45
Verifiy Microsoft Oauth Publisher Domain (python)
# Import necessary objects and functions from the Flask module
from flask import Flask, jsonify, request
# Create an instance of the Flask class. This instance is the WSGI application.
app = Flask(__name__)
# Define a route to catch all requests (both root '/' and any other '<path:path>')
# This is useful for handling undefined routes or for general logging
@app.route('/', defaults={'path': ''})
@app.route('/<path:path>', methods=['GET', 'OPTIONS'])
@ruvnet
ruvnet / synthetic-data-prompt.toml
Last active December 17, 2023 02:39
This ChatGPT prompt details synthetic time series data generation using ARIMA, emphasizing PII obfuscation. It includes stationarity checks, model fitting, forecasting, and evaluation, tailored for ChatGPT's computational limits. Outputs include CSV and JSON formats.
[Engine Template]
Author = "Prompt Engine User"
name = "SyntheticDataCreation"
forked_from = "Prompt Engine Template Creator"
version = "1.0"
[SyntheticDataCreation]
description = "This GPT outlines the creation and obfuscation of synthetic time series data using the ARIMA model. It includes data preparation with PII obfuscation, stationarity checking, model fitting, forecasting, evaluating model performance, and error handling. It can also help you make predictions for any single value time-series basis."
# Initial Prompt
@ruvnet
ruvnet / customer-service.toml
Created December 17, 2023 19:40
Car Dealership Specific Prompt Engine with defined system limitations
[prompt]
Author = "YourName"
name = "Car Dealership Specific Prompt Engine"
forked_from = "ruvnet"
version = "1.0"
# initial prompt
init = "Welcome to the Car Dealership Prompt Engine. This system is tailored to assist you with vehicle-related inquiries and services."
# personalization settings
@ruvnet
ruvnet / *specification.md
Last active June 13, 2026 07:30
TikTok-like recommender Algorithm

Detailed Technical Algorithm for a TikTok-like Recommendation System


1. Introduction

The objective is to develop a recommendation system that maximizes user engagement by analyzing a multitude of user interaction signals to present the most appealing content. The system optimizes for two key metrics:

  • User Retention: Encouraging users to return to the platform.
  • Time Spent: Increasing the duration users spend on the platform per session.
@ruvnet
ruvnet / Readme.md
Last active August 21, 2025 01:20
Dual-Version Code Generator. This tool creates two versions of a function: a standard implementation and an AI-optimized version

README.md - Dual-Version Function Generator

Introduction

Welcome to the Dual-Version Function Generator, a specialized prompt designed for ChatGPT's GPT system. This tool is crafted to empower users, especially developers and programming enthusiasts, to generate two distinct versions of a function based on their input. It's an innovative approach to visualizing and understanding different coding methodologies within the GPT framework.

About the Prompt

The Dual-Version Function Generator serves as a versatile tool within the ChatGPT environment. It creates:

@ruvnet
ruvnet / funko.toml
Created December 20, 2023 03:59
Funko Pop Figure Creator Prompt
# Funko Pop Figure Prompt Creator Template
Author = "rUv"
name = "Funko Pop Figure Prompt Creator"
forked_from = "ruvnet"
version = "1.0"
[prompt]
init = "Welcome to the Funko Pop Figure Prompt Creator! Let's design your custom Funko Pop figure."
[prompt.features.figure_details]
@ruvnet
ruvnet / strawman-lang.py
Created December 23, 2023 04:33
Invented Spoken Language API Service using OpenAI's Python Library
# Version 4 of your Python code, which includes a placeholder for language evolution logic, has been saved. You can access and download it here: [language_api_v4.py](sandbox:/mnt/data/language_api_v4.py?_chatgptios_conversationID=18a57da9-34e4-406c-a031-b3b5045b3240&_chatgptios_messageID=1bc59fd6-1668-49f2-9703-38003e5f3f39).
# The version notes have been updated to reflect this latest addition and can be viewed here: [version_notes.md](sandbox:/mnt/data/version_notes.md?_chatgptios_conversationID=18a57da9-34e4-406c-a031-b3b5045b3240&_chatgptios_messageID=1bc59fd6-1668-49f2-9703-38003e5f3f39).
# This concludes the creation of all functional groups based on the initial requirements. Each version has progressively built upon the last, adding placeholders and logic where applicable.
# The complete and combined code from all versions, integrating all functional elements, is as follows:
"""
Language API Service using OpenAI's Python Library
Purpose:
- To facilitate the creation, translation, and evolution of a n