Skip to main content

Brandos ultimate utils for science, machine learning and AI

Project description

Ultimate-utils

Ulitmate-utils (or uutils) is collection of useful code that Brando has collected through the years that has been useful accross his projects. Mainly for machine learning and programming languages tasks.

Installing Ultimate-utils

Standard pip instal [Recommended]

pip install ultimate-utils

then you should be able to import is as follows:

import uutils

note the import statement is shorter than the library name (ultimate-utils vs uutils).

Manual installation [Development of uutils]

To use uutils first get the code this repo (e.g. fork it on github):

git clone git@github.com:brando90/ultimate-utils.git

Then install it in development mode in your python env with python >=3.9 (read modules_in_python.md to learn about python envs). E.g. create your env with conda:

conda create -n uutils_env python=3.9
conda activate uutils_env

Then install uutils in edibable mode and all it's depedencies with pip in the currently activated conda environment:

pip install -e ~/ultimate-utils/ultimate-utils-proj-src

No error should show up from pip. To test the installation uutils do:

python -c "import uutils; uutils.hello()"
python -c "import uutils; uutils.torch_uu.hello()"

it should print something like the following:


hello from uutils __init__.py in:
<module 'uutils' from '/Users/brando/ultimate-utils/ultimate-utils-proj-src/uutils/__init__.py'>


hello from torch_uu __init__.py in:
<module 'uutils.torch_uu' from '/Users/brando/ultimate-utils/ultimate-utils-proj-src/uutils/torch_uu/__init__.py'>

To test pytorch do:

python -c "import uutils; uutils.torch_uu.gpu_test_torch_any_device()"

To test if pytorch works with gpu do (it should fail if no gpus are available):

python -c "import uutils; uutils.torch_uu.gpu_test()"

[Adavanced] If using pygraphviz functions

If you plan to use the functions that depend on pygraphviz you will likely need to install graphviz first. On mac, brew install graphviz. On Ubuntu, sudo apt install graphviz.

Then install pygraphviz with

pip install pygraphviz

If the previous steps didn't work you can also try installing using conda (which seems to install both pygraphviz and graphviz`):

conda install -y -c conda-forge pygraphviz

to see details on that approach see the following stack overflow link question: https://stackoverflow.com/questions/67509980/how-does-one-install-pygraphviz-on-a-hpc-cluster-without-errors-even-when-graphv

To test if pygraphviz works do:

python -c "import pygraphviz"

Nothing should return if successful.

Contributing

Feel free to push code with pull request. Please include at least 1 self-contained test (that works) before pushing.

How modules are imported in a python project

Read the modules_in_python.md to have an idea of the above development/editable installation commands.

Executing tensorboard experiment logs from remote

  • visualize the remote logs using pycharm and my code (TODO: have the download be automatic...perhaps not needed)
  1. Download the code from the cluster using pycharm remote
  2. Then copy paste the remote path (from pycharm, browse remote)
  3. Using the copied path run tbb path2log e.g. tbbb /home/miranda9/data/logs/logs_Mar06_11-15-02_jobid_0_pid_3657/tb

to have tbbb work as the command add to your .zshrc (or .bashrc):

alias tbb="sh ${HOME}/ultimate-utils/run_tb.sh"

then the command tbb path2log should work.

ref: see files

Citation

If you use this implementation consider citing us:

@software{brando2021ultimateutils,
    author={Brando Miranda},
    title={The ultimate utils library for Machine Learning and Artificial Intelligence},
    url={https://github.com/brando90/ultimate-utils},
    year={2021}
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ultimate-utils-0.3.0.tar.gz (78.1 kB view details)

Uploaded Source

Built Distribution

ultimate_utils-0.3.0-py3-none-any.whl (88.3 kB view details)

Uploaded Python 3

File details

Details for the file ultimate-utils-0.3.0.tar.gz.

File metadata

  • Download URL: ultimate-utils-0.3.0.tar.gz
  • Upload date:
  • Size: 78.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.7

File hashes

Hashes for ultimate-utils-0.3.0.tar.gz
Algorithm Hash digest
SHA256 9e1f2e7eb65945522ff6367b26e032300af27edf1f1eafddfefed8afc609d798
MD5 06cbdc0f09d101d27ee321d3621e98e7
BLAKE2b-256 07a795525719923f788caa89feafef28c75d02410bbe24063d6564f834c56c60

See more details on using hashes here.

File details

Details for the file ultimate_utils-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: ultimate_utils-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 88.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.7

File hashes

Hashes for ultimate_utils-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f1519620cb655b8e245b741081d7a4450b1199f27f3f9528e042bf938b5d7433
MD5 2e664614a93d130167d3ee5b0cede797
BLAKE2b-256 8879c355540f0a72fdf00e4f784ec58c0e6708a30735c251d094b44a6ba760c7

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page