frgfm / torch-scan

Seamless analysis of your PyTorch models (RAM usage, FLOPs, MACs, receptive field, etc.)
https://frgfm.github.io/torch-scan/latest
Apache License 2.0
208 stars 22 forks source link

fix: read encoding with utf-8 #56

Closed joonas-yoon closed 2 years ago

joonas-yoon commented 2 years ago

What does this PR do?

Related on #55

The default UTF-8 encoding of Python 3 is belong users system, and in windows, it can not be always 'utf-8' encoding.

So I fixed it always read with UTF-8 encoding.

It works fine, in my environment

$ pip install -e .
Obtaining file:///C:/Users/joona/Documents/torch-scan
  Preparing metadata (setup.py) ... done
Requirement already satisfied: torch>=1.5.0 in c:\python38\lib\site-packages (from torchscan==0.1.2.dev0+4d4fcbf) (1.11.0)
Requirement already satisfied: typing-extensions in c:\python38\lib\site-packages (from torch>=1.5.0->torchscan==0.1.2.dev0+4d4fcbf) (4.2.0)
Installing collected packages: torchscan
  Attempting uninstall: torchscan
    Found existing installation: torchscan 0.1.1
    Uninstalling torchscan-0.1.1:
      Successfully uninstalled torchscan-0.1.1
  Running setup.py develop for torchscan
Successfully installed torchscan-0.1.2.dev0+4d4fcbf

Before submitting

codecov[bot] commented 2 years ago

Codecov Report

Merging #56 (ba8230b) into master (4d4fcbf) will not change coverage. The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master      #56   +/-   ##
=======================================
  Coverage   88.37%   88.37%           
=======================================
  Files          10       10           
  Lines         671      671           
=======================================
  Hits          593      593           
  Misses         78       78           
joonas-yoon commented 2 years ago

python and pip version is as you can see the following:

$ pip --version
pip 22.1.1 from C:\Python38\lib\site-packages\pip (python 3.8)

you know, CI tells it have only one error but I can not understand that.

style / mypy-py3 (ubuntu-latest, 3.7) (pull_request) Failing after 55s ā€” mypy-py3 (ubuntu-latest, 3.7)

>>> torchscan/modules/memory.py:228: error: Unsupported operand types for // ("int" and "None")  [operator]

but I did not fix it :/

frgfm commented 2 years ago

@joonas-yoon I see, so that's because of the latest pip version!

About the CI failure, don't worry, it's unrelated šŸ‘