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
# Lifted verbatim from https://pytorch.org/tutorials/beginner/knowledge_distillation_tutorial.html | |
# Only for illustrating the distillation training loop as a code fragment. | |
for epoch in range(epochs): | |
running_loss = 0.0 | |
for inputs, labels in train_loader: | |
inputs, labels = inputs.to(device), labels.to(device) | |
optimizer.zero_grad() |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
# Dataset utils and dataloaders | |
import glob | |
import logging | |
import math | |
import os | |
import random | |
import shutil | |
import time | |
from itertools import repeat |
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
#!/usr/bin/env python3 | |
import logging | |
import os | |
from furiosa import runtime | |
from furiosa.runtime import session | |
import numpy as np | |
LOGLEVEL = os.environ.get('FURIOSA_LOG_LEVEL', 'INFO').upper() | |
logging.basicConfig(level=LOGLEVEL) |
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
#!/usr/bin/env python3 | |
""" | |
Calibration data/images is from the data folder | |
from https://github.com/derronqi/yolov7-face | |
""" | |
import sys | |
import onnx | |
import torch |
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
""" | |
The model is from https://github.com/derronqi/yolov7-face | |
Here, we download yolov7s-face.pt and convert it. | |
Output is model.onnx | |
""" | |
import torch | |
from models.experimental import attempt_load | |
from pudb import set_trace | |
from utils.torch_utils import select_device | |
batch_size = 1 |
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 logging | |
import os | |
from furiosa import runtime | |
from furiosa.runtime import session | |
import numpy as np | |
LOGLEVEL = os.environ.get('FURIOSA_LOG_LEVEL', 'INFO').upper() | |
logging.basicConfig(level=LOGLEVEL) | |
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
#!/usr/bin/env python3 | |
import logging | |
import os | |
from furiosa import runtime | |
from furiosa.runtime import session | |
import numpy as np | |
LOGLEVEL = os.environ.get('FURIOSA_LOG_LEVEL', 'INFO').upper() | |
logging.basicConfig(level=LOGLEVEL) |
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 openai | |
import argparse | |
MODEL = "gpt-3.5-turbo" # the chatGPT model | |
system_role_dict = {"role": "system", "content": "You are a helpful assistant."} | |
alternating_user_assistant_role = [] | |
messages = [system_role_dict] | |
quit_words = ["--quit", "--bye", "--exit"] | |
def create_context_as_dict(response): |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
NewerOlder