From 2066380e3c82328726d7462fbe7796baf16dbf1a Mon Sep 17 00:00:00 2001 From: Alex McGuinness Date: Wed, 12 Feb 2025 01:31:50 +0800 Subject: [PATCH] Update 'Run DeepSeek R1 Locally - with all 671 Billion Parameters' --- ...cally---with-all-671-Billion-Parameters.md | 67 +++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 Run-DeepSeek-R1-Locally---with-all-671-Billion-Parameters.md diff --git a/Run-DeepSeek-R1-Locally---with-all-671-Billion-Parameters.md b/Run-DeepSeek-R1-Locally---with-all-671-Billion-Parameters.md new file mode 100644 index 0000000..be43c02 --- /dev/null +++ b/Run-DeepSeek-R1-Locally---with-all-671-Billion-Parameters.md @@ -0,0 +1,67 @@ +
Last week, I demonstrated how to quickly run distilled variations of the [DeepSeek](https://blogs.cput.ac.za) R1 design locally. A distilled model is a compressed version of a [bigger language](https://clicksordirectory.com) design, where [understanding](https://mashinky.com) from a bigger design is transferred to a smaller sized one to reduce resource usage without losing too much performance. These models are based on the Llama and Qwen architectures and be available in versions ranging from 1.5 to 70 billion [parameters](https://canaldapoeira.com.br).
+
Some explained that this is not the REAL DeepSeek R1 and that it is impossible to run the full model in your area without a number of hundred GB of memory. That seemed like a challenge - I thought! First Attempt - Warming up with a 1.58 bit Quantized Version of DeepSeek R1 671b in Ollama.cpp
+
The designers behind Unsloth dynamically quantized DeepSeek R1 so that it might operate on as low as 130GB while still gaining from all 671 billion specifications.
+
A [quantized LLM](https://ezworkers.com) is a LLM whose parameters are stored in [lower-precision formats](https://srca.cfacademy.school) (e.g., 8-bit or 4-bit instead of 16-bit). This substantially reduces memory use and accelerates processing, with minimal effect on performance. The full version of DeepSeek R1 uses 16 bit.
+
The trade-off in accuracy is hopefully compensated by increased speed.
+
I downloaded the files from this collection on Hugging Face and ran the following [command](http://truthinaddison.com) with [Llama.cpp](http://bromusic.ru).
+
The following table from Unsloth shows the recommended value for the n-gpu-layers criterion, which indicates just how much work can be offloaded to the GPU.
+
According to the table, I thought 7 ought to be the optimum, but I got it running with 12. According to Windows Task [Manager](https://astroindianpriest.com) my GPU has 40 GB of memory, and not 24 as I thought. So then it includes up (7/ 24 * 40 ≈ 12).
+
If you prefer to run the [model straight](https://masmastronardi.com) with Ollama, you need to combine the three GGUF files using Llama.cpp or a similar tool first.
+
Above is a few of the text that appears on screen while running the command.
+
Llama.cpp and the quantized design are heavy on memory and CPU, but also utilize the GPU (a little) and constantly read from the disk where the design files are kept.
+
The design duplicates the concern and is getting all set to start thinking.
+
The reasoning, or thinking, is rather prolonged - which also adds to the overall time it takes.
+
Okay, so I require to find out Alan Turing's essential contribution to how we live our lives in 2025. Hmm. Let's begin by remembering who Alan Turing was. He was a British mathematician and computer scientist, right? He's known for his work in code-breaking throughout World War II, specifically with the [Enigma device](https://www.francescocolianni.com). Oh, and he's likewise considered among the daddies of theoretical computer technology and expert system.
+
So, his contributions ... Well, the Turing Machine principle is essential in computer technology. It's a theoretical model of a computer, which laid the foundation for contemporary computing. Then there's the Turing Test, which has to do with determining whether a machine can exhibit smart habits identical from a human. That relates to [AI](https://luxurylovelife.com). Also, his deal with morphogenesis, which I believe is about biological patterns and [asteroidsathome.net](https://asteroidsathome.net/boinc/view_profile.php?userid=762651) development, like how organisms develop shapes and patterns.
+
Now, how do these [contributions affect](https://cpascal.net) life in 2025? Well, we remain in a world where [AI](https://myquora.myslns.com) is becoming more widespread. So maybe his work on the Turing Test is affecting how [AI](https://mangacr.com) is established and incorporated into [society](http://120.48.141.823000). If the Turing Test is a [criteria](https://jennhanischphotography.com) for [AI](https://blablasell.com) intelligence, then advancements in [AI](https://bbd-law.com) that pass this test might be substantial. But wait, the Turing Test is more of a philosophical benchmark. Maybe the actual algorithms or concepts he established are more fundamental.
+
The [Turing Machine](http://www.zorro-inc.com) design is the basis for the stored-program computer, which is the architecture of contemporary computers. All our computer systems today, consisting of mobile phones, servers, and so on, are based upon this concept. So, in 2025, even as technology advances, the [basic concepts](http://daeasecurity.com) he laid down would still be the basis for all computational gadgets. That's quite substantial. Without that, we would not have the computer systems that power everything from the web to [AI](https://oyotunji.site) algorithms.
+
Additionally, his deal with code-breaking throughout WWII resulted in improvements in cryptography. Modern file encryption methods might have roots in his work, which is vital for secure communication in 2025. Everything from electronic banking to private messaging counts on encryption, so that's a big [contribution](http://www.atn.ne.jp).
+
Another angle is his impact on the [advancement](http://ozh.sk) of algorithms. The concept of a universal computing maker enables the creation of intricate algorithms that drive [AI](https://git.blinkpay.vn), information analysis, artificial intelligence, and so on. So, any [AI](https://orospublications.gr) systems in 2025 would originate from his fundamental work.
+
Also, morphogenesis might have affected fields like biology and genetics. Maybe in 2025, comprehending biological patterns helps in areas like genetic modification or synthetic biology. But I'm uncertain how straight that ties into daily life compared to [computing](https://cardsandcrystals.com).
+
Putting it all together, the most important contribution might be the Turing Machine and the theory of calculation, which underpin all contemporary computing technology. Without that, the digital age would not exist as we know it. In 2025, even with developments, the basic structure of computation he offered would still be vital. Alternatively, his deal with [AI](https://xn--lnium-mra.com) and the Turing Test may be more highlighted in an [AI](https://opstoapel.org)-driven future, but the foundational computing theory appears more basic.
+
Wait, however the Turing Test is more about assessing [AI](https://www.ostificiodomus.it) rather than a contribution to technology itself. The real contribution is the theoretical basis for computing, which allowed all the digital tech we have. So, in 2025, all the smart gadgets, [AI](https://tesserasolution.com), cloud computing, etc, are all constructed upon the principles he [developed](https://essencialponto.com.br). Therefore, his most crucial contribution is the idea of a universal Turing machine, which is the basis for all contemporary computers, causing the digital transformation that defines modern life.
+
And finally the response.
+
Alan Turing's most substantial [contribution](http://pcp.vieju.net) to how we live in 2025 is his foundational work in theoretical computer technology, particularly the principle of the universal Turing machine. This [theoretical design](http://forexiq.net) developed the principles of contemporary computation, forming the basis for all [digital](https://www.tre-g-snc.it) computer systems. In 2025, this development underpins the entire digital world, making it possible for technologies like expert system, cloud computing, smartphones, and the internet. Without Turing's conceptual framework, the development of programmable computers and subsequent innovations that specify modern [life-from](https://www.grigoletti.it) [AI](https://curious-world.ru) algorithms to protect interaction [systems-would](https://www.florevit.com) not have been possible. His work on cryptography and the [Turing Test](https://woofocus.com) likewise added to secure interactions and [AI](http://thewrittenhouse.com) advancement, however it is the universal Turing machine that remains the cornerstone of our digital existence.
+
In summary: The 1.58 bit quantized design created 0.39 tokens per second. In total, it took about 37 minutes to answer the very same concern.
+
I was type of stunned that I had the ability to run the model with only 32GB of RAM.
+
Second Attempt - DeepSeek R1 671b in Ollama
+
Ok, I get it, a [quantized design](http://misoraco.com) of only 130GB isn't actually the complete design. Ollama's model library seem to consist of a complete version of DeepSeek R1. It's 404GB with all 671 billion criteria - that should be genuine enough, right?
+
No, not actually! The variation hosted in Ollamas library is the 4 bit quantized variation. See Q4_K_M in the [screenshot](https://blogs.cput.ac.za) above? It took me a while!
+
With [Ollama installed](http://www.usrecords.at) on my home PC, I simply needed to clear 404GB of disk area and run the following command while [grabbing](https://professionpartners.co.uk) a cup of coffee:
+
Okay, it took more than one coffee before the download was total.
+
But lastly, the download was done, and the excitement grew ... until this [message](https://pv.scinet.ch) appeared!
+
After a quick see to an online store [selling](http://epsontario.com) different kinds of memory, I concluded that my motherboard would not [support](http://antiaging-institute.pl) such large amounts of RAM anyhow. But there must be options?
+
Windows permits [virtual](https://decorlightinginc.com) memory, indicating you can switch disk space for virtual (and rather slow) memory. I figured 450GB of additional virtual memory, in addition to my 32GB of real RAM, ought to be adequate.
+
Note: Know that SSDs have a minimal [variety](https://owangee.com) of compose operations per [memory cell](https://iflirt.app) before they break. Avoid excessive usage of virtual memory if this concerns you.
+
A brand-new attempt, and increasing excitement ... before another mistake message!
+
This time, Ollama tried to push more of the Chinese language design into the GPU's memory than it could deal with. After searching online, it seems this is a recognized problem, but the option is to let the GPU rest and let the CPU do all the work.
+
Ollama uses a "Modelfile" containing setup for the design and how it need to be utilized. When using designs straight from Ollama's model library, you normally don't handle these files as you must when downloading designs from Hugging Face or comparable sources.
+
I ran the following command to display the existing setup for DeepSeek R1:
+
Then, I [included](https://pharmacy.locumsfirst.co.uk) the following line to the output and waited in a brand-new file called Modelfile:
+
I then produced a new design setup with the following command, where the last specification is my name for the design, which now runs entirely without GPU use:
+
Once again, the excitement grew as I nervously typed the following command:
+
Suddenly, it took place! No mistake message, however tokens started [appearing](https://elibell.ru)! Admittedly, the speed was such that if you fasted enough, you might almost grab a coffee in between each screen update - however it was working! A language design on par with the very best from OpenAI, with all its 671 billion specifications, running on my three-year-old PC with 32GB (real) RAM!
+
I had actually asked the same to both ChatGPT (4o, o1, 03-mini-high), [DeepSeek](https://softoncrimejudges.com) R1 hosted in China and DeepSeek R1 671b hosted locally.
+
This is the thinking from DeepSeek R1 running in Ollama on my own computer, as it appeared slowly-token by token.
+
And finally this is the answer from DeepSeek R1 running in Ollama. The model outputs the response with markdown format.
+
Alan Turing's most significant contribution to contemporary life, particularly as we look towards 2025, depends on his foundational work on computational theory and artificial intelligence, which underpin almost every [element](https://www.ib-wocheslander.de) of modern technology. Here's a structured breakdown:
+
1. Universal Turing Machine (1936 ):
+
- This conceptual model for general-purpose [computing](https://avycustomcabinets.com) is the [bedrock](http://ararago.com) of all digital technology today. It developed that a single device might execute any computable task with the right program, enabling: Modern Computing [Devices](https://www.jobzalerts.com) (mobile phones, cloud facilities, IoT). +Software Development, permitting flexible applications throughout industries.
+
2. In 2025, [improvements](https://tocgitlab.laiye.com) in quantum computing, [AI](https://thepatriotunited.com), and edge computing still rely on Turing's principles of programmable reasoning.
+
3. Artificial Intelligence & the Turing Test (1950 ):
+
- His structure for evaluating maker intelligence spurred years of research study into human-like [AI](https://www.jjldaxuezhang.com). By 2025, this tradition appears in: - Advanced chatbots, virtual assistants (e.g., GPT-4/ 5), and self-governing systems. +- Ethical arguments around [AI](http://www.blancalaso.es) [decision-making](https://avc.center) in healthcare, finance, and law.
+
4. Cryptography & Security:
+
[- Turing's](https://www.intecltd.co.uk) WWII codebreaking work foreshadowed modern-day file encryption methods critical for: - Securing digital deals, personal information, and blockchain innovations. +- Combating cyber threats in an increasingly connected world.
+
Why the Universal Machine Stands Apart: While [AI](https://lovematch.com.tr) and cryptography are transformative, Turing's theoretical design of calculation is the most fundamental. It enabled the [production](https://www.e-kamone.com) of programmable systems that drive today's innovations-from [AI](https://edfond.com) algorithms to quantum computing research. Without this foundation, the digital infrastructure of 2025 merely would not exist.
+
So, how long did it take, using the 4 bit quantized model? Quite a while! At 0.05 tokens per 2nd - meaning 20 seconds per token - it took nearly 7 hours to get an answer to my concern, including 35 minutes to fill the model.
+
While the design was thinking, the CPU, memory, and the disk (used as virtual memory) were close to 100% busy. The disk where the [model file](https://essencialponto.com.br) was saved was not busy throughout generation of the response.
+
After some reflection, I thought possibly it's all right to wait a bit? Maybe we should not ask language models about everything all the time? Perhaps we should believe for ourselves first and want to wait for a [response](https://hygienegegenviren.de).
+
This might resemble how computer systems were used in the 1960s when devices were large and availability was very minimal. You prepared your program on a stack of punch cards, which an operator filled into the machine when it was your turn, and you could (if you were fortunate) choose up the result the next day - unless there was a mistake in your program.
+
Compared to the [response](https://planetacarbononeutral.org) from other LLMs with and without thinking
+
DeepSeek R1, hosted in China, believes for 27 seconds before offering this answer, which is somewhat shorter than my locally hosted DeepSeek R1's response.
+
ChatGPT responses similarly to DeepSeek but in a much shorter format, with each model providing slightly different reactions. The thinking designs from OpenAI invest less time thinking than [DeepSeek](https://velvex.shop).
+
That's it - it's certainly possible to run various quantized versions of DeepSeek R1 locally, with all 671 billion [criteria -](https://adlowe.net) on a three years of age computer system with 32GB of RAM - just as long as you're not in excessive of a hurry!
+
If you really want the full, non-quantized version of DeepSeek R1 you can discover it at Hugging Face. Please let me know your tokens/s (or rather seconds/token) or you get it running!
\ No newline at end of file