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

ASCII code error #21

Open
morpheuslord opened this issue Feb 24, 2023 · 5 comments
Open

ASCII code error #21

morpheuslord opened this issue Feb 24, 2023 · 5 comments

Comments

@morpheuslord
Copy link

To enable the following instructions: AVX2 FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags. 2023-02-24 12:27:40.098752: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT Traceback (most recent call last): File "/home/morpheuslord/Desktop/PassGAN-master/sample.py", line 74, in <module> charmap = pickle.load(f) ^^^^^^^^^^^^^^ UnicodeDecodeError: 'ascii' codec can't decode byte 0x83 in position 0: ordinal not in range(128)

So this is what error i am getting in addition with many bracket missing errors which were easy to locate and correct but this error i am not able to wrap my head around

@pronoym99
Copy link

I am also getting the same error. I have now converted the entire repository to Python 3.8 using the 2to3.8 command available in Unix systems. However, I continue to get the same error.

@morpheuslord
Copy link
Author

same i tried using 2.7 and also 3.11 and 3.10 but same error

@Gurkinator1
Copy link

this is relatively easy to fix. after some googling I found out that you can load python2 pickles in python3 by specifying the encoding:

line 73-76 in sample.py

 with open(os.path.join(args.input_dir, 'charmap.pickle'), 'rb') as f:
     charmap = pickle.load(f, encoding="latin1")
 
 with open(os.path.join(args.input_dir, 'inv_charmap.pickle'), 'rb') as f:
     inv_charmap = pickle.load(f, encoding="latin1")

I just changed those lines + added brackets to all print statements and that was it. I get a different error, TypeError: Variable is unhashable. but thats a seperate issue

@RarMane
Copy link

RarMane commented May 4, 2023

this is relatively easy to fix. after some googling I found out that you can load python2 pickles in python3 by specifying the encoding:

line 73-76 in sample.py

 with open(os.path.join(args.input_dir, 'charmap.pickle'), 'rb') as f:
     charmap = pickle.load(f, encoding="latin1")
 
 with open(os.path.join(args.input_dir, 'inv_charmap.pickle'), 'rb') as f:
     inv_charmap = pickle.load(f, encoding="latin1")

I just changed those lines + added brackets to all print statements and that was it. I get a different error, TypeError: Variable is unhashable. but thats a seperate issue

Did you solved problem with "TypeError: Variable is unhashable."?

@Gurkinator1
Copy link

Did you solved problem with "TypeError: Variable is unhashable."?

As far as I know it's caused by newer tensorflow versions. I "fixed" it by changing lines 28-30 of file PassGAN/tflib/__init__.py

- result = _params[name]
+ result = _params[name].ref()
i = 0
- while result in _param_aliases:
+ while result in _param_aliases.keys(): #not sure if this is required

However now tensorflow has problems transforming the value into a tensor. in File "PassGAN/tflib/ops/linear.py", line 133, in Linear: ValueError: Attempt to convert a value (<Reference wrapping <tf.Variable 'Generator.Input/Generator.Input.W:0' shape=(128, 1280) dtype=float32, numpy= array([...], dtype=float32)>>) with an unsupported type (<class 'tensorflow.python.util.object_identity.Reference'>) to a Tensor.

I dont know enough about tensorflow to fix this. I tried using tf.identity to manually dereference the value, but that didnt work either. This project uses both python2 and outdated tensorflow versions. I dont know if its even worth the trouble
¯\(ツ)

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