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

"'str' object has no attribute 'decode' " while using pretrained model #53

Closed
Thire399 opened this issue Mar 2, 2023 · 4 comments
Closed

Comments

@Thire399
Copy link

Thire399 commented Mar 2, 2023

I am getting this odd bug while trying to use the carbon tracker with a pretrained pytorch model and my own pytroch model.

Screenshot from 2023-03-02 13-27-17

For reference:
Ubuntu 20.04.5 LTS
GPU: GTX1070 8GB

@raghavian raghavian added the duplicate This issue or pull request already exists label Mar 5, 2023
@raghavian
Copy link
Collaborator

This is a duplicate of Issue 52. I will close it here, please follow the solution presented there until we make a new release.

@raghavian
Copy link
Collaborator

Looks like this a different hardware specific issue. So reopening it.

@raghavian raghavian reopened this Mar 6, 2023
@raghavian raghavian removed the duplicate This issue or pull request already exists label Mar 6, 2023
@dmdequin
Copy link

dmdequin commented Apr 14, 2023

When getting the error AttributeError: 'str' object has no attribute 'decode', I was able to solve it by going to "carbontracker/components/gpu/nvidia.py" and commenting out line 25 where it says devices = [name.decode("utf-8") for name in names], then adding devices = names on a line before the return statement of that function. So the function should look like:

def devices(self):
        """Retrieves the name of all GPUs in a list.
        Note:
            Requires NVML to be initialized.
        """
        names = [pynvml.nvmlDeviceGetName(handle) for handle in self._handles]
        #devices = [name.decode("utf-8") for name in names]
        devices = names
        return devices

@PedramBakh
Copy link
Collaborator

This issue has been addressed in Release v1.2.0. With Python 3.10's change in handling char* from C extensions, the string decoding for NVIDIA GPU names via NVML has been adjusted accordingly. This ensures compatibility across different Python versions.

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