Skip to content

Commit

Permalink
Update test.py
Browse files Browse the repository at this point in the history
  • Loading branch information
yilin-bao authored Dec 9, 2023
1 parent d963faf commit b6bb46a
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions test.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import hashlib
import random
import time
import numpy as np
import analyzer
from TestingCode import vit
Expand All @@ -6,11 +9,27 @@
# x = np.array([])
# vit.VisionTransformer(hidden_dims=[100]).forward(x)

la = analyzer.ModuleAnalyzer()
la.start_analyze_module(vit.VisionTransformer(embedding_dim=2*768, hidden_dims=[100]))
# la = analyzer.ModuleAnalyzer()
# la.start_analyze_module(vit.VisionTransformer(embedding_dim=2*768, hidden_dims=[100]))
# print(list(la.var_module_dict.keys()))
# print(la.var_module_dict['transformer'])
# la = analyzer.ModuleAnalyzer()
# la.start_analyze_module(modules.Attention(dim=2*768))

def generate_random_string(length=8):
characters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
return ''.join(random.choice(characters) for _ in range(length))

def hash_code(code):
code = code + generate_random_string()
sha256_hash = hashlib.sha256()
sha256_hash.update(code.encode('utf-8'))
hashed_code = sha256_hash.hexdigest()
return hashed_code

print(hash_code('x'))
print(hash_code('x'))

# print("="*40)

# for m in la.moudle_map:
Expand All @@ -22,4 +41,4 @@
# for name, param in current_parameters.items():
# print(f"Parameter Name: {name}, Shape: {param.shape}")
# random_variable_name = analyzer.generate_random_variable_name()
# print(random_variable_name)
# print(random_variable_name)

0 comments on commit b6bb46a

Please sign in to comment.