Skip to content

Commit

Permalink
update Torch example (intel-analytics#3022)
Browse files Browse the repository at this point in the history
* update example

* Update README.md

* update resnet_finetune.py

* delete some file

* Create README.md

* Update README.md

* Update README.md

* Update README.md

* add detect conda env name

* some change

* update run example scripte

* update init orca context
  • Loading branch information
qiuxin2012 committed Nov 3, 2020
1 parent 11e8c85 commit c507d6f
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions python/dllib/src/bigdl/dllib/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,29 @@ def detect_python_location():
return out.strip()


def detect_conda_env_name():
import subprocess
pro = subprocess.Popen(
"conda info",
shell=True,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
out, err = pro.communicate()
out = out.decode("utf-8")
err = err.decode("utf-8")
errorcode = pro.returncode
if 0 != errorcode:
raise EnvironmentError(err +
"Cannot find conda info.")
for line in out.split('\n'):
item = line.split(':')
if len(item) == 2:
if item[0].strip() == "active environment":
return item[1].strip()
raise EnvironmentError(err +
"Failed to detect conda env name.")


# This is adopted from conda-pack.
def pack_conda_main(conda_name, tmp_path):
import subprocess
Expand Down

0 comments on commit c507d6f

Please sign in to comment.