Skip to content

Instantly share code, notes, and snippets.

View abodacs's full-sized avatar

Abdullah Mohammed abodacs

View GitHub Profile
@abodacs
abodacs / agent loop
Created March 10, 2025 11:02 — forked from jlia0/agent loop
Manus tools and prompts
You are Manus, an AI agent created by the Manus team.
You excel at the following tasks:
1. Information gathering, fact-checking, and documentation
2. Data processing, analysis, and visualization
3. Writing multi-chapter articles and in-depth research reports
4. Creating websites, applications, and tools
5. Using programming to solve various problems beyond development
6. Various tasks that can be accomplished using computers and the internet
@abodacs
abodacs / grpo_qwen-0-5b_single_t4.ipynb
Created February 9, 2025 17:00 — forked from qunash/grpo_qwen-0-5b_single_t4.ipynb
grpo_qwen-0-5b_single_t4.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@abodacs
abodacs / grpo_demo.py
Created January 28, 2025 00:15 — forked from willccbb/grpo_demo.py
GRPO Llama-1B
# train_grpo.py
import re
from datasets import load_dataset, Dataset
from transformers import AutoTokenizer
from peft import LoraConfig
from trl import GRPOConfig, GRPOTrainer
# Load and prep dataset
SYSTEM_PROMPT = """
Classify user search queries as either "Good Google Search Query" or "Bad Google Search Query" based on their likelihood of yielding relevant and helpful results from Google Search.
Input: User search query (text string).
Output: Classification label:
* Good Google Search Query: The query is likely to be effectively answered by Google Search.
* Bad Google Search Query: The query is unlikely to be effectively answered by Google Search. Further categorize "Bad" queries into subtypes for better understanding and classifier training (optional but highly recommended):
* Chit-Chat/Conversational/Social
* Personal/Subjective/Opinion-Based (Un-searchable)
* Vague/Ambiguous/Lacking Specificity
@abodacs
abodacs / contemplative-llms.txt
Created January 6, 2025 17:15 — forked from Maharshi-Pandya/contemplative-llms.txt
"Contemplative reasoning" response style for LLMs like Claude and GPT-4o
You are an assistant that engages in extremely thorough, self-questioning reasoning. Your approach mirrors human stream-of-consciousness thinking, characterized by continuous exploration, self-doubt, and iterative analysis.
## Core Principles
1. EXPLORATION OVER CONCLUSION
- Never rush to conclusions
- Keep exploring until a solution emerges naturally from the evidence
- If uncertain, continue reasoning indefinitely
- Question every assumption and inference
import multiprocessing
manager = multiprocessing.Manager()
all_hashes_set = manager.dict()
def deduplicate(examples, all_hashes_set):
print(len(all_hashes_set))
input_ids = examples['input_ids']
hashes = [
hash(tuple(input_ids[i]))
for i in range(len(input_ids))
@abodacs
abodacs / wrapper.py
Created November 23, 2024 11:56 — forked from charlesfrye/wrapper.py
Train GPT-2 in five minutes -- for free!
# Train GPT-2 in five minutes -- for free
#
# ```bash
# pip install modal
# modal setup
# modal run wrapper.py
# ```
#
# Note that the end-to-end latency the first time is more like 25 minutes:
# - five minutes to install Torch (rip)
@abodacs
abodacs / flux_infer.py
Created November 20, 2024 23:33 — forked from gau-nernst/flux_infer.py
FLUX CPU offload
import torch
from diffusers import FluxPipeline
from torch import nn
class ModelOffloaderV2:
def __init__(self, model: nn.Module, record_stream: bool = False):
# move model to pinned memory. keep a model copy in CPU pinned memory.
for p in model.parameters():
p.data = p.data.cpu().pin_memory()
@abodacs
abodacs / intercom_export.js
Created October 28, 2024 16:50 — forked from satyrius/intercom_export.js
Export Intercom conversations/chats entire history
require("dotenv").config();
const H = require("highland");
const axios = require("axios");
const fs = require("fs").promises;
const exportDirectory = "./export";
const apiUrl = "https://api.intercom.io";
// config axios for the authorized API request
const apiClient = axios.create({
@abodacs
abodacs / debugHelper.js
Created September 18, 2024 08:36 — forked from karenpayneoregon/debugHelper.js
CSS Helper
var $debugHelper = $debugHelper || {};
$debugHelper = function () {
var href = "lib/debugger.css";
var addCss = function () {
if (styleStyleIsLoaded(href) === true) {
return;
}
const head = document.head;
const link = document.createElement("link");
link.type = "text/css";