When training a machine learning (ML) model, our main aim is usually to get the ‘best’ model out the other end in an unbiased manner. Of course, there are other considerations such as quick training and inference, but mostly we want to be good at predicting the right answer.
A number of factors will affect the quality of our final model, including the chosen architecture, optimiser, and – importantly – the metric we are optimising for. So, how should we pick this metric?
You might have created the most esthetic figures for your last presentation with a beautiful colour scheme, but have you considered how these might look to someone with colourblindness? Around 5% of the gerneral population suffer from some kind of color vision deficiency, so making your figures more accessible is actually quite important! There are a range of online tools that can help you create figures that look great to everyone.
I commend you on your skepticism, but even the skeptical mind must be prepared to accept the unacceptable when there is no alternative. If it looks like a duck, and quacks like a duck, we have at least to consider the possibility that we have a small aquatic bird of the family Anatidæ on our hands.
Douglas Adams
It’s not every day that someone recommends a new whizzbang note-taking software. It’s every second day, or third if you’re lucky. They all have their bells and whistles: Obsidian turns your notes into a funky graph that pulses with information, the web of complexity of your stored knowledge entrapping your attention as you dazzle in its splendour while also the little circles jostle and bounce in decadent harmony. Notion’s aesthetic simplicity belies its comprehensive capabilities, from writing your notes so you don’t need to, to exporting to the web so that the rest of us can read what you didn’t write because you didn’t need to. To pronounce Microsoft OneNote requires only five syllables, efficiently cramming in two extra words while only being one bit slower to say than the mysterious rock competitor. Apple notes can be shared with all the other Apple people who live their happy Apple lives in happy Apple land – and sometimes this even works!
Training a large transformer model can be a multi-day, if not multi-week, ordeal. Especially if you’re using cloud compute, this can be a very expensive affair, not to mention the environmental impact. It’s therefore worth spending a couple days trying to optimise your training efficiency before embarking on a large scale training run. Here, I’ll run through three strategies you can take which (hopefully) shouldn’t degrade performance, while giving you some free speed. These strategies will also work for any other models using linear layers.
I wont go into too much of the technical detail of any of the techniques, but if you’d like to dig into any of them further I’d highly recommend the Nvidia Deep Learning Performance Guide.
Training With Mixed Precision
Training with mixed precision can be as simple as adding a few lines of code, depending on your deep learning framework. It also potentially provides the biggest boost to performance of any of these techniques. Training throughput can be increase by up to three-fold with little degradation in performance – and who doesn’t like free speed?
As a mother currently pursuing my doctorate, I often encounter the belief that higher education is not the ideal time for parenthood. In this post, I want to share my personal experience, offering a different perspective.
A year ago, I began my doctorate with a two-and-a-half-month-old baby. When I received the acceptance email from Oxford, I was thrilled – a dream come true. However, this raised a question: could I pursue this dream while pregnant? I believed in balancing motherhood and academic aspirations, and my advisor’s encouragement reinforced this belief. We, as a family, moved from Israel to England, adjusting to this new chapter.
It hasn’t been easy. Physically, post-pregnancy recovery and sleepless nights were tough. Emotionally, I constantly struggle with guilt over balancing academic and maternal responsibilities. If I focus on my daughter, I worry about neglecting my research; if I concentrate on my studies, I feel like a bad mother. The logistics of managing a household, especially when being the primary caregiver, added another layer of complexity. Motherhood often feels isolating, as not everyone around me can relate to my situation.
Yet, doctoral studies offered unexpected advantages. The flexibility allows me to align my work with my daughter’s schedule, often during nights or weekends. This means I can compensate for lost time without impacting others, unlike in a regular job. Interestingly, this flexibility leads to more time spent with my daughter than if I had a typical job. Moreover, the challenges of motherhood put academic obstacles into perspective. The best part of my day is always the hug from my daughter after a day of work.
As I keep moving forward with my PhD, here are some key tips that have helped me so far:
Flexible Scheduling: Organize daily tasks, including household chores, within specific hours to enhance efficiency.
Creating a Supportive Environment: Having a support system, be it your partner or friends, is crucial. Address practical issues early on, like daycare and babysitters, and don’t be shy to ask for help.
Aligning Expectations with Your Supervisor: Communicate your limitations early to avoid misunderstandings.
Practice Compassion: Acknowledge that you can’t do everything and be kind to yourself.
In the race of life, there never seems to be a “right” time for children. Whether it’s career progression or personal aspirations, the timing is always challenging. However, if you feel ready, that is the right time for you.
So the servers you use have Slurm as their job scheduler? Blopig has very good resources to know how to navigate a Slurm environment.
If you are new to SLURMing, I highly recommend Alissa Hummer’s post . There, she explains in detail what you will need to submit, check or cancel a job, even how to run a job with more than one script in parallel by dividing it into tasks. She is so good that by reading her post you will learn how to move files across the servers, create and manage SSH keys as well as setting up Miniconda and github in a Slurm server.
And Blopig has even more to offer with Maranga Mokaya’s and Oliver Turnbull’s posts as nice complements to have a more advanced use of Slurm. They help with the use of array jobs, more efficient file copying and creating aliases (shortcuts) for frequently used commands.
So… What could I possibly have to add to that?
Well, suppose you are concerned that you or one of your mates might flood the server (not that it has ever happened to me, but just in case).
How would you go by figuring out how many cores are active? How much memory is left? Which GPU does that server use? Fear not, as I have some basic tricks that might help you.
Get information about the servers and nodes:
A pretty straight forward way of getting to know some information on slurm servers is the use of the command:
sinfo -M ALL
Which will give you information on partition names, if that partition is available or not, how many nodes it has, its usage state and a list with those nodes.
CLUSTER: name_of_cluster
PARTITION AVAIL TIMELIMIT NODES STATE NODELIST
low up 7-00:00.0 1 idle node_name.server.address
The -M ALL argument is used to show every cluster. If you know the name of the cluster you can use:
sinfo -M name_of_cluster
But what if you want to know not only if it is up and being used, but how much of its resource is free? Fear not, much is there to learn.
You can use the same sinfo command followed by some arguments, that will give you what you want. And the magic command is:
sinfo -o "%all" -M all
This will show you a lot of information abou every partition of every cluster
So, how can you make it more digestible and filter only the info that you want?
Always start with:
sinfo -M ALL -o "%n"
And inside the quotations you should add the info you would like to know. The %n arguments serves to show every node, the hostname, in each cluster. If you want to know how much free memory there is in each node you can use:
sinfo -M ALL -o "%n %e"
In case you would like to know how the CPUs are being used (how many are allocated, idle, other and total) you should use
sinfo -M ALL -o "%n %e %C"
Well, I could give more and more examples, but it is more efficient to just leave the table of possible arguments here. They come from slurm documentation.
Argument
What does it do?
%all
Print all fields available for this data type with a vertical bar separating each field.
%a
State/availability of a partition.
%A
Number of nodes by state in the format “allocated/idle”. Do not use this with a node state option (“%t” or “%T”) or the different node states will be placed on separate lines.
%b
Features currently active on the nodes, also see %f.
%B
The max number of CPUs per node available to jobs in the partition.
%c
Number of CPUs per node.
%C
Number of CPUs by state in the format “allocated/idle/other/total”. Do not use this with a node state option (“%t” or “%T”) or the different node states will be placed on separate lines.
%d
Size of temporary disk space per node in megabytes.
%D
Number of nodes.
%e
The total memory, in MB, currently free on the node as reported by the OS. This value is for informational use only and is not used for scheduling.
%E
The reason a node is unavailable (down, drained, or draining states).
%f
Features available the nodes, also see %b.
%F
Number of nodes by state in the format “allocated/idle/other/total”. Note the use of this format option with a node state format option (“%t” or “%T”) will result in the different node states being be reported on separate lines.
%g
Groups which may use the nodes.
%G
Generic resources (gres) associated with the nodes. (“Graph Card” that the node uses)
%h
Print the OverSubscribe setting for the partition.
%H
Print the timestamp of the reason a node is unavailable.
%i
If a node is in an advanced reservation print the name of that reservation.
%I
Partition job priority weighting factor.
%l
Maximum time for any job in the format “days-hours:minutes:seconds”
%L
Default time for any job in the format “days-hours:minutes:seconds”
%m
Size of memory per node in megabytes.
%M
PreemptionMode.
%n
List of node hostnames.
%N
List of node names.
%o
List of node communication addresses.
%O
CPU load of a node as reported by the OS.
%p
Partition scheduling tier priority.
%P
Partition name followed by “*” for the default partition, also see %R.
%r
Only user root may initiate jobs, “yes” or “no”.
%R
Partition name, also see %P.
%s
Maximum job size in nodes.
%S
Allowed allocating nodes.
%t
State of nodes, compact form.
%T
State of nodes, extended form.
%u
Print the user name of who set the reason a node is unavailable.
%U
Print the user name and uid of who set the reason a node is unavailable.
%v
Print the version of the running slurmd daemon.
%V
Print the cluster name if running in a federation.
%w
Scheduling weight of the nodes.
%X
Number of sockets per node.
%Y
Number of cores per socket.
%z
Extended processor information: number of sockets, cores, threads (S:C:T) per node.
%Z
Number of threads per core.
And there you have it! Now you can know what is going on your slurm clusters and avoid job-blocking your peers.
If you want to know more about slurm, keep an eye on Blopig!
In an attempt to ease the transition from Word to LaTeX for some of my colleagues (*cough* Alex *cough*) this blog post covers some LaTeX tricks I use most frequently when preparing manuscripts. It’s pitched at someone who is already familiar with the basic syntax of paragraphs, figures and tables.
Secure shell (SSH) is an essential tool for remote operations. However, not everything with it is smooth-sailing. Especially, when you want to do things like reverse–port-forwarding via a proxy-hump or two a Jupyter notebook to your local machine from a compute node on a no-home container . Even if it sounds less plausible than the exploits on Mr Robot, it actually can work and requires zero social-engineering or sneaking in server rooms to install Raspberry Pis while using a baseball cap as a disguise.
When showcasing an approach in computational chemistry, an example molecule is required as a placeholder. But which to chose from? I would classify there different approaches: choosing a recognisable molecules, a top selling drugs, or a randomly sketched compound.
At a recent conference, Sheffield Cheminformatics 2023, I saw examples of all three and one problem I had that some placeholders distracted me into searching to figure out what it was.
If you are running lots of little jobs in SLURM and want to make use of free nodes that suddenly become available, it is helpful to have a way of rapidly shipping your environments that does not rely on installing conda or rebuilding the environment from scratch every time. This is useful with complex rebuilds where exported .yml files do not always work as expected, even when specifying exact versions and source locations.
In these situations a tool such a conda-pack becomes incredibly useful. Once you have perfected the house of cards that is your conda environment, you can use conda-pack to save that exact state as a tar.gz file.
This can provide you with a backup to be used when you accidentally delete conda from your system, or if you irreparable corrupt the environment and cannot roll back to the point in time when everything worked. These tar.gz files can also be copied to distant locations by the use of rsync or scp, unpacked, sourced and used without installing conda…