Skip to content

Instantly share code, notes, and snippets.

from dataformer.components.evol_instruct import EvolInstruct
from dataformer.llms import AsyncLLM
from datasets import load_dataset
# Take any sample dataset
dataset = load_dataset("dataformer/self-knowledge")
datasetsub = dataset["train"].select(range(2))
instructions = [example["question"] for example in datasetsub]
# PART 3 – an evaluation script to test the accuracy of the fine-tuned model vs the base model.
# We will use Dataformer for making API requests to Together AI. It respects rate-limits & supports cache - providing speed & saving money.
# pip install dataformer@git+https://github.com/DataformerAI/dataformer.git
import json
from dataformer.llms import AsyncLLM
from dotenv import load_dotenv
load_dotenv()
import os
import time
import os
import json
from modal import Image, Secret, Stub, method, web_endpoint, enter, gpu, exit, asgi_app
from fastapi import FastAPI, Request
from typing import Literal, Optional, List, Dict, Any, Union
import shortuuid
from pydantic import BaseModel, Field