<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://54.204.126.50/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Dennisc</id>
	<title>Humanoid Robots Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="http://54.204.126.50/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Dennisc"/>
	<link rel="alternate" type="text/html" href="http://54.204.126.50/w/Special:Contributions/Dennisc"/>
	<updated>2026-04-06T03:27:34Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.31.0</generator>
	<entry>
		<id>http://54.204.126.50/index.php?title=Dennis%27_Optimization_Notes&amp;diff=1262</id>
		<title>Dennis' Optimization Notes</title>
		<link rel="alternate" type="text/html" href="http://54.204.126.50/index.php?title=Dennis%27_Optimization_Notes&amp;diff=1262"/>
		<updated>2024-05-25T04:57:12Z</updated>

		<summary type="html">&lt;p&gt;Dennisc: Initial notes on optimization&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Notes of various riffs on Gradient Descent from a perspective of neural networks.&lt;br /&gt;
&lt;br /&gt;
[[Category: Gradient Descent]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;a-review-of-standard-gradient-descent&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== A review of standard Gradient Descent ==&lt;br /&gt;
&lt;br /&gt;
The goal of Gradient Descent is to minimize a loss function &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;L&amp;lt;/math&amp;gt;. To be more specific, if &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;L : \mathbb R^n \to \mathbb R&amp;lt;/math&amp;gt; is a differentiable multivariate function, we want to find the vector &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;w&amp;lt;/math&amp;gt; that minimizes &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;L(w)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Given an initial vector &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;w_0&amp;lt;/math&amp;gt;, we want to “move” in the direction &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Delta w&amp;lt;/math&amp;gt; where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;L(w_0) - L(w_0 + \Delta w)&amp;lt;/math&amp;gt; is minimized (suppose the magnitude of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Delta w&amp;lt;/math&amp;gt; is fixed). By Cauchy’s Inequality, this is precisely when &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Delta w&amp;lt;/math&amp;gt; is in the direction of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;-\nabla L(w_0)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
So given some &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;w_n&amp;lt;/math&amp;gt;, we want to update in the direction of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;-\alpha \nabla L(w_n)&amp;lt;/math&amp;gt;. This motivates setting &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;w_{n+1} = w_n - \alpha \nabla L(w_n)&amp;lt;/math&amp;gt;, where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\alpha&amp;lt;/math&amp;gt; is a scalar factor. We call &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\alpha&amp;lt;/math&amp;gt; the “learning rate” because it affects how fast the series &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;w_n&amp;lt;/math&amp;gt; converges to the optimum. The main trouble in machine learning is to tweak the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\alpha&amp;lt;/math&amp;gt; to what “works best” in ensuring convergence, and that is one of the considerations that the remaining algorithms try to address.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;stochastic-gradient-descent&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Stochastic Gradient Descent ==&lt;br /&gt;
&lt;br /&gt;
In practice we don’t actually know the “true gradient”. So instead we take some datasets, say datasets &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;1&amp;lt;/math&amp;gt; through &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt;, and for dataset &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt; we derive an estimated gradient &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\nabla L_i&amp;lt;/math&amp;gt;. Then we may estimate &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\nabla L&amp;lt;/math&amp;gt; as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\frac{\nabla L_1 + \cdots + \nabla L_n}{n}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If it is easy to compute &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\nabla L_i(w)&amp;lt;/math&amp;gt; in general then we are golden: this is the best estimate of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;L&amp;lt;/math&amp;gt; we can get. But what if &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\nabla L_i&amp;lt;/math&amp;gt; are computationally expensive to compute? Then there is a tradeoff between variance and computational cost when evaluating our estimate of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\nabla L&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
A very low-cost (but low-accuracy) way to estimate &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\nabla L&amp;lt;/math&amp;gt; is just via &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\nabla L_1&amp;lt;/math&amp;gt; (or any other &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\nabla L_i&amp;lt;/math&amp;gt;). But this is obviously problematic: we aren’t even using most of our data! A better balance can be struck as follows: to evaluate &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\nabla L(w_n)&amp;lt;/math&amp;gt;, select &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k&amp;lt;/math&amp;gt; functions at random from &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{\nabla L_1, \ldots, \nabla L_n\}&amp;lt;/math&amp;gt;. Then estimate &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\nabla L&amp;lt;/math&amp;gt; as the average of those &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k&amp;lt;/math&amp;gt; functions ''only at that step''.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;riffs-on-stochastic-gradient-descent&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Riffs on stochastic gradient descent ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;momentum&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Momentum ===&lt;br /&gt;
&lt;br /&gt;
See also [https://distill.pub/2017/momentum/ “Momentum” on Distill].&lt;br /&gt;
&lt;br /&gt;
In typical stochastic gradient descent, the next step we take is based solely on the gradient at the current point. This completely ignores the past gradients. However, many times it makes sense to take the past gradients into account. Of course, if we are at &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;w_{100}&amp;lt;/math&amp;gt;, we should care about &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\nabla L(w_{99})&amp;lt;/math&amp;gt; much heavier than &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\nabla L(w_1)&amp;lt;/math&amp;gt;. So we should weight &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\nabla L(w_{99})&amp;lt;/math&amp;gt; much more than &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\nabla L(w_1)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The simplest way is to weight it with a geometric approach. So when we iterate, instead of taking &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;w_{n+1}&amp;lt;/math&amp;gt; to satisfy&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;w_{n+1} - w_n = -\alpha \nabla L(w_n)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
like in standard gradient descent, we instead want to take &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;w_{n+1}&amp;lt;/math&amp;gt; to satisfy&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;w_{n+1} - w_n = -\alpha \nabla L(w_n) - \beta \alpha \nabla L(w_{n-1}) - \cdots - \beta^n \nabla L(w_0).&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
But this raises a concern: are we really going to be storing all of these terms, especially as &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt; grows? Fortunately, we do not need to. For we may notice that&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;w_{n+1} - w_n = -\alpha \nabla L(w_n) - \beta (\alpha \nabla L(w_{n-1}) - \cdots - \beta^{n-1} L(w_0)) = -\alpha \nabla L(w_n) - \beta(w_n - w_{n-1}).&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To put it another way, if we write &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;w_n - w_{n-1} = \Delta w_n&amp;lt;/math&amp;gt;, i.e. how much &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;w_n&amp;lt;/math&amp;gt; differs from &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;w_{n-1}&amp;lt;/math&amp;gt; by, we may rewrite this equation as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\Delta w_{n+1} = -\alpha \nabla L(w_n) + \beta \Delta w_n.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some of the benefits of using a momentum based approach:&lt;br /&gt;
&lt;br /&gt;
* most importantly, ''it can dramatically speed up convergence to a local minimum''.&lt;br /&gt;
* it makes convergence more likely in general&lt;br /&gt;
* escaping local minima/saddles/plateaus (its importance is possibly contested? See [https://www.reddit.com/r/MachineLearning/comments/dqbp9g/d_momentum_methods_helps_to_escape_local_minima/ this reddit thread])&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;rmsprop&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== RMSProp ===&lt;br /&gt;
&lt;br /&gt;
Gradient descent also often has diminishing learning rates. In order to counter this, we very broadly want to - track the past learning rates, - and if they have been low, multiply &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Delta w_{n+1}&amp;lt;/math&amp;gt; by a scalar to increase the learning rate. - (As a side effect, if our past learning rates are quite high, we will tamper the learning rates.)&lt;br /&gt;
&lt;br /&gt;
While performing our gradient descent to get &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;w_n \to w_{n+1}&amp;lt;/math&amp;gt;, we create and store an auxillary parameter &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v_{n+1}&amp;lt;/math&amp;gt; as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;v_{n+1} = \beta v_n + (1 - \beta) \nabla L(w)^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and define&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;w_{n+1} = w_n - \frac{\alpha}{\sqrt{v_n} + \epsilon} L(w),&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\alpha&amp;lt;/math&amp;gt; as usual is the learning rate, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\beta&amp;lt;/math&amp;gt; is the decay rate of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v_n&amp;lt;/math&amp;gt;, and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\epsilon&amp;lt;/math&amp;gt; is a constant that also needs to be fine-tuned.&lt;br /&gt;
&lt;br /&gt;
We include the constant term of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\epsilon&amp;lt;/math&amp;gt; in order to ensure that the sequence &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;w_n&amp;lt;/math&amp;gt; actually converges and to ensure numerical stability. If we are near the minimum, then &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v_n&amp;lt;/math&amp;gt; will be quite small, meaning the denominator &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\sqrt{v_n} + \epsilon&amp;lt;/math&amp;gt; will essentially just become &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\sqrt{v_n}&amp;lt;/math&amp;gt;. But because &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;w&amp;lt;/math&amp;gt; will converge when &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;L(w)&amp;lt;/math&amp;gt; is just multiplied by a constant (this is the underlying assumption of standard gradient descent, after all), we will achieve convergence when near a minimum.&lt;br /&gt;
&lt;br /&gt;
Side note: in order to get RMSProp to interoperate with stochastic gradient descent, we instead compute the sequence &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v_n&amp;lt;/math&amp;gt; for each approximated loss function &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;L_i&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;adam&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Adam ===&lt;br /&gt;
&lt;br /&gt;
Adam ('''Ada'''ptive '''M'''oment Estimation) is a gradient descent modification that combines Momentum and RMSProp. We create two auxillary variables while iterating &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;w_n&amp;lt;/math&amp;gt; (where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\alpha&amp;lt;/math&amp;gt; is the learning rate, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\beta_1&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\beta_2&amp;lt;/math&amp;gt; are decay parameters that need to be fine-tuned, and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\epsilon&amp;lt;/math&amp;gt; is a parameter serving the same purpose as in RMSProp):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;m_{n+1} = \beta_1 m_n + (1 - \beta_1) \nabla L(w_n)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;v_{n+1} = \beta_2 v_n + (1 - \beta_2) \nabla L(w_n)^2.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For notational convenience, we will define&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\widehat{m}_n = \frac{m_n}{1 - \beta_1^n}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\widehat{v}_n = \frac{v_n}{1 - \beta_2^n}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then our update function to get &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;w_{n+1}&amp;lt;/math&amp;gt; is&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;w_{n+1} = w_n - \alpha \frac{\widehat{m}_n}{\sqrt{\widehat{v}_w} + \epsilon}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is worth noting that though this formula does not explicitly include &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\nabla L(w_n)&amp;lt;/math&amp;gt;, it is accounted for in the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\widehat{m}_n&amp;lt;/math&amp;gt; term through &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m_n&amp;lt;/math&amp;gt;.&lt;/div&gt;</summary>
		<author><name>Dennisc</name></author>
		
	</entry>
	<entry>
		<id>http://54.204.126.50/index.php?title=Getting_Started_with_Machine_Learning&amp;diff=1131</id>
		<title>Getting Started with Machine Learning</title>
		<link rel="alternate" type="text/html" href="http://54.204.126.50/index.php?title=Getting_Started_with_Machine_Learning&amp;diff=1131"/>
		<updated>2024-05-20T03:33:05Z</updated>

		<summary type="html">&lt;p&gt;Dennisc: Explain uv venv --python 3.11 flag and why it is important/why one might want to use it.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is [[User:Ben]]'s guide to getting started with machine learning.&lt;br /&gt;
&lt;br /&gt;
=== Dependencies ===&lt;br /&gt;
&lt;br /&gt;
Here's some useful dependencies that I use:&lt;br /&gt;
&lt;br /&gt;
* [https://astral.sh/blog/uv uv]&lt;br /&gt;
** This is similar to Pip but written in Rust and is way faster&lt;br /&gt;
** It has nice management of virtual environments&lt;br /&gt;
** Can use Conda instead but it is much slower&lt;br /&gt;
* [https://github.com/features/copilot Github Copilot]&lt;br /&gt;
* [https://github.com/kscalelabs/mlfab mlfab]&lt;br /&gt;
** This is a Python package I made to help make it easy to quickly try out machine learning ideas in PyTorch&lt;br /&gt;
* Coding tools&lt;br /&gt;
** [https://mypy-lang.org/ mypy] static analysis&lt;br /&gt;
** [https://github.com/psf/black black] code formatter&lt;br /&gt;
** [https://docs.astral.sh/ruff/ ruff] alternative to flake8&lt;br /&gt;
&lt;br /&gt;
==== uv ====&lt;br /&gt;
&lt;br /&gt;
To install &amp;lt;code&amp;gt;uv&amp;lt;/code&amp;gt; on the K-Scale clusters, run&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
curl -LsSf https://astral.sh/uv/install.sh | sh&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To get started with &amp;lt;code&amp;gt;uv&amp;lt;/code&amp;gt;, pick a directory you want your virtual environment to live in. (&amp;lt;code&amp;gt;$HOME&amp;lt;/code&amp;gt; is not recommended.) Once you have &amp;lt;code&amp;gt;cd&amp;lt;/code&amp;gt;ed there, run&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
uv venv&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''If you are on the clusters''', you instead may want to run&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
uv venv --python 3.11&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
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 &amp;lt;code&amp;gt;which python&amp;lt;/code&amp;gt; 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.)&lt;br /&gt;
&lt;br /&gt;
To activate your virtual environment, run&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
source .venv/bin/activate&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''while in the directory you created your &amp;lt;code&amp;gt;.venv&amp;lt;/code&amp;gt; in'''.&lt;br /&gt;
&lt;br /&gt;
=== Installing Starter Project ===&lt;br /&gt;
&lt;br /&gt;
* Go to [https://github.com/kscalelabs/getting-started this project] and install it&lt;br /&gt;
&lt;br /&gt;
==== Opening the project in VSCode ====&lt;br /&gt;
&lt;br /&gt;
* Create a VSCode config file that looks something like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;json&amp;quot;&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;folders&amp;quot;: [&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;name&amp;quot;: &amp;quot;Getting Started&amp;quot;,&lt;br /&gt;
      &amp;quot;path&amp;quot;: &amp;quot;/home/ubuntu/Github/getting_started&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;name&amp;quot;: &amp;quot;Workspaces&amp;quot;,&lt;br /&gt;
      &amp;quot;path&amp;quot;: &amp;quot;/home/ubuntu/.code-workspaces&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  ],&lt;br /&gt;
  &amp;quot;settings&amp;quot;: {&lt;br /&gt;
    &amp;quot;cmake.configureSettings&amp;quot;: {&lt;br /&gt;
      &amp;quot;CMAKE_CUDA_COMPILER&amp;quot;: &amp;quot;/usr/bin/nvcc&amp;quot;,&lt;br /&gt;
      &amp;quot;CMAKE_PREFIX_PATH&amp;quot;: [&lt;br /&gt;
        &amp;quot;/home/ubuntu/.virtualenvs/getting-started/lib/python3.11/site-packages/torch/share/cmake&amp;quot;&lt;br /&gt;
      ],&lt;br /&gt;
      &amp;quot;PYTHON_EXECUTABLE&amp;quot;: &amp;quot;/home/ubuntu/.virtualenvs/getting-started/bin/python&amp;quot;,&lt;br /&gt;
      &amp;quot;TORCH_CUDA_ARCH_LIST&amp;quot;: &amp;quot;'8.0'&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
    &amp;quot;python.defaultInterpreterPath&amp;quot;: &amp;quot;/home/ubuntu/.virtualenvs/getting-started/bin/python&amp;quot;,&lt;br /&gt;
    &amp;quot;ruff.path&amp;quot;: [&lt;br /&gt;
      &amp;quot;/home/ubuntu/.virtualenvs/getting-started/bin/ruff&amp;quot;&lt;br /&gt;
    ]&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Install the [https://code.visualstudio.com/docs/remote/ssh VSCode SSH extension]&lt;br /&gt;
* SSH into the cluster (see [[K-Scale Cluster]] for instructions)&lt;br /&gt;
* Open the workspace that you created in VSCode&lt;br /&gt;
&lt;br /&gt;
=== Useful Brain Dump Stuff ===&lt;br /&gt;
&lt;br /&gt;
* Use &amp;lt;code&amp;gt;breakpoint()&amp;lt;/code&amp;gt; to debug code&lt;br /&gt;
* Check out the [https://github.com/kscalelabs/mlfab/tree/master/examples mlfab examples directory] for some ideas&lt;br /&gt;
* It is a good idea to try to write the full training loop yourself to figure out what's going on&lt;br /&gt;
* Run &amp;lt;code&amp;gt;nvidia-smi&amp;lt;/code&amp;gt; to see the GPUs and their statuses/any active processes&lt;/div&gt;</summary>
		<author><name>Dennisc</name></author>
		
	</entry>
	<entry>
		<id>http://54.204.126.50/index.php?title=Getting_Started_with_Machine_Learning&amp;diff=1130</id>
		<title>Getting Started with Machine Learning</title>
		<link rel="alternate" type="text/html" href="http://54.204.126.50/index.php?title=Getting_Started_with_Machine_Learning&amp;diff=1130"/>
		<updated>2024-05-20T03:23:58Z</updated>

		<summary type="html">&lt;p&gt;Dennisc: How to install uv on cluster&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is [[User:Ben]]'s guide to getting started with machine learning.&lt;br /&gt;
&lt;br /&gt;
=== Dependencies ===&lt;br /&gt;
&lt;br /&gt;
Here's some useful dependencies that I use:&lt;br /&gt;
&lt;br /&gt;
* [https://astral.sh/blog/uv uv]&lt;br /&gt;
** This is similar to Pip but written in Rust and is way faster&lt;br /&gt;
** It has nice management of virtual environments&lt;br /&gt;
** Can use Conda instead but it is much slower&lt;br /&gt;
* [https://github.com/features/copilot Github Copilot]&lt;br /&gt;
* [https://github.com/kscalelabs/mlfab mlfab]&lt;br /&gt;
** This is a Python package I made to help make it easy to quickly try out machine learning ideas in PyTorch&lt;br /&gt;
* Coding tools&lt;br /&gt;
** [https://mypy-lang.org/ mypy] static analysis&lt;br /&gt;
** [https://github.com/psf/black black] code formatter&lt;br /&gt;
** [https://docs.astral.sh/ruff/ ruff] alternative to flake8&lt;br /&gt;
&lt;br /&gt;
==== uv ====&lt;br /&gt;
&lt;br /&gt;
To install &amp;lt;code&amp;gt;uv&amp;lt;/code&amp;gt; on the K-Scale clusters, run&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
curl -LsSf https://astral.sh/uv/install.sh | sh&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To get started with &amp;lt;code&amp;gt;uv&amp;lt;/code&amp;gt;, pick a directory you want your virtual environment to live in. (&amp;lt;code&amp;gt;$HOME&amp;lt;/code&amp;gt; is not recommended.) Once you have &amp;lt;code&amp;gt;cd&amp;lt;/code&amp;gt;ed there, run&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
uv venv&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To activate your virtual environment, run&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
source .venv/bin/activate &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''while in the directory you created your &amp;lt;code&amp;gt;.venv&amp;lt;/code&amp;gt; in'''.&lt;br /&gt;
&lt;br /&gt;
=== Installing Starter Project ===&lt;br /&gt;
&lt;br /&gt;
* Go to [https://github.com/kscalelabs/getting-started this project] and install it&lt;br /&gt;
&lt;br /&gt;
==== Opening the project in VSCode ====&lt;br /&gt;
&lt;br /&gt;
* Create a VSCode config file that looks something like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;json&amp;quot;&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;folders&amp;quot;: [&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;name&amp;quot;: &amp;quot;Getting Started&amp;quot;,&lt;br /&gt;
      &amp;quot;path&amp;quot;: &amp;quot;/home/ubuntu/Github/getting_started&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;name&amp;quot;: &amp;quot;Workspaces&amp;quot;,&lt;br /&gt;
      &amp;quot;path&amp;quot;: &amp;quot;/home/ubuntu/.code-workspaces&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  ],&lt;br /&gt;
  &amp;quot;settings&amp;quot;: {&lt;br /&gt;
    &amp;quot;cmake.configureSettings&amp;quot;: {&lt;br /&gt;
      &amp;quot;CMAKE_CUDA_COMPILER&amp;quot;: &amp;quot;/usr/bin/nvcc&amp;quot;,&lt;br /&gt;
      &amp;quot;CMAKE_PREFIX_PATH&amp;quot;: [&lt;br /&gt;
        &amp;quot;/home/ubuntu/.virtualenvs/getting-started/lib/python3.11/site-packages/torch/share/cmake&amp;quot;&lt;br /&gt;
      ],&lt;br /&gt;
      &amp;quot;PYTHON_EXECUTABLE&amp;quot;: &amp;quot;/home/ubuntu/.virtualenvs/getting-started/bin/python&amp;quot;,&lt;br /&gt;
      &amp;quot;TORCH_CUDA_ARCH_LIST&amp;quot;: &amp;quot;'8.0'&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
    &amp;quot;python.defaultInterpreterPath&amp;quot;: &amp;quot;/home/ubuntu/.virtualenvs/getting-started/bin/python&amp;quot;,&lt;br /&gt;
    &amp;quot;ruff.path&amp;quot;: [&lt;br /&gt;
      &amp;quot;/home/ubuntu/.virtualenvs/getting-started/bin/ruff&amp;quot;&lt;br /&gt;
    ]&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Install the [https://code.visualstudio.com/docs/remote/ssh VSCode SSH extension]&lt;br /&gt;
* SSH into the cluster (see [[K-Scale Cluster]] for instructions)&lt;br /&gt;
* Open the workspace that you created in VSCode&lt;br /&gt;
&lt;br /&gt;
=== Useful Brain Dump Stuff ===&lt;br /&gt;
&lt;br /&gt;
* Use &amp;lt;code&amp;gt;breakpoint()&amp;lt;/code&amp;gt; to debug code&lt;br /&gt;
* Check out the [https://github.com/kscalelabs/mlfab/tree/master/examples mlfab examples directory] for some ideas&lt;br /&gt;
* It is a good idea to try to write the full training loop yourself to figure out what's going on&lt;br /&gt;
* Run &amp;lt;code&amp;gt;nvidia-smi&amp;lt;/code&amp;gt; to see the GPUs and their statuses/any active processes&lt;/div&gt;</summary>
		<author><name>Dennisc</name></author>
		
	</entry>
	<entry>
		<id>http://54.204.126.50/index.php?title=Getting_Started_with_Machine_Learning&amp;diff=1129</id>
		<title>Getting Started with Machine Learning</title>
		<link rel="alternate" type="text/html" href="http://54.204.126.50/index.php?title=Getting_Started_with_Machine_Learning&amp;diff=1129"/>
		<updated>2024-05-20T03:20:08Z</updated>

		<summary type="html">&lt;p&gt;Dennisc: fix bold&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is [[User:Ben]]'s guide to getting started with machine learning.&lt;br /&gt;
&lt;br /&gt;
=== Dependencies ===&lt;br /&gt;
&lt;br /&gt;
Here's some useful dependencies that I use:&lt;br /&gt;
&lt;br /&gt;
* [https://astral.sh/blog/uv uv]&lt;br /&gt;
** This is similar to Pip but written in Rust and is way faster&lt;br /&gt;
** It has nice management of virtual environments&lt;br /&gt;
** Can use Conda instead but it is much slower&lt;br /&gt;
* [https://github.com/features/copilot Github Copilot]&lt;br /&gt;
* [https://github.com/kscalelabs/mlfab mlfab]&lt;br /&gt;
** This is a Python package I made to help make it easy to quickly try out machine learning ideas in PyTorch&lt;br /&gt;
* Coding tools&lt;br /&gt;
** [https://mypy-lang.org/ mypy] static analysis&lt;br /&gt;
** [https://github.com/psf/black black] code formatter&lt;br /&gt;
** [https://docs.astral.sh/ruff/ ruff] alternative to flake8&lt;br /&gt;
&lt;br /&gt;
==== uv ====&lt;br /&gt;
&lt;br /&gt;
To get started with &amp;lt;code&amp;gt;uv&amp;lt;/code&amp;gt;, pick a directory you want your virtual environment to live in. (&amp;lt;code&amp;gt;$HOME&amp;lt;/code&amp;gt; is not recommended.) Once you have &amp;lt;code&amp;gt;cd&amp;lt;/code&amp;gt;ed there, run&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
uv venv&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To activate your virtual environment, run&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
source .venv/bin/activate &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''while in the directory you created your &amp;lt;code&amp;gt;.venv&amp;lt;/code&amp;gt; in'''.&lt;br /&gt;
&lt;br /&gt;
=== Installing Starter Project ===&lt;br /&gt;
&lt;br /&gt;
* Go to [https://github.com/kscalelabs/getting-started this project] and install it&lt;br /&gt;
&lt;br /&gt;
==== Opening the project in VSCode ====&lt;br /&gt;
&lt;br /&gt;
* Create a VSCode config file that looks something like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;json&amp;quot;&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;folders&amp;quot;: [&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;name&amp;quot;: &amp;quot;Getting Started&amp;quot;,&lt;br /&gt;
      &amp;quot;path&amp;quot;: &amp;quot;/home/ubuntu/Github/getting_started&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;name&amp;quot;: &amp;quot;Workspaces&amp;quot;,&lt;br /&gt;
      &amp;quot;path&amp;quot;: &amp;quot;/home/ubuntu/.code-workspaces&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  ],&lt;br /&gt;
  &amp;quot;settings&amp;quot;: {&lt;br /&gt;
    &amp;quot;cmake.configureSettings&amp;quot;: {&lt;br /&gt;
      &amp;quot;CMAKE_CUDA_COMPILER&amp;quot;: &amp;quot;/usr/bin/nvcc&amp;quot;,&lt;br /&gt;
      &amp;quot;CMAKE_PREFIX_PATH&amp;quot;: [&lt;br /&gt;
        &amp;quot;/home/ubuntu/.virtualenvs/getting-started/lib/python3.11/site-packages/torch/share/cmake&amp;quot;&lt;br /&gt;
      ],&lt;br /&gt;
      &amp;quot;PYTHON_EXECUTABLE&amp;quot;: &amp;quot;/home/ubuntu/.virtualenvs/getting-started/bin/python&amp;quot;,&lt;br /&gt;
      &amp;quot;TORCH_CUDA_ARCH_LIST&amp;quot;: &amp;quot;'8.0'&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
    &amp;quot;python.defaultInterpreterPath&amp;quot;: &amp;quot;/home/ubuntu/.virtualenvs/getting-started/bin/python&amp;quot;,&lt;br /&gt;
    &amp;quot;ruff.path&amp;quot;: [&lt;br /&gt;
      &amp;quot;/home/ubuntu/.virtualenvs/getting-started/bin/ruff&amp;quot;&lt;br /&gt;
    ]&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Install the [https://code.visualstudio.com/docs/remote/ssh VSCode SSH extension]&lt;br /&gt;
* SSH into the cluster (see [[K-Scale Cluster]] for instructions)&lt;br /&gt;
* Open the workspace that you created in VSCode&lt;br /&gt;
&lt;br /&gt;
=== Useful Brain Dump Stuff ===&lt;br /&gt;
&lt;br /&gt;
* Use &amp;lt;code&amp;gt;breakpoint()&amp;lt;/code&amp;gt; to debug code&lt;br /&gt;
* Check out the [https://github.com/kscalelabs/mlfab/tree/master/examples mlfab examples directory] for some ideas&lt;br /&gt;
* It is a good idea to try to write the full training loop yourself to figure out what's going on&lt;br /&gt;
* Run &amp;lt;code&amp;gt;nvidia-smi&amp;lt;/code&amp;gt; to see the GPUs and their statuses/any active processes&lt;/div&gt;</summary>
		<author><name>Dennisc</name></author>
		
	</entry>
	<entry>
		<id>http://54.204.126.50/index.php?title=Getting_Started_with_Machine_Learning&amp;diff=1128</id>
		<title>Getting Started with Machine Learning</title>
		<link rel="alternate" type="text/html" href="http://54.204.126.50/index.php?title=Getting_Started_with_Machine_Learning&amp;diff=1128"/>
		<updated>2024-05-20T03:19:45Z</updated>

		<summary type="html">&lt;p&gt;Dennisc: skeleton of uv&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is [[User:Ben]]'s guide to getting started with machine learning.&lt;br /&gt;
&lt;br /&gt;
=== Dependencies ===&lt;br /&gt;
&lt;br /&gt;
Here's some useful dependencies that I use:&lt;br /&gt;
&lt;br /&gt;
* [https://astral.sh/blog/uv uv]&lt;br /&gt;
** This is similar to Pip but written in Rust and is way faster&lt;br /&gt;
** It has nice management of virtual environments&lt;br /&gt;
** Can use Conda instead but it is much slower&lt;br /&gt;
* [https://github.com/features/copilot Github Copilot]&lt;br /&gt;
* [https://github.com/kscalelabs/mlfab mlfab]&lt;br /&gt;
** This is a Python package I made to help make it easy to quickly try out machine learning ideas in PyTorch&lt;br /&gt;
* Coding tools&lt;br /&gt;
** [https://mypy-lang.org/ mypy] static analysis&lt;br /&gt;
** [https://github.com/psf/black black] code formatter&lt;br /&gt;
** [https://docs.astral.sh/ruff/ ruff] alternative to flake8&lt;br /&gt;
&lt;br /&gt;
==== uv ====&lt;br /&gt;
&lt;br /&gt;
To get started with &amp;lt;code&amp;gt;uv&amp;lt;/code&amp;gt;, pick a directory you want your virtual environment to live in. (&amp;lt;code&amp;gt;$HOME&amp;lt;/code&amp;gt; is not recommended.) Once you have &amp;lt;code&amp;gt;cd&amp;lt;/code&amp;gt;ed there, run&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
uv venv&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To activate your virtual environment, run&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
source .venv/bin/activate &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*while in the directory you created your &amp;lt;code&amp;gt;.venv&amp;lt;/code&amp;gt; in*.&lt;br /&gt;
&lt;br /&gt;
=== Installing Starter Project ===&lt;br /&gt;
&lt;br /&gt;
* Go to [https://github.com/kscalelabs/getting-started this project] and install it&lt;br /&gt;
&lt;br /&gt;
==== Opening the project in VSCode ====&lt;br /&gt;
&lt;br /&gt;
* Create a VSCode config file that looks something like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;json&amp;quot;&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;folders&amp;quot;: [&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;name&amp;quot;: &amp;quot;Getting Started&amp;quot;,&lt;br /&gt;
      &amp;quot;path&amp;quot;: &amp;quot;/home/ubuntu/Github/getting_started&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;name&amp;quot;: &amp;quot;Workspaces&amp;quot;,&lt;br /&gt;
      &amp;quot;path&amp;quot;: &amp;quot;/home/ubuntu/.code-workspaces&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  ],&lt;br /&gt;
  &amp;quot;settings&amp;quot;: {&lt;br /&gt;
    &amp;quot;cmake.configureSettings&amp;quot;: {&lt;br /&gt;
      &amp;quot;CMAKE_CUDA_COMPILER&amp;quot;: &amp;quot;/usr/bin/nvcc&amp;quot;,&lt;br /&gt;
      &amp;quot;CMAKE_PREFIX_PATH&amp;quot;: [&lt;br /&gt;
        &amp;quot;/home/ubuntu/.virtualenvs/getting-started/lib/python3.11/site-packages/torch/share/cmake&amp;quot;&lt;br /&gt;
      ],&lt;br /&gt;
      &amp;quot;PYTHON_EXECUTABLE&amp;quot;: &amp;quot;/home/ubuntu/.virtualenvs/getting-started/bin/python&amp;quot;,&lt;br /&gt;
      &amp;quot;TORCH_CUDA_ARCH_LIST&amp;quot;: &amp;quot;'8.0'&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
    &amp;quot;python.defaultInterpreterPath&amp;quot;: &amp;quot;/home/ubuntu/.virtualenvs/getting-started/bin/python&amp;quot;,&lt;br /&gt;
    &amp;quot;ruff.path&amp;quot;: [&lt;br /&gt;
      &amp;quot;/home/ubuntu/.virtualenvs/getting-started/bin/ruff&amp;quot;&lt;br /&gt;
    ]&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Install the [https://code.visualstudio.com/docs/remote/ssh VSCode SSH extension]&lt;br /&gt;
* SSH into the cluster (see [[K-Scale Cluster]] for instructions)&lt;br /&gt;
* Open the workspace that you created in VSCode&lt;br /&gt;
&lt;br /&gt;
=== Useful Brain Dump Stuff ===&lt;br /&gt;
&lt;br /&gt;
* Use &amp;lt;code&amp;gt;breakpoint()&amp;lt;/code&amp;gt; to debug code&lt;br /&gt;
* Check out the [https://github.com/kscalelabs/mlfab/tree/master/examples mlfab examples directory] for some ideas&lt;br /&gt;
* It is a good idea to try to write the full training loop yourself to figure out what's going on&lt;br /&gt;
* Run &amp;lt;code&amp;gt;nvidia-smi&amp;lt;/code&amp;gt; to see the GPUs and their statuses/any active processes&lt;/div&gt;</summary>
		<author><name>Dennisc</name></author>
		
	</entry>
	<entry>
		<id>http://54.204.126.50/index.php?title=Getting_Started_with_Machine_Learning&amp;diff=1127</id>
		<title>Getting Started with Machine Learning</title>
		<link rel="alternate" type="text/html" href="http://54.204.126.50/index.php?title=Getting_Started_with_Machine_Learning&amp;diff=1127"/>
		<updated>2024-05-20T03:11:30Z</updated>

		<summary type="html">&lt;p&gt;Dennisc: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is [[User:Ben]]'s guide to getting started with machine learning.&lt;br /&gt;
&lt;br /&gt;
=== Dependencies ===&lt;br /&gt;
&lt;br /&gt;
Here's some useful dependencies that I use:&lt;br /&gt;
&lt;br /&gt;
* [https://astral.sh/blog/uv uv]&lt;br /&gt;
** This is similar to Pip but written in Rust and is way faster&lt;br /&gt;
** It has nice management of virtual environments&lt;br /&gt;
** Can use Conda instead but it is much slower&lt;br /&gt;
* [https://github.com/features/copilot Github Copilot]&lt;br /&gt;
* [https://github.com/kscalelabs/mlfab mlfab]&lt;br /&gt;
** This is a Python package I made to help make it easy to quickly try out machine learning ideas in PyTorch&lt;br /&gt;
* Coding tools&lt;br /&gt;
** [https://mypy-lang.org/ mypy] static analysis&lt;br /&gt;
** [https://github.com/psf/black black] code formatter&lt;br /&gt;
** [https://docs.astral.sh/ruff/ ruff] alternative to flake8&lt;br /&gt;
&lt;br /&gt;
=== Installing Starter Project ===&lt;br /&gt;
&lt;br /&gt;
* Go to [https://github.com/kscalelabs/getting-started this project] and install it&lt;br /&gt;
&lt;br /&gt;
==== Opening the project in VSCode ====&lt;br /&gt;
&lt;br /&gt;
* Create a VSCode config file that looks something like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;json&amp;quot;&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;folders&amp;quot;: [&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;name&amp;quot;: &amp;quot;Getting Started&amp;quot;,&lt;br /&gt;
      &amp;quot;path&amp;quot;: &amp;quot;/home/ubuntu/Github/getting_started&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;name&amp;quot;: &amp;quot;Workspaces&amp;quot;,&lt;br /&gt;
      &amp;quot;path&amp;quot;: &amp;quot;/home/ubuntu/.code-workspaces&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  ],&lt;br /&gt;
  &amp;quot;settings&amp;quot;: {&lt;br /&gt;
    &amp;quot;cmake.configureSettings&amp;quot;: {&lt;br /&gt;
      &amp;quot;CMAKE_CUDA_COMPILER&amp;quot;: &amp;quot;/usr/bin/nvcc&amp;quot;,&lt;br /&gt;
      &amp;quot;CMAKE_PREFIX_PATH&amp;quot;: [&lt;br /&gt;
        &amp;quot;/home/ubuntu/.virtualenvs/getting-started/lib/python3.11/site-packages/torch/share/cmake&amp;quot;&lt;br /&gt;
      ],&lt;br /&gt;
      &amp;quot;PYTHON_EXECUTABLE&amp;quot;: &amp;quot;/home/ubuntu/.virtualenvs/getting-started/bin/python&amp;quot;,&lt;br /&gt;
      &amp;quot;TORCH_CUDA_ARCH_LIST&amp;quot;: &amp;quot;'8.0'&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
    &amp;quot;python.defaultInterpreterPath&amp;quot;: &amp;quot;/home/ubuntu/.virtualenvs/getting-started/bin/python&amp;quot;,&lt;br /&gt;
    &amp;quot;ruff.path&amp;quot;: [&lt;br /&gt;
      &amp;quot;/home/ubuntu/.virtualenvs/getting-started/bin/ruff&amp;quot;&lt;br /&gt;
    ]&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Install the [https://code.visualstudio.com/docs/remote/ssh VSCode SSH extension]&lt;br /&gt;
* SSH into the cluster (see [[K-Scale Cluster]] for instructions)&lt;br /&gt;
* Open the workspace that you created in VSCode&lt;br /&gt;
&lt;br /&gt;
=== Useful Brain Dump Stuff ===&lt;br /&gt;
&lt;br /&gt;
* Use &amp;lt;code&amp;gt;breakpoint()&amp;lt;/code&amp;gt; to debug code&lt;br /&gt;
* Check out the [https://github.com/kscalelabs/mlfab/tree/master/examples mlfab examples directory] for some ideas&lt;br /&gt;
* It is a good idea to try to write the full training loop yourself to figure out what's going on&lt;br /&gt;
* Run &amp;lt;code&amp;gt;nvidia-smi&amp;lt;/code&amp;gt; to see the GPUs and their statuses/any active processes&lt;/div&gt;</summary>
		<author><name>Dennisc</name></author>
		
	</entry>
	<entry>
		<id>http://54.204.126.50/index.php?title=Getting_Started_with_Machine_Learning&amp;diff=1126</id>
		<title>Getting Started with Machine Learning</title>
		<link rel="alternate" type="text/html" href="http://54.204.126.50/index.php?title=Getting_Started_with_Machine_Learning&amp;diff=1126"/>
		<updated>2024-05-20T03:11:12Z</updated>

		<summary type="html">&lt;p&gt;Dennisc: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is [[User:Ben]]'s guide to getting started with machine learning.&lt;br /&gt;
&lt;br /&gt;
=== Dependencies ===&lt;br /&gt;
&lt;br /&gt;
Here's some useful dependencies that I use:&lt;br /&gt;
&lt;br /&gt;
* [https://astral.sh/blog/uv uv]&lt;br /&gt;
** This is similar to Pip but written in Rust and is way faster&lt;br /&gt;
** It has nice management of virtual environments&lt;br /&gt;
** Can use Conda instead but it is much slower&lt;br /&gt;
* [https://github.com/features/copilot Github Copilot]&lt;br /&gt;
* [https://github.com/kscalelabs/mlfab mlfab]&lt;br /&gt;
** This is a Python package I made to help make it easy to quickly try out machine learning ideas in PyTorch&lt;br /&gt;
* Coding tools&lt;br /&gt;
** [https://mypy-lang.org/ mypy] static analysis&lt;br /&gt;
** [https://github.com/psf/black black] code formatter&lt;br /&gt;
** [https://docs.astral.sh/ruff/ ruff] alternative to flake8&lt;br /&gt;
&lt;br /&gt;
=== Installing Starter Project ===&lt;br /&gt;
&lt;br /&gt;
* Go to [https://github.com/kscalelabs/getting-started this project] and install it&lt;br /&gt;
&lt;br /&gt;
==== Opening the project in VSCode ====&lt;br /&gt;
&lt;br /&gt;
* Create a VSCode config file that looks something like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;json&amp;quot;&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;folders&amp;quot;: [&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;name&amp;quot;: &amp;quot;Getting Started&amp;quot;,&lt;br /&gt;
      &amp;quot;path&amp;quot;: &amp;quot;/home/ubuntu/Github/getting_started&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;name&amp;quot;: &amp;quot;Workspaces&amp;quot;,&lt;br /&gt;
      &amp;quot;path&amp;quot;: &amp;quot;/home/ubuntu/.code-workspaces&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  ],&lt;br /&gt;
  &amp;quot;settings&amp;quot;: {&lt;br /&gt;
    &amp;quot;cmake.configureSettings&amp;quot;: {&lt;br /&gt;
      &amp;quot;CMAKE_CUDA_COMPILER&amp;quot;: &amp;quot;/usr/bin/nvcc&amp;quot;,&lt;br /&gt;
      &amp;quot;CMAKE_PREFIX_PATH&amp;quot;: [&lt;br /&gt;
        &amp;quot;/home/ubuntu/.virtualenvs/getting-started/lib/python3.11/site-packages/torch/share/cmake&amp;quot;&lt;br /&gt;
      ],&lt;br /&gt;
      &amp;quot;PYTHON_EXECUTABLE&amp;quot;: &amp;quot;/home/ubuntu/.virtualenvs/getting-started/bin/python&amp;quot;,&lt;br /&gt;
      &amp;quot;TORCH_CUDA_ARCH_LIST&amp;quot;: &amp;quot;'8.0'&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
    &amp;quot;python.defaultInterpreterPath&amp;quot;: &amp;quot;/home/ubuntu/.virtualenvs/getting-started/bin/python&amp;quot;,&lt;br /&gt;
    &amp;quot;ruff.path&amp;quot;: [&lt;br /&gt;
      &amp;quot;/home/ubuntu/.virtualenvs/getting-started/bin/ruff&amp;quot;&lt;br /&gt;
    ]&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Install the [https://code.visualstudio.com/docs/remote/ssh VSCode SSH extension]&lt;br /&gt;
* SSH into the cluster (see [[K-Scale Cluster]] for instructions)&lt;br /&gt;
* Open the workspace that you created in VSCode&lt;br /&gt;
&lt;br /&gt;
=== Useful Brain Dump Stuff ===&lt;br /&gt;
&lt;br /&gt;
* Use &amp;lt;code&amp;gt;breakpoint()&amp;lt;/code&amp;gt; to debug code&lt;br /&gt;
* Check out the [https://github.com/kscalelabs/mlfab/tree/master/examples mlfab examples directory] for some ideas&lt;br /&gt;
* It is a good idea to try to write the full training loop yourself to figure out what's going on&lt;br /&gt;
* Run `nvidia-smi` to see the GPUs and their statuses/any active processes&lt;/div&gt;</summary>
		<author><name>Dennisc</name></author>
		
	</entry>
	<entry>
		<id>http://54.204.126.50/index.php?title=User:Dennisc&amp;diff=992</id>
		<title>User:Dennisc</title>
		<link rel="alternate" type="text/html" href="http://54.204.126.50/index.php?title=User:Dennisc&amp;diff=992"/>
		<updated>2024-05-13T02:49:16Z</updated>

		<summary type="html">&lt;p&gt;Dennisc: Created page with &amp;quot;Dennis is a technical intern and a 2nd-year CS/Math student at CMU.  {{infobox person | name = Dennis Chen | organization = K-Scale Labs | title = Technical Intern | websi...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Dennis is a technical intern and a 2nd-year CS/Math student at CMU.&lt;br /&gt;
&lt;br /&gt;
{{infobox person&lt;br /&gt;
| name = Dennis Chen&lt;br /&gt;
| organization = [[K-Scale Labs]]&lt;br /&gt;
| title = Technical Intern&lt;br /&gt;
| website_link = https://andrew.cmu.edu/~dennisc2&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[Category: K-Scale Employees]]&lt;/div&gt;</summary>
		<author><name>Dennisc</name></author>
		
	</entry>
</feed>