8
edits
Changes
Explain uv venv --python 3.11 flag and why it is important/why one might want to use it.
* [https://github.com/kscalelabs/mlfab mlfab]
** This is a Python package I made to help make it easy to quickly try out machine learning ideas in PyTorch
* Coding tools
** [https://mypy-lang.org/ mypy] static analysis
** [https://github.com/psf/black black] code formatter
** [https://docs.astral.sh/ruff/ ruff] alternative to flake8
==== uv ====
To install <code>uv</code> on the K-Scale clusters, run
<syntaxhighlight lang="bash">
curl -LsSf https://astral.sh/uv/install.sh | sh
</syntaxhighlight>
To get started with <code>uv</code>, pick a directory you want your virtual environment to live in. (<code>$HOME</code> is not recommended.) Once you have <code>cd</code>ed there, run
<syntaxhighlight lang="bash">
uv venv
</syntaxhighlight>
'''If you are on the clusters''', you instead may want to run
<syntaxhighlight lang="bash">
uv venv --python 3.11
</syntaxhighlight>
to ensure that the virtual environment uses Python 3.11. This is because by default, uv uses the system's version of Python (whatever the result of <code>which python</code> yields), and the clusters are running Python 3.10.12. (Python 3.11 will be useful because various projects, including the starter project, will require Python 3.11.)
To activate your virtual environment, run
<syntaxhighlight lang="bash">
source .venv/bin/activate
</syntaxhighlight>
'''while in the directory you created your <code>.venv</code> in'''.
=== Installing Starter Project ===
* SSH into the cluster (see [[K-Scale Cluster]] for instructions)
* Open the workspace that you created in VSCode
=== Useful Brain Dump Stuff ===
* Use <code>breakpoint()</code> to debug code
* Check out the [https://github.com/kscalelabs/mlfab/tree/master/examples mlfab examples directory] for some ideas
* It is a good idea to try to write the full training loop yourself to figure out what's going on
* Run <code>nvidia-smi</code> to see the GPUs and their statuses/any active processes