Skip to content

Instantly share code, notes, and snippets.

@kks32
kks32 / FLOPs.ipynb
Created April 28, 2024 17:06
Compute FLOPS in ML
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kks32
kks32 / GeoDef.py
Last active April 8, 2024 20:22
Spherical Linear Parametrization
# "GeoDef" (Geometric Vector Perceptron) proposed by Sitzmann et al. (2020) in their paper
# "Implicit Geometric Regularization for Learning Shapes." The key idea is to represent the
# linear layer as a geometric transformation rather than a traditional matrix multiplication.
class GeoDef(nn.Module):
def __init__(self, in_features, out_features):
super(GeoDef, self).__init__()
self.in_features = in_features
self.out_features = out_features
self.direction_vectors = nn.Parameter(torch.empty(out_features, in_features))
self.translation_vectors = nn.Parameter(torch.empty(out_features))
@kks32
kks32 / qa_clean.jsonl
Last active January 9, 2024 04:16
TAPIS Fine tuning LLM
{"prompt": "What is Abaco?", "completion": "Abaco is an NSF-funded web service and distributed computing platform providing functions-as-a-service (FaaS) to the research computing community. It implements functions using the Actor Model of concurrent computation. Each actor in Abaco is associated with a Docker image, and actor containers are executed in response to messages posted to their inbox. Abaco offers three primary higher-level capabilities: Reactors for event-driven programming, Asynchronous Executors for scaling out function calls within running applications, and Data Adapters for creating microservices from disparate sources of data."}
{"prompt": "How do I get started with Abaco?", "completion": "To get started with Abaco, you need to set up the necessary accounts and install the required software. This includes creating a TACC account and a Docker account. You will also need to install the Tapis Python SDK. Once these steps are completed, you can move on to the Abaco Quickstart, where you will cre
@kks32
kks32 / uscs-incorrect.py
Created March 30, 2023 16:06
GPT-3.5 USCS Soil Classification
# Prompt: Write a python code for USCS soil classification
#
# Output:
# USCS Soil Classification
# Based on ASTM D2487-17 Standard Practice for Classification of Soils for Engineering Purposes
# Enter soil properties
percent_gravel = float(input("Enter percent gravel: "))
percent_sand = float(input("Enter percent sand: "))
percent_fines = float(input("Enter percent fines (silt + clay): "))
@kks32
kks32 / kill-idle.sh
Last active September 25, 2020 21:19
kill idle process
#!/bin/bash
# Name of process
process=standard
# Sleep time in seconds (interval to check)
sleepinterval=2
# Threshold cpu use in %
cputhreshold=6.0
# Max trials
maxtrials=3
# Sleep for 60s before the first check for process is active or not
// local ->globe
cell->get_dof_indices(T_local_dof_indices);
for (unsigned int i = 0; i < T_dofs_per_cell; ++i) {
for (unsigned int j = 0; j < T_dofs_per_cell; ++j) {
auto local_i = T_local_dof_indices[i];
auto local_j = T_local_dof_indices[j];
T_mass_matrix.add(local_i, local_j, T_local_mass_matrix(i, j));
T_stiffness_matrix.add(local_i, local_j,
T_local_stiffness_matrix(i, j));
}
@kks32
kks32 / mpm-speed-up.md
Last active November 19, 2018 14:09
CB-Geo MPM code

Plate with hole

32 - 35.730940779 +/- 0.22% 16 - 45.890542910 +/- 0.62% 8 - 70.222314796 +/- 1.24% 4 - 110.781838974 +/- 1.36% 2 - 138.182933579 +/- 3.05% 1 - 80.16 +/- 2.73%

Plate with hole (Singularity TBB)

import random
#welcoming the user
name = raw_input("What is your name? ")
print "Hello, " + name, "Time to play hangman!"
print "Start guessing..."
#generates random word
@kks32
kks32 / snake-template.py
Last active June 30, 2018 08:21
Snake template for micropython
import microbit
import random
class SnakeBit():
# Define directions
UP = 0
DOWN = 1
RIGHT = 2
LEFT = 3
# Add snake brightness
@kks32
kks32 / reverse.py
Created June 16, 2018 07:59
Python reverse
def reverse(data_list):
length = len(data_list)
s = length
new_list = [None]*length
for item in data_list:
s = s - 1
new_list[s] = item
return new_list