aicps / hw2vec Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
https://github.com/rahvis/hw2vec
we have to create tests/ folder and add test cases back to guarantee code quality.
num_layers hyperparameter is not used in GCN model build.
try to implement a timing profiling framework for the unit tests. (use the functions implemented in utilities.py)
Hi,
My environment is an ubuntu virtual machine, and I have installed the pytorch cpu version.
I tried to run use_case_1.py, and changed line 105 of models.py.
torch.load(model_weight_path, map_location='cpu')
However, I get the error in the figure below:
Then I changed the key in the dictionary to make the names match, and ran it with the following error:
Then I used the reshape function to convert (37, 200) to (200,37).
The program can output the data, but the output data is different every time I run it.
Looking forward to your reply.
Benoit
Normalization should be on by default, and this can help reduce some code in DataProcessor
Utility functions in hw2graph.py etc should be moved to utilities.py for cleaner, easier imports
PreprocessVerilog should be merged with HW2GRAPH class
python -m pip install hw2vec
ERROR: Could not find a version that satisfies the requirement hw2vec (from versions: none)
I also checked this https://libraries.io/pypi/hw2vec/0.1.1 and it mentions that Repository is not available.
followed the sequence of commands given in readme.md
and after running the command python -m pip install hw2vec got this error
"ERROR: Could not find a version that satisfies the requirement hw2vec-contrib-python (from versions: none) ERROR: No matching distribution found for hw2vec-contrib-python"
align use_case_2 with the paper.
def train_epoch_tj(self, data):
output, _ = self.model.embed_graph(data.x, data.edge_index, data.batch)
output = self.model.mlp(output)
output = F.log_softmax(output, dim=1)
loss_train = self.loss_func(output, data.label)
return loss_train
def __init__(self, cfg, class_weights=None):
super().__init__(cfg)
self.task = "TJ"
if class_weights.shape[0] < 2:
self.loss_func = nn.CrossEntropyLoss()
else:
self.loss_func = nn.CrossEntropyLoss(weight=class_weights.float().to(cfg.device))
That means using double logsoftmax, which might introduce some negative effects.
Use the below url to install pygraphviz on Mac (tested and working).
https://ports.macports.org/port/py38-pygraphviz/
`(hw2vec) rahulvishwakarma@Rahuls-Air examples % python
Python 3.6.15 | packaged by conda-forge | (default, Dec 3 2021, 18:49:43)
[GCC Clang 11.1.0] on darwin
Type "help", "copyright", "credits" or "license" for more information.
import pygraphviz as pgv
G = pgv.AGraph()
G.add_node("a")
G.add_edge("b", "c")
print(G)
strict graph "" {
a;
b -- c;
}
`
Parameters not related to model building or training should be moved to config.py
Implement a node-level task trainer in trainers.py for tasks at the node level.
align use_case_3 with the paper.
align use_case_1 with paper.
# Works on OS X, with conda installed.
# Create conda environment for PyTorch Geometric
echo "Creating pyg environment"
conda create -n pyg python=3.6
echo "Activate pyg Env"
source activate pyg
# PyTorch Conda Installation
echo "Installing PyTorch"
conda install pytorch torchvision -c pytorch
# Change of Compilers
echo "Compiler Changing on OS X"
conda install -y clang_osx-64 clangxx_osx-64 gfortran_osx-64
MACOSX_DEPLOYMENT_TARGET=10.9 CC=clang CXX=clang++
# Install dependencies
echo "Installing PyG Dependencies"
pip install torch_scatter
pip install torch_sparse
pip install torch_cluster
pip install torch_geometric
Use_Case_1.py" in GPU mode throws the same error as when ran with only CPU.
!python use_case_1.py
Traceback (most recent call last):
File "/content/hw2vec/examples/use_case_1.py", line 33, in <module>
graph_emb = use_case_1(cfg, hw_design_dir_path,\
File "/content/hw2vec/examples/use_case_1.py", line 18, in use_case_1
model.load_model(pretrained_model_cfg_path, pretrained_model_weight_path)
File "/content/hw2vec/hw2vec/graph2vec/models.py", line 105, in load_model
self.load_state_dict(torch.load(model_weight_path, map_location=torch.device('cpu')))
File "/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py", line 2041, in load_state_dict
raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format(
RuntimeError: Error(s) in loading state_dict for GRAPH2VEC:
Missing key(s) in state_dict: "layers.0.graph_conv.lin.weight", "layers.1.graph_conv.lin.weight", "pool1.graph_pool.gnn.lin_rel.weight", "pool1.graph_pool.gnn.lin_rel.bias", "pool1.graph_pool.gnn.lin_root.weight".
Unexpected key(s) in state_dict: "layers.0.graph_conv.weight", "layers.1.graph_conv.weight", "pool1.graph_pool.gnn.lin_l.weight", "pool1.graph_pool.gnn.lin_l.bias", "pool1.graph_pool.gnn.lin_r.weight".
Can you please help with this issue?
use_case_2.py and use_case_3.py works fine as documented on the GitHub page.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.