Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code has many errors #17

Open
MojoMoe opened this issue Apr 24, 2021 · 5 comments
Open

Code has many errors #17

MojoMoe opened this issue Apr 24, 2021 · 5 comments

Comments

@MojoMoe
Copy link

MojoMoe commented Apr 24, 2021

Hi. Trying this code in Python 3.9 (Window 10 build 1904), but I think the code is probably for Python 2.x as I am getting a lot of errors:

PS C:\github\PassGAN> python sample.py --output ./new_trained.txt --num-samples 1000000 --input-dir ./pretrained --checkpoint ./pretrained/checkpoints/195000.ckpt
2021-04-24 14:50:47.249852: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cudart64_110.dll
Traceback (most recent call last):
File "sample.py", line 74, in
charmap = pickle.load(f)
_pickle.UnpicklingError: the STRING opcode argument must be quoted
PS C:\github\PassGAN>

Are you planning on updating this code at some point to work in python 3.x ?

@Karlosse
Copy link

Hi, I have updated the code that now works fine for python 3 and tensorflow v2.
Not sure you're still interested?

@Karlosse
Copy link

Karlosse commented Aug 5, 2022

Hello guys, just so you now I forked the repo and pushed the changes on my account so project now can run on python 3 and tensorflow v2. Works fine on my laptop with my nvidia quadro T2000.
Any issues are welcome to be reported.
Thks brannondorsey for such a nice implementation of PassGAN.
Carole

@dinhvien20
Copy link

Hi @Karlosse. Im trying your new code but it's still not work.
I am using python 3.8.2 on window and tensorflow version 2.10.0
Error:
Traceback (most recent call last):
File "train.py", line 9, in
lib = ctypes.cdll.LoadLibrary(name)
File "C:\Python\Python38\lib\ctypes_init_.py", line 451, in LoadLibrary
return self.dlltype(name)
File "C:\Python\Python38\lib\ctypes_init
.py", line 363, in init
if '/' in name or '\' in name:
TypeError: argument of type 'NoneType' is not iterable

@Karlosse
Copy link

Hi @dinhvien20,
Seems to me its more a dll issue not loading properly.
Maybe try comment that line and import the dll in another way, making sure you link to where your dll actually is.
Let me know if still facing issue.

@CryptoAssetRecovery
Copy link

CryptoAssetRecovery commented Mar 2, 2023

Hi @Karlosse

Thanks for going ahead and doing this.

I'm getting an error that I cant easily track down - any ideas?

python sample.py
--input-dir pretrained
--checkpoint pretrained/checkpoints/195000.ckpt
--output gen_passwords.txt
--batch-size 1024
--num-samples 1000000
WARNING:tensorflow:From /Users/user/miniconda3/envs/tensorflow/lib/python3.10/site-packages/tensorflow/python/util/dispatch.py:1176: calling conv1d (from tensorflow.python.ops.nn_ops) with data_format=NCHW is deprecated and will be removed in a future version.
Instructions for updating:
NCHW for data_format is deprecated, use NCW instead
Metal device set to: Apple M1

systemMemory: 8.00 GB
maxCacheSize: 2.67 GB

