This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Importing necessary libraries for data preprocessing and visualization | |
| import matplotlib.pyplot as plt | |
| import numpy as np | |
| from tqdm.notebook import trange | |
| import pandas as pd | |
| import random | |
| import torch | |
| import re | |
| from datasets import load_dataset | |
| from simplet5 import SimpleT5 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| import logging | |
| import csv | |
| import argparse | |
| from tqdm import tqdm | |
| import sys | |
| from dotenv import load_dotenv | |
| import openai | |
| logging.basicConfig(level=logging.INFO, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def convert_alpaca_to_evol( | |
| file_path: str, | |
| lines: bool = False, | |
| output_file: str = "converted_alpaca.json" | |
| ): | |
| """Convert the Instruction/Input/Output format of Alpaca Instruct datasets | |
| to the Evol-Instruct format of Instruction/Output. Inputs are appended to the | |
| instructions. | |
| Args: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import json | |
| import random | |
| from openai_access import call_chatgpt | |
| from depth import createConstraintsPrompt, createDeepenPrompt, createConcretizingPrompt, createReasoningPrompt | |
| from breadth import createBreadthPrompt | |
| fr = open('alpaca_data.json','r') | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import re | |
| import json | |
| import uuid | |
| inputs = [json.loads(line) for line in open("instructions.jsonl").readlines()] | |
| def split_response(instruction, response): | |
| if '</s>' not in response: | |
| return [ | |
| { | |
| "from": "human", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import openai | |
| api_keys = ['api-key-1', 'api-key-2', 'api-key-3'] # Replace with your actual API keys | |
| num_prompts = 1000 | |
| prompts_per_request = 100 # Adjust based on your needs | |
| num_requests = 10 | |
| prompts = [] | |
| for i in range(num_requests): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from transformers import AutoTokenizer, BitsAndBytesConfig, AutoModelForSeq2SeqLM | |
| model_id = "google/flan-t5-xxl" | |
| quantization_config = BitsAndBytesConfig( | |
| load_in_4bit=True, | |
| bnb_4bit_use_double_quant=False | |
| ) | |
| model = AutoModelForSeq2SeqLM.from_pretrained(model_id, quantization_config=quantization_config) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| curl -X "POST" "https://www.promptsapper.tech:8003/sapperpro/Explore" \ | |
| -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:120.0) Gecko/20100101 Firefox/120.0' \ | |
| -H 'Accept: */*' \ | |
| -H 'Accept-Language: en-US,en;q=0.5' \ | |
| -H 'Accept-Encoding: gzip, deflate, br' \ | |
| -H 'Referer: https://www.promptsapper.tech/' \ | |
| -H 'Origin: https://www.promptsapper.tech' \ | |
| -H 'Dnt: 1' \ | |
| -H 'Connection: keep-alive' \ | |
| -H 'Sec-Fetch-Dest: empty' \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import aiohttp | |
| import argparse | |
| import asyncio | |
| import backoff | |
| import copy | |
| import datetime | |
| import faiss | |
| import os | |
| import json | |
| import math |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import gr | |
| def smart_contract_prompt_builder( | |
| contract_type, | |
| state_variables, | |
| functions, | |
| visibility, | |
| modifiers, | |
| features, | |
| access_control, |