-
[AI Model Review] unsloth/DeepSeek-R1-Distill-Qwen-32B 사용 후기경험담/AI 리뷰 2025. 3. 19. 00:21
LLM 계의 강력한 오픈소스 DeepSeek를 리뷰해보고자 한다. 다만, 효율적인 GPU 사용을 위해 파인튜닝된 모델을 사용했고, 약 2-5배 정도 빠르고 70% 정도 메모리를 적게 사용하는 unsloth/DeepSeek-R1-Distill-Qwen-32B를 사용해서 테스트했다.
https://huggingface.co/unsloth/DeepSeek-R1-Distill-Qwen-32B
unsloth/DeepSeek-R1-Distill-Qwen-32B · Hugging Face
This model is not currently available via any of the supported Inference Providers.
huggingface.co
기본적으로 아래와 같이 코드를 실행하면 동작하는데, 상황에 따라 다르겠지만 나의 경우 VRAM을 약 20GB 정도 잡아먹는 것 같다.
import torch from transformers import AutoModelForCausalLM, AutoTokenizer, TextIteratorStreamer from unsloth import FastLanguageModel, is_bfloat16_supported from threading import Thread model_name = "unsloth/DeepSeek-R1-Distill-Qwen-32B" device = "cuda" model, tokenizer = FastLanguageModel.from_pretrained( model_name=model_name, # max_new_tokens=32768, dtype=torch.bfloat16, load_in_4bit=True, # token=hf_token ) # VRAM:20GB messages = [ {"role": "system", "content": "You are a helpful math assistant."}, {"role": "user", "content": "When multiplying a natural number by 84 to obtain the square of a natural number, find the smallest natural number that can be multiplied."} ] input_ids = tokenizer.apply_chat_template( messages, tokenize=True, add_generation_prompt=True, return_tensors="pt" ) FastLanguageModel.for_inference(model) streaming = True if streaming: streamer = TextIteratorStreamer(tokenizer) thread = Thread(target=model.generate, kwargs=dict( input_ids=input_ids.to("cuda"), eos_token_id=tokenizer.eos_token_id, max_new_tokens=32768, do_sample=True, temperature=0.6, top_p=0.95, streamer=streamer )) thread.start() for text in streamer: print(text, end="", flush=True) else: output = model.generate( input_ids.to("cuda"), eos_token_id=tokenizer.eos_token_id, max_new_tokens=32768, do_sample=True, temperature=0.6, top_p=0.95, ) print(tokenizer.decode(output[0]))
해당 코드에서 중학교 수준의 단순한 질문을 던졌다. 84 * x = y^2 이고 y와 x가 모두 자연수일 때 최소의 x는 무엇인지 물었고 그 답변은 아래와 같다.
더보기<|begin▁of▁sentence|>You are a helpful math assistant.<|User|>When multiplying a natural number by 84 to obtain the square of a natural number, find the smallest natural number that can be multiplied.<|Assistant|><think>
Okay, so I need to find the smallest natural number that, when multiplied by 84, gives a perfect square. Hmm, let's break this down step by step.
First, I remember that a perfect square has all its prime factors in even exponents. So, if I can factor 84 into its prime components, I can see what needs to be multiplied to make all exponents even.
Let me factor 84. I know that 84 divided by 2 is 42, divided by 2 again is 21. 21 is 3 times 7. So, putting that all together, 84 is 2 squared times 3 times 7. In exponent form, that's $2^2 \times 3^1 \times 7^1$.
Now, for a number to be a perfect square, each prime factor needs to have an even exponent. Looking at 84's prime factors, the exponents for 2, 3, and 7 are 2, 1, and 1 respectively.
So, the exponent of 2 is already even, which is good. But the exponents for 3 and 7 are both 1, which are odd. To make them even, I need to multiply by another 3 and another 7. That way, the exponents for 3 and 7 become 2 each, which is even.
Therefore, the smallest natural number I need to multiply by 84 is $3 \times 7 = 21$. Let me check that: 84 times 21 is 1764. Is 1764 a perfect square? Let's see, the square root of 1764 is 42, because 42 times 42 is 1764. Yep, that works.
Wait, just to make sure I didn't make any mistakes. Let me go through the steps again.
1. Factor 84: 84 = 2^2 * 3 * 7.
2. Identify the exponents: 2 has exponent 2 (even), 3 has exponent 1 (odd), 7 has exponent 1 (odd).
3. To make all exponents even, I need to multiply by 3 and 7 to make their exponents 2 each.
4. So, multiply by 3*7=21.
5. Check the result: 84*21=1764, which is 42^2.
Everything seems to check out. I don't think I missed anything here. It makes sense because each prime factor needs to have an even exponent in the final product. Since 84 already has 2 squared, which is even, but 3 and 7 are only to the first power, so we need another 3 and another 7.
I wonder, what if I tried a smaller number? Let's say I tried 3. Then, 84*3=252. Is 252 a perfect square? Let's see, sqrt(252) is approximately 15.87, which isn't an integer. So, no, that doesn't work.
How about 6? 84*6=504. sqrt(504) is about 22.45, not an integer. Not a perfect square.
7? 84*7=588. sqrt(588) is approximately 24.24, not an integer.
14? 84*14=1176. sqrt(1176) is about 34.29, not integer.
So, none of these smaller numbers work. 21 is indeed the smallest number that when multiplied by 84 gives a perfect square.
Another way to think about it is that the smallest number needed is the product of the primes with odd exponents in the original number. In this case, 3 and 7. So, 3*7=21.
Yeah, that seems consistent. So, I think 21 is the correct answer.
**Final Answer**
The smallest natural number is \boxed{21}.
</think>
To find the smallest natural number that, when multiplied by 84, gives a perfect square, we start by factoring 84 into its prime components:
$$ 84 = 2^2 \times 3^1 \times 7^1 $$
For a number to be a perfect square, all prime factors must have even exponents. The exponents for 2, 3, and 7 are 2, 1, and 1 respectively. The exponents for 3 and 7 are odd, so we need to multiply by another 3 and 7 to make their exponents even.
Thus, the smallest natural number to multiply by 84 is:
$$ 3 \times 7 = 21 $$
Checking the result, we find that:
$$ 84 \times 21 = 1764 $$
$$ \sqrt{1764} = 42 $$
Since 1764 is a perfect square, the smallest natural number is indeed 21.
$$ \boxed{21} $$<|end▁of▁sentence|>
흥미로운 지점들이 몇개가 있는데, 그 지점들을 모아보면 아래와 같다. 그 외에도 자체적으로 생각하는 포인트들이 있는데, 아래처럼 모든 것을 체크아웃했고 무언가를 놓친 것 같지 않다라는 부분이 자신의 말을 점검하는 것으로보여 리즈닝이 잘 되고 있다는 생각이 든다. 또한, 이미 답을 내놓고도 그 답을 확인하기 위해 샘플로 몇가지를 시도해보기도 하는 부분이 인상깊다.
- Everything seems to check out. I don't think I missed anything here.
- 7? 84*7=588. sqrt(588) is approximately 24.24, not an integer.
14? 84*14=1176. sqrt(1176) is about 34.29, not integer.