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 boto3 | |
import pandas as pd | |
from datetime import datetime, timedelta | |
from typing import Optional | |
cloudwatch = boto3.client("cloudwatch") | |
ec2 = boto3.resource("ec2") | |
def ec2_get_instances(filter_name, filter_value): | |
return ec2.instances.filter(Filters=[{'Name': filter_name, |
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
Python 3.10.8 (main, Nov 24 2022, 08:08:27) [Clang 14.0.6 ] on darwin | |
Type "help", "copyright", "credits" or "license" for more information. | |
>>> import torch | |
>>> import whisper | |
>>> torch.__version__ | |
'2.0.0a0+git01de5dd' | |
>>> model = whisper.load_model("base") | |
>>> audio = whisper.load_audio("c1.mp3") # downloaded from https://www.mobydickbigread.com/chapter-1-loomings/ | |
>>> audio = whisper.pad_or_trim(audio) | |
>>> model.transcribe(audio)["text"] |
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
#!/usr/bin/env python3 | |
from collections import namedtuple | |
from typing import Tuple, List | |
GH_GET_REPO_ID = """ | |
query ($owner: String = "pytorch", $name: String = "pytorch") { | |
repository(name: $name, owner: $owner) { | |
id |
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
#!/usr/bin/env python3 | |
MPS_PROJECT_NUMBER = 26 | |
GH_GET_PROJECT_ID = """ | |
query ($owner: String = "pytorch", $name: String = "pytorch", $number: Int = 26) { | |
repository(name: $name, owner: $owner) { | |
projectV2(number: $number) { | |
id | |
} |
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
# Very restricted unpickler | |
# Based of https://github.com/python/cpython/blob/main/Lib/pickle.py | |
# Expected to be useful for loading PyTorch model weights | |
# For example: | |
# data = urllib.request.urlopen('https://download.pytorch.org/models/resnet50-0676ba61.pth').read() | |
# buf = io.BytesIO(data) | |
# weights = torch.load(buf, pickle_module=WeightsUnpickler) | |
import sys | |
from sys import maxsize |
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
#!/usr/bin/env python3 | |
GH_GET_VIEWER_LOGIN = """ | |
query { | |
viewer { | |
login | |
} | |
} | |
""" |
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
// Compile me as | |
// clang++ query_metal_devices.mm -framework Metal -framework Foundation | |
#include <Metal/Metal.h> | |
int main() { | |
@autoreleasepool { | |
NSArray* devices = [MTLCopyAllDevices() autorelease]; | |
NSLog(@"Metal device count %lu", devices.count); | |
for (unsigned long i = 0 ; i < devices.count ; i++) { | |
id<MTLDevice> device = devices[i]; |
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
#!/usr/bin/env python3 | |
# Trying to use graphQL to fetch all commits associated with PR https://github.com/pytorch/pytorch/pull/77471 | |
# Expect to get 700+ commits for for some reason pagination ends after first 250 | |
# Needs valid PAT passed via GITHUB_TOKEN environment variable | |
GH_GET_COMMITS = """ | |
query($cursor: String) { | |
repository(owner: "pytorch", name: "pytorch") { | |
pullRequest(number: 77471) { | |
commits(first: 100, after: $cursor) { |
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
{ | |
repository(name: "pytorch", owner: "pytorch") { | |
object(oid: "7dd08230117f4fa8bb82b3524e90fb00340198c7") { | |
... on Commit { | |
checkSuites(first: 100, filterBy: {appId: 15368}) { | |
nodes { | |
workflowRun { | |
workflow { | |
name | |
} |
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
query { | |
repository(owner: "pytorch", name: "pytorch") { | |
pullRequest(number: 68111) { | |
closed | |
isCrossRepository | |
author { | |
login | |
} | |
title | |
body |