Skip to content

Instantly share code, notes, and snippets.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@abgoswam
abgoswam / pyclient_linux_dotnet_namedpipe.py
Created July 13, 2017 02:10
Python Client on Linux Using a .NET Core Named Pipe (via unix domain sockets)
# -*- coding: utf-8 -*-
"""
Created on Wed Jul 12 19:06:38 2017
@author: agoswami
"""
#socket_echo_client_uds.py
import socket
import sys
@abgoswam
abgoswam / csharpserver_dotnet_namedpipe.cs
Created July 13, 2017 02:13
C# Server using .NET Core Named Pipes
using System;
using System.IO;
using System.IO.Pipes;
using System.Text;
class PipeServerBinary
{
static void Main()
{
using (NamedPipeServerStream pipe = new NamedPipeServerStream("testpipe"))
# -*- coding: utf-8 -*-
"""
Created on Mon Jul 17 13:13:26 2017
@author: agoswami
"""
class Car(object):
@staticmethod
def factory(type):
# Our application logic will be added here
def cnn_model_fn(features, labels, mode):
"""Model function for CNN."""
# Input Layer
input_layer = tf.reshape(features["x"], [-1, 32, 32, 3], name="input_tensor")
# Convolutional Layer #1
conv1 = tf.layers.conv2d(
inputs=input_layer,
filters=32,
def get_batch(x, y, batch_size):
# print("x shape : {0}".format(x.shape))
# print("y shape : {0}".format(y.shape))
n_samples = x.shape[0]
indices = np.random.choice(n_samples, batch_size)
return x[indices], y[indices], indices
# clear old variables
tf.reset_default_graph()
X = tf.placeholder(tf.float32, [None, 32, 32, 3], name="Input")
import * as ort from 'onnxruntime-node';
// use an async context to call onnxruntime functions.
async function main() {
ort.InferenceSession
const session = await ort.InferenceSession.create('./model4.onnx');
// prepare feeds. use model input names as keys.
const feeds = {
import * as ort from 'onnxruntime-web';
// use an async context to call onnxruntime functions.
async function main() {
ort.InferenceSession
const session = await ort.InferenceSession.create('./model4.onnx', {
executionProviders: ["wasm"],
});
@abgoswam
abgoswam / eval_passkey.py
Created September 26, 2024 21:41
Passkey trials on Llama3.1
# Different kinds of HF quantization summarized here
# https://github.com/huggingface/transformers/blob/main/docs/source/en/kv_cache.md
# replace lines 68-76 accordingly
from numpy import random
import argparse
import re
import json
import os
# import deepspeed
@abgoswam
abgoswam / ws_acr_connection.py
Created January 7, 2025 00:27
AML WS Connection to ACR
import os
from azure.ai.ml import MLClient
from azure.ai.ml.entities import WorkspaceConnection
from azure.identity import DefaultAzureCredential
from azure.ai.ml.entities import UsernamePasswordConfiguration
# Enter details of your AML workspace
subscription_id = ""
resource_group = ""
workspace_name = ""