Skip to content

Instantly share code, notes, and snippets.

View saadullahaleem's full-sized avatar

Saad Aleem saadullahaleem

View GitHub Profile
@saadullahaleem
saadullahaleem / finetuning_config.py
Created March 22, 2023 18:07
Finetuning configuration
import openai
openai.api_key = "your-api-key"
model_engine = "text-davinci-002"
n_epochs = 3
batch_size = 4
learning_rate = 1e-5
max_tokens = 1024
@saadullahaleem
saadullahaleem / binarytree.py
Last active May 17, 2022 18:07
A Binary Tree in Python
class BinaryTree:
def __init__(self, root):
self.root = root
self.parent = None
self.left_node = None
self.right_node = None
def add_node(self, value):
if type(value) is not BinaryTree:
raise ValueError("Node must be of instance BinaryTree")
a = list()
b = set()
c = "some value"
print(c in a) # O(n)
print(c in b) # O(1)
class Employee(models.Model):
bio_short = models.CharField(max_length=256)
bio_long = models.TextField()
work_experience = JSONSchemaField(
schema='schemas/jsonschema.example.json', default=dict, blank=True)
{
"title" : "work experience",
"type" : "object",
"additionalProperties": false,
"properties":{
"data": {"type": "array",
"items": {
"properties" : {
"job_title": {"type": "string"},
"speciality": {"type": "string"},
import inspect
from jsonschema import (
validate,
exceptions as jsonschema_exceptions
)
from django.core import exceptions
from django.contrib.postgres.fields import JSONField