Code Monkey home page Code Monkey logo

veritex's People

Contributors

bardhh avatar shaddadi avatar tomoya-yamaguchi-tm avatar tomyyamy avatar ttj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

veritex's Issues

main_demo.py in not working correctly

The following image is generated:
image22

When running main_demo.py, the following error is reported for each iteration:

Process Process-375:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/multiprocessing/process.py", line 297, in _bootstrap
self.run()
File "/usr/local/lib/python3.7/multiprocessing/process.py", line 99, in run
self._target(*self._args, **self._kwargs)
File "/veritex/veritex/methods/worker.py", line 66, in main_func
self.state_spawn_depth_first(tuple_state)
File "/veritex/veritex/methods/worker.py", line 368, in state_spawn_depth_first
self.state_spawn_depth_first(next_tuple_states[0])
File "/veritex/veritex/methods/worker.py", line 368, in state_spawn_depth_first
self.state_spawn_depth_first(next_tuple_states[0])
File "/veritex/veritex/methods/worker.py", line 368, in state_spawn_depth_first
self.state_spawn_depth_first(next_tuple_states[0])
[Previous line repeated 8 more times]
File "/veritex/veritex/methods/worker.py", line 348, in state_spawn_depth_first
self.collect_results(next_tuple_states[0][0])
File "/veritex/veritex/methods/worker.py", line 333, in collect_results
unsafe_inputs = self.dnn.backtrack(vfl)
File "/veritex/veritex/networks/ffnn.py", line 79, in backtrack
elements = np.dot(np.dot(As_unsafe,vfl_set.M), vfl_set.vertices.T) + np.dot(As_unsafe, vfl_set.b) +ds_unsafe
TypeError: Concatenation operation is not implemented for NumPy arrays, use np.concatenate() instead. Please do not rely on this error; it may not be given on all Python implementations.
Process Process-378:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/multiprocessing/process.py", line 297, in _bootstrap
self.run()
File "/usr/local/lib/python3.7/multiprocessing/process.py", line 99, in run
self._target(*self._args, **self._kwargs)
File "/veritex/veritex/methods/worker.py", line 66, in main_func
self.state_spawn_depth_first(tuple_state)
File "/veritex/veritex/methods/worker.py", line 368, in state_spawn_depth_first
self.state_spawn_depth_first(next_tuple_states[0])
File "/veritex/veritex/methods/worker.py", line 368, in state_spawn_depth_first
self.state_spawn_depth_first(next_tuple_states[0])
File "/veritex/veritex/methods/worker.py", line 368, in state_spawn_depth_first
self.state_spawn_depth_first(next_tuple_states[0])
[Previous line repeated 8 more times]
File "/veritex/veritex/methods/worker.py", line 348, in state_spawn_depth_first
self.collect_results(next_tuple_states[0][0])
File "/veritex/veritex/methods/worker.py", line 333, in collect_results
unsafe_inputs = self.dnn.backtrack(vfl)
File "/veritex/veritex/networks/ffnn.py", line 79, in backtrack
elements = np.dot(np.dot(As_unsafe,vfl_set.M), vfl_set.vertices.T) + np.dot(As_unsafe, vfl_set.b) +ds_unsafe
TypeError: Concatenation operation is not implemented for NumPy arrays, use np.concatenate() instead. Please do not rely on this error; it may not be given on all Python implementations.

examples/DRL/main_reachable_domain.py not running

I get the following error when running this script:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/multiprocessing/process.py", line 297, in _bootstrap
self.run()
File "/usr/local/lib/python3.7/multiprocessing/process.py", line 99, in run
self._target(*self._args, **self._kwargs)
File "/home/veritex/src/veritex/methods/worker.py", line 104, in main_func
self.state_spawn_depth_first(tuple_state)
File "/home/veritex/src/veritex/methods/worker.py", line 364, in state_spawn_depth_first
self.state_spawn_depth_first(next_tuple_states[0])
File "/home/veritex/src/veritex/methods/worker.py", line 364, in state_spawn_depth_first
self.state_spawn_depth_first(next_tuple_states[0])
File "/home/veritex/src/veritex/methods/worker.py", line 364, in state_spawn_depth_first
self.state_spawn_depth_first(next_tuple_states[0])
[Previous line repeated 7 more times]
File "/home/veritex/src/veritex/methods/worker.py", line 358, in state_spawn_depth_first
self.collect_results(next_tuple_states[0][0])
File "/home/veritex/src/veritex/methods/worker.py", line 338, in collect_results
unsafe_inputs = self.dnn.backtrack(s) # in FVIM or Flattice
File "/home/veritex/src/veritex/networks/ffnn.py", line 164, in backtrack
for i in range(len(self.property.unsafe_domains)):
AttributeError: 'NoneType' object has no attribute 'unsafe_domains'

setup.py

We have already had requirement.txt.
However if we consider developer user, maybe setup.py which allows install this repo. as Python pkg would be better.

MAC M1

When running the tool on Mac M1, I get errors related to imports of torch.ao.quantization. The error is not showing by changing all instances of "torch.ao.quantization" to "torch.quantization". This is likely a pytorch issue.

ode review ACASXu repair

I understand you make some list by
acasxu_repair_list.py
At least, we may merge the codes repair_propertyX.py into repair_property.py.
I know you need repair_propertyX.py as function pointer for property_ls. You can keep this. but still you may call marged code repair_property.py internal of repair_propertyX.py.

repair_all_nnets.py and repair_sub_nnets.py are almost same. just marge it and make shell script to call all setting or sub setting.

Running reproduce_results1.sh

Nice! I was able to run the script on Windows under your new instructions.

Here is the table that is generated. This is consistent with the results in the paper. Fix typo Successe -> Success.

Table2&3.txt

Next I will run the longer script.

code review ACASXu verify

The code itself seems to be good.
Anyway, what is the difference of each verify_pX_vnnlib.py?
I feel we may make one function for that and call them from .sh with different argument instead of many copy of .py

Reproduce_results2.py generates an error

I ran Reproduce_results2.py for several hours. Here is the log (partial since buffer on powershell is limited).

I got the following error: "The number of repaired instances is not correct!"

log.txt

Add docstring for each function

Something like this:

def add_binary(a, b):
'''
Returns the sum of two decimal numbers in binary digits.

        Parameters:
                a (int): A decimal integer
                b (int): Another decimal integer

        Returns:
                binary_sum (str): Binary string of the sum of a and b
'''
binary_sum = bin(a+b)[2:]
return binary_sum

print(add_binary.doc)

Warnings when running reproduce_results

There are two warnings that pop up.
...
[2022-05-03 20:00:16,693][INFO] After 25 epochs / 0m 29s (29.440 seconds), with 0.9774 accuracy on test set.
[2022-05-03 20:00:16,693][INFO] Eventually the trained network got certified? True
[2022-05-03 20:00:16,694][INFO] === Avg <epochs, train_time, certified, accuracy> for 35 networks:
[2022-05-03 20:00:16,694][INFO] tensor([25.2857, 28.8715, 0.9714, 0.9473])
[2022-05-03 20:00:16,695][INFO] Total Cost Time: 1010.9472537349939s.

figure2_generator.py:54: UserWarning: Attempted to set non-positive bottom ylim on a log-scaled axis.
Invalid limit will be ignored.
plt.ylim([0, 116])
/usr/local/lib/python3.7/site-packages/onnx2pytorch/convert/operations.py:154: UserWarning: The given NumPy array is not writeable, and PyTorch does not support non-writeable tensors. This means you can write to the underlying (supposedly non-writeable) NumPy array using the tensor. You may want to copy the array to protect its data or make it writeable before converting it to a tensor. This type of warning will be suppressed for the rest of this program. (Triggered internally at ../torch/csrc/utils/tensor_numpy.cpp:189.)
weight = torch.from_numpy(numpy_helper.to_array(params[0]))

CAV2022 final checks

I reran on my Ubuntu computer via docker as a final check using the last version. Installation appeared okay via docker with latest instructions.

install-taylor-ubuntu-2022-05-06.txt

I was UNABLE to successfully run the copy to host command. I kept getting a file permission error for some reason. This should get corrected, as otherwise the artifact might fail as not being functional. For some reason I did not have this problem on a Windows host.

johnsott@lh-lambda-quad:~/veritex-results-2022-05-06$ sudo docker cp cav_veritex:/veritex/cav22_artifact/results/. .
open /home/johnsott/veritex-results-2022-05-06/Figure2.png: permission denied
root@c7d71a98cd96:/veritex/cav22_artifact/results# ls
 Figure2.png
'Table2&3.txt'
'figure3(a)_original_reach_property_1_2_dims_0_1.png'
'figure3(b)_veritex_reach_property_1_2_dims_0_1.png'
'figure3(c)_art_reach_property_1_2_dims_0_1.png'
'figure3(d)_original_reach_property_3_4_dims_0_1.png'
'figure3(e)_veritex_reach_property_3_4_dims_0_1.png'
'figure3(f)_art_reach_property_3_4_dims_0_1.png'
'figure4(a)_original_reach_property_1_2_dims_0_1.png'
'figure4(b)_veritex_reach_property_1_2_dims_0_1.png'
'figure4(c)_original_reach_property_1_2_dims_0_2.png'
'figure4(d)_veritex_reach_property_1_2_dims_0_2.png'

code review Demo

Again, your code is well modular already. I don't feel many issues there.
Here is minor feedback for examples/Demo/main_demo.py

# init FFNN
logging.info('Start the demo...')
model = torch.load('demo_model.pt')
dnn0 = FFNN(model, unsafe_in_dom=True, exact_out_dom=True)

I know what is FFNN. but I feel this is reachability analysis interpreter for feed forward neural network. So it is not general FFNN. Perhaps we may come up with new class name.

unsafe_domains = [[A_unsafe,d_unsafe]]
property1 = Property(input_domain, unsafe_domains)
dnn0.unsafe_domains = property1.unsafe_domains

I like Property class. that is good.
but you put the property member to dnn0 member directly. I need to understand the data structure of FFNN and Property in detail.
But perhaps we can make Property setter method in FFNN. like,

dnn0.set_property(property1)

vfl_input = cp.deepcopy(property1.input_set)
shared_state = SharedState([vfl_input], num_processors)

is difficult to understand. SharedState is OK even we need explanation.
but why we need to get deep copy of property1.input_set? and perhaps we may consider connection with Property class.

# get results
output_sets = [np.dot(item[1].vertices, item[1].M.T) + item[1].b.T for item in results] # sets represented with their vertices
input_unsafe_sets = [sub.vertices for item in results for sub in item[0] if sub] # sets represented with their vertices
unsafe_domain = np.array([[y1_lbs, -15], [y1_lbs, 25], [y1_ubs, -15], [y1_ubs, 25]])

Are output_sets, input_unsafe_sets, unsafe_domain general data set? or just for plot?
If it is somehow general, we may implement converter function.

add the simplest example

Add he simplest example in example.

just

  • load very small NN (like 3 layer)
  • Setup FNN
  • run it with out parallel processing. (single)

We know Demo is also simple. but more simpler one!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.