Skip to content

Instantly share code, notes, and snippets.

View touhi99's full-sized avatar
🎧
Focusing

Touhidul Alam touhi99

🎧
Focusing
View GitHub Profile
@touhi99
touhi99 / get_memory_size.py
Created January 30, 2025 17:07 — forked from philschmid/get_memory_size.py
Get needed GPU per precision for a Hugging Face Model Id
from typing import Dict, Union
from huggingface_hub import get_safetensors_metadata
import argparse
import sys
# Example:
# python get_gpu_memory.py Qwen/Qwen2.5-7B-Instruct
# Dictionary mapping dtype strings to their byte sizes
bytes_per_dtype: Dict[str, float] = {
def feature_template(self, state, sentence):
feature_list = np.empty((0), int)
stack = state.stack
buffer = state.buffer
ld = state.ld
rd = state.rd
form = sentence.form
pos = sentence.pos
lemma = sentence.lemma
morph = sentence.morph
def train(self, train_data):
print("In trainer...")
u= np.zeros(self.weights.shape, dtype=np.int32)
q=0
for epoch in range(0,1):
correct=0
print("epoch: ",epoch+1)
i=0
for data in train_data:
q += 1
def generate_tree(self, node):
#print(node)
if isinstance(self.find(self.copy_table, node)[1], (list,)):
item = self.find(self.copy_table, node)[1]
item_x = self.find(self.copy_table, node)[2]
item_y = self.find(self.copy_table, node)[3]
self.copy_table.remove(node)
if item_x[0]==0:
x=self.copy_table_reversed[item_x[1]]
#prod -> right-hand side one element
nt -> left-hand side non-terminal
count -> true, if prod is in left
def create_prod_combinations(prod, nt, count):
numset = 1 << count
new_prods = []
for i in range(numset):
nth_nt = 0