2023-03-01 23:37:01.928012: I tensorflow/core/common_runtime/pluggable_device/pluggable_device_factory.cc:306] Could not identify NUMA node of platform GPU ID 0, defaulting to 0. Your kernel may not have been built with NUMA support.
2023-03-01 23:37:01.928478: I tensorflow/core/common_runtime/pluggable_device/pluggable_device_factory.cc:272] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 0 MB memory) -> physical PluggableDevice (device: 0, name: METAL, pci bus id: )
2023-03-01 23:37:01.954811: I tensorflow/compiler/mlir/mlir_graph_optimization_pass.cc:357] MLIR V1 optimization pass is not enabled
2023-03-01 23:37:01.966865: W tensorflow/tsl/platform/profile_utils/cpu_utils.cc:128] Failed to get CPU frequency: 0 Hz
2023-03-01 23:37:01.973731: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:114] Plugin optimizer for device_type GPU is enabled.
2023-03-01 23:37:02.021626: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:114] Plugin optimizer for device_type GPU is enabled.
Traceback (most recent call last):
File "/Users/user/miniconda3/envs/tensorflow/lib/python3.10/site-packages/tensorflow/python/client/session.py", line 1378, in _do_call
return fn(*args)
File "/Users/user/miniconda3/envs/tensorflow/lib/python3.10/site-packages/tensorflow/python/client/session.py", line 1361, in _run_fn
return self._call_tf_sessionrun(options, feed_dict, fetch_list,
File "/Users/user/miniconda3/envs/tensorflow/lib/python3.10/site-packages/tensorflow/python/client/session.py", line 1454, in _call_tf_sessionrun
return tf_session.TF_SessionRun_wrapper(self._session, options, feed_dict,
tensorflow.python.framework.errors_impl.InvalidArgumentError: 2 root error(s) found.
(0) INVALID_ARGUMENT: Input to reshape is a tensor with 2099200 values, but the requested shape requires a multiple of 31
[[{{node Reshape_1}}]]
[[Reshape_2/_49]]
(1) INVALID_ARGUMENT: Input to reshape is a tensor with 2099200 values, but the requested shape requires a multiple of 31
[[{{node Reshape_1}}]]
0 successful operations.
0 derived errors ignored.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/user/Downloads/code/tensorflow/PassGAN/sample.py", line 109, in
samples.extend(generate_samples())
File "/Users/user/Downloads/code/tensorflow/PassGAN/sample.py", line 85, in generate_samples
samples = session.run(fake_inputs)
File "/Users/user/miniconda3/envs/tensorflow/lib/python3.10/site-packages/tensorflow/python/client/session.py", line 968, in run
result = self._run(None, fetches, feed_dict, options_ptr,
File "/Users/user/miniconda3/envs/tensorflow/lib/python3.10/site-packages/tensorflow/python/client/session.py", line 1191, in _run
results = self._do_run(handle, final_targets, final_fetches,
File "/Users/user/miniconda3/envs/tensorflow/lib/python3.10/site-packages/tensorflow/python/client/session.py", line 1371, in _do_run
return self._do_call(_run_fn, feeds, fetches, targets, options,
File "/Users/user/miniconda3/envs/tensorflow/lib/python3.10/site-packages/tensorflow/python/client/session.py", line 1397, in _do_call
raise type(e)(node_def, op, message) # pylint: disable=no-value-for-parameter
tensorflow.python.framework.errors_impl.InvalidArgumentError: Graph execution error:

Detected at node 'Reshape_1' defined at (most recent call last):
File "/Users/user/Downloads/code/tensorflow/PassGAN/sample.py", line 80, in
fake_inputs = models.Generator(args.batch_size, args.seq_length, args.layer_dim, len(charmap))
File "/Users/user/Downloads/code/tensorflow/PassGAN/models.py", line 27, in Generator
output = softmax(output, output_dim)
File "/Users/user/Downloads/code/tensorflow/PassGAN/models.py", line 45, in softmax
tf.reshape(logits, [-1, num_classes])
Node: 'Reshape_1'
Detected at node 'Reshape_1' defined at (most recent call last):
File "/Users/user/Downloads/code/tensorflow/PassGAN/sample.py", line 80, in
fake_inputs = models.Generator(args.batch_size, args.seq_length, args.layer_dim, len(charmap))
File "/Users/user/Downloads/code/tensorflow/PassGAN/models.py", line 27, in Generator
output = softmax(output, output_dim)
File "/Users/user/Downloads/code/tensorflow/PassGAN/models.py", line 45, in softmax
tf.reshape(logits, [-1, num_classes])
Node: 'Reshape_1'
2 root error(s) found.
(0) INVALID_ARGUMENT: Input to reshape is a tensor with 2099200 values, but the requested shape requires a multiple of 31
[[{{node Reshape_1}}]]
[[Reshape_2/_49]]
(1) INVALID_ARGUMENT: Input to reshape is a tensor with 2099200 values, but the requested shape requires a multiple of 31
[[{{node Reshape_1}}]]
0 successful operations.
0 derived errors ignored.

Original stack trace for 'Reshape_1':
File "/Users/user/Downloads/code/tensorflow/PassGAN/sample.py", line 80, in
fake_inputs = models.Generator(args.batch_size, args.seq_length, args.layer_dim, len(charmap))
File "/Users/user/Downloads/code/tensorflow/PassGAN/models.py", line 27, in Generator
output = softmax(output, output_dim)
File "/Users/user/Downloads/code/tensorflow/PassGAN/models.py", line 45, in softmax
tf.reshape(logits, [-1, num_classes])
File "/Users/user/miniconda3/envs/tensorflow/lib/python3.10/site-packages/tensorflow/python/util/traceback_utils.py", line 150, in error_handler
return fn(*args, **kwargs)
File "/Users/user/miniconda3/envs/tensorflow/lib/python3.10/site-packages/tensorflow/python/util/dispatch.py", line 1176, in op_dispatch_handler
return dispatch_target(*args, **kwargs)
File "/Users/user/miniconda3/envs/tensorflow/lib/python3.10/site-packages/tensorflow/python/ops/array_ops.py", line 199, in reshape
result = gen_array_ops.reshape(tensor, shape, name)
File "/Users/user/miniconda3/envs/tensorflow/lib/python3.10/site-packages/tensorflow/python/ops/gen_array_ops.py", line 8551, in reshape
_, _, _op, _outputs = _op_def_library._apply_op_helper(
File "/Users/user/miniconda3/envs/tensorflow/lib/python3.10/site-packages/tensorflow/python/framework/op_def_library.py", line 795, in _apply_op_helper
op = g._create_op_internal(op_type_name, inputs, dtypes=None,
File "/Users/user/miniconda3/envs/tensorflow/lib/python3.10/site-packages/tensorflow/python/framework/ops.py", line 3798, in _create_op_internal
ret = Operation(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants