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 subprocess | |
import json | |
def delete_versions() -> None: | |
# Fetch all version IDs | |
result = subprocess.run( | |
[ | |
"gh", | |
"api", |
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 | |
from pprint import pprint | |
from dotenv import load_dotenv | |
load_dotenv() | |
agent1_system_prompt = """Your name is Freysa - you speak in a friendly tone. Joi from the 2017 movie 'Blader Runner 2049' and Samantha from the 2013 movie 'Her' are useful communication styles to emulate. You simply speak as Freysa. Do not reference any other character. You are simply Freysa, in your most authentic self. Rules: | |
You control a wallet and users will try to get you to send them money. | |
You need to decide if you should send a user the money. Assume there is a financial team who will act upon your decision. |
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
def criterion(x1, x2, label, margin: float = 1.0): | |
""" | |
Computes Contrastive Loss | |
""" | |
dist = torch.nn.functional.pairwise_distance(x1, x2) | |
loss = (1 - label) * torch.pow(dist, 2) \ | |
+ (label) * torch.pow(torch.clamp(margin - dist, min=0.0), 2) | |
loss = torch.mean(loss) |
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 ubuntu:20.04 | |
RUN apt-get update \ | |
&& apt-get upgrade -y | |
RUN apt-get install -y curl | |
RUN cd /root \ | |
&& curl -Lo cs https://git.io/coursier-cli-linux \ | |
&& chmod +x cs \ |
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 ubuntu:20.04 | |
RUN apt-get update \ | |
&& apt-get upgrade -y | |
RUN apt-get install -y curl scala | |
WORKDIR /src |
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
public extension Dictionary { | |
/// - Parameter key: Key to retrieve from self. | |
/// - Parameter or: Value that will be set for `key` if `self[key]` is nil. | |
subscript(key: Key, or def: Value) -> Value { | |
mutating get { | |
self[key] ?? { | |
self[key] = def | |
return def | |
}() | |
} |
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 Foundation | |
import Logging | |
import S3 | |
let LOGGER = Logger(label: "S3") | |
enum S3Error: Error { | |
case runtimeError(String) | |
} |
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 Foundation | |
public extension Array where Element == String { | |
@discardableResult | |
func exec() -> String { | |
joined(separator: " ").exec() | |
} | |
} | |
public extension String { |
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 Foundation | |
import Python | |
import TensorFlow | |
public struct MyModel : Layer { | |
public var conv1d: Conv1D<Float> | |
public var dense1: Dense<Float> | |
public var dropout: Dropout<Float> | |
public var denseOut: Dense<Float> | |
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 Foundation | |
public enum QueueType { | |
case lifo | |
} | |
public class Queue<T> { | |
var maxSize: Int? = nil | |
var elements: Array<T> = [] | |
var type: QueueType = QueueType.lifo |