This file contains 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 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] | |
This file contains 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
# 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 |
This file contains 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 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 |