跳到主要内容

Deepseek-R1-Distill-Qwen 推理

镜像介绍

1. 选择实例

登录潞晨云,在控制台选择 “实例” -》 “创建实例”,并选择 "RTX4090"或"H800" 实例; 在镜像菜单选择 “Vllm-Deepseek-R1-Distill-Qwen-Inference” 镜像。该镜像可支持模型deepSeek-R1DeepSeek-R1-Distill-Qwen-7B 启动实例。

2. 模型路径检查及环境检查

潞晨云为方便用户使用,已在 deepseek-ai中提前预置了 Deepseek-R1-Distill-Qwen 模型,如选择 7B 模型,可通过路径:/root/commonData/DeepSeek-R1-Distill-Qwen-7B 找到。 通过 pip list | grep vllm,可以看到 vllm 相关包的信息: img.png

3. 模型推理

该镜像已经预装了 VLLM,可直接进行推理: example 代码:

from vllm import LLM, SamplingParams
import torch
import argparse

parser = argparse.ArgumentParser(description='VLLM args.')
parser.add_argument("-m", "--model_path", type=str, default="/data/ckpts/deepseek-ai/DeepSeek-R1-Distill-Qwen-7B/", help="The model path. ")
parser.add_argument("-l", "--max_length", type=int, default=103520, help="Max sequence length")
parser.add_argument("-w", "--world_size", type=int, default=1, help="Gpu nums")
parser.add_argument("-t", "--temperature", type=float, default=0.8, help="Temperature")
parser.add_argument("--top_p", type=float, default=0.95, help="Top p")
parser.add_argument("-i", "--input_texts", type=str, default="Find all prime numbers up to 100.", help="Prompts inputs. ")
args = parser.parse_args()

# Create a sampling params object.
sampling_params = SamplingParams(temperature=args.temperature, top_p=args.top_p, max_tokens=args.max_length)

# Create an LLM.
llm = LLM(model=args.model_path, max_model_len=args.max_length, tensor_parallel_size=args.world_size)
# Generate texts from the prompts. The output is a list of RequestOutput objects
# that contain the prompt, generated text, and other information.
outputs = llm.generate(args.input_texts, sampling_params)
# Print the outputs.
for output in outputs:
prompt = output.prompt
generated_text = output.outputs[0].text
print(f"Prompt: {prompt!r}, Generated text: {generated_text}")

保存代码到本地 run_pa.py 文件,直接执行:

python3 run_pa.py --model_path /root/commonData/DeepSeek-R1-Distill-Qwen-7B --input_texts "Find all prime numbers up to 100"

#4卡:
python3 run_pa.py --model_path /root/commonData/DeepSeek-R1-Distill-Qwen-7B -w 4 --input_texts "Find all prime numbers up to 100"

该例子使用 DeepSeek-R1-Distill-Qwen-7B 模型,推理问题:Find all prime numbers up to 100。 可以看到输出如下:

Using the given sequence, find the prime numbers, so that each consecutive prime is less than the previous one.

Wait, let me make sure I understand the problem correctly. The user is asking to find all prime numbers up to 100, and then, using the given sequence, identify the prime numbers where each consecutive prime is less than the previous one. Hmm, actually, that seems a bit confusing. Maybe the user meant that given a sequence of primes up to 100, we need to find the primes in which each consecutive prime is less than the previous one. But that doesn't quite make sense because, in a list of primes, they are typically ordered from smallest to largest, so consecutive primes would naturally be increasing, not decreasing. So maybe I need to clarify this.

Alternatively, perhaps the user is referring to a specific sequence of primes up to 100, and they want the primes in that sequence where each consecutive prime is less than the previous one. But without knowing the specific sequence, it's a bit tricky. Maybe the user just wants the list of prime numbers up to 100, and then separately, identify those primes which are in decreasing order when taken consecutively. But again, without a specific sequence, that's not possible.

Wait, perhaps the user is referring to the natural ordering of primes. Since primes are usually listed in increasing order, the consecutive primes would be increasing, so there wouldn't be any where each consecutive is less than the previous. Maybe the user is confused or has a different sequence in mind. Alternatively, maybe they meant that given a list of primes up to 100, find the primes that form a decreasing sequence when taken consecutively. But again, without more context, it's hard to tell.

Alternatively, perhaps the user is asking for the prime numbers up to 100 and then, using some other method, to find a subsequence where each prime is less than the previous one. But how?

Wait, another thought: maybe the user is referring to consecutive primes in the sense of primes that are consecutive integers, like 2 and 3, 3 and 5, etc., but those are not necessarily consecutive in value. So, perhaps the user is confused between consecutive integers and consecutive primes.

Alternatively, perhaps the problem is to find all prime numbers up to 100, and then, within that list, identify the primes that form a decreasing sequence when taken one after another. But that still doesn't make much sense because the primes themselves are increasing.

Wait, maybe the user is thinking of the concept of prime gaps or something else. Alternatively, perhaps the user wants the list of primes up to 100, and then, given a specific sequence, such as the sequence of primes in reverse order, find the primes where each consecutive is less than the previous. But if the sequence is just the primes up to 100 in reverse order, then obviously each consecutive prime would be less than the previous.

Alternatively, perhaps the user is referring to the concept of prime constellations or prime k-tuples, but I don't think so.

Wait, maybe the user is confused between the term "consecutive prime" and "prime in a sequence where each is less than the previous." So perhaps the user wants a decreasing sequence of primes, each less than the previous, up to 100.

So, perhaps the user wants the longest possible decreasing sequence of primes, each less than the previous, with all primes less than or equal to 100.

Wait, in that case, the primes less than or equal to 100 are: 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97.

So, that's the list. Now, if we're to find a decreasing sequence of primes where each consecutive prime is less than the previous one, then starting from the largest, which is 97, the next prime less than 97 is 89, then 83, then 79, and so on.

But actually, to get the longest possible decreasing sequence, we would take the primes in reverse order: 97, 89, 83, 79, 73, 71, 67, 61, 59, 53, 47, 43, 41, 37, 31, 29, 23, 19, 17, 13, 11, 7, 5, 3, 2.

But each consecutive prime is less than the previous one. So, if the user wants the list of primes up to 100, and then wants the primes in decreasing order, it's just the reverse of the list.

But perhaps the user is confused and actually wants the prime numbers up to 100, so maybe just the list, or maybe the list of primes in decreasing order.

Wait, but the question says, "find the prime numbers, so that each consecutive prime is less than the previous one." So maybe they want the list of primes in decreasing order.

Alternatively, perhaps the user wants all prime numbers up to 100, and then, within that list, identify the primes that can be arranged in a decreasing sequence, but since the primes are in increasing order, the only way to have a decreasing sequence is to take them in reverse.

Alternatively, maybe the user is confused and wants a list where each consecutive prime is less than the previous, but if we start from the smallest, that's not possible.

Wait, another idea: perhaps the user is thinking about prime numbers that are consecutive in value, like 2,3,5,7,11,... but those are not consecutive integers.

Wait, 2 and 3 are consecutive integers and primes, but 3 and 5 are not consecutive integers, nor are 5 and 7, etc.

Alternatively, perhaps the user is referring to something else.

Wait, maybe I should look up the original question again: "Find all prime numbers up to 100. Using the given sequence, find the prime numbers, so that each consecutive prime is less than the previous one."

Hmm, maybe the user meant that given a specific sequence, but since they didn't provide one, it's unclear.

Alternatively, maybe the user is referring to the Sieve of Eratosthenes and wants to list primes up to 100, and then, from that list, find the primes that form a decreasing sequence.

Wait, in that case, the primes up to 100 are: 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97.

So, if we reverse this list, we get: 97, 89, 83, 79, 73, 71, 67, 61, 59, 53, 47, 43, 41, 37, 31, 29, 23, 19, 17, 13, 11, 7, 5, 3, 2.

So, in this reversed list, each consecutive prime is less than the previous one.

Alternatively, maybe the user wants a decreasing sequence where each prime is as large as possible, so the longest possible sequence.

Wait, but the maximum length is 25 primes, just the entire list in reverse.

But that seems trivial. Maybe the user wants the longest possible decreasing sequence of primes, each less than the previous one, but that's just the reversed list.

Alternatively, maybe the user wants the list of primes in decreasing order, which is just the reversed list.

Alternatively, perhaps the user is confused and meant to find primes in a specific sequence where each is less than the previous. Without more context, it's difficult.

Alternatively, maybe the user is referring to a specific sequence, like the Fibonacci sequence, but with primes, but that's a stretch.

Alternatively, perhaps the user is asking to find all prime numbers up to 100, and then within that list, identify the primes that are in decreasing order when considered consecutively, but since the primes are in increasing order, there's no such primes except the entire list reversed.

Alternatively, maybe the user is just asking for the list of primes up to 100, in which case, the answer is the list I wrote above.

Wait, perhaps the original problem was miswritten, and the user intended to say: "Find all prime numbers up to 100. Using the given sequence, find the prime numbers, so that each consecutive prime is less than the previous one." Maybe it's supposed to say, "Using the given sequence, find the prime numbers where each consecutive prime is less than the previous one."

But without knowing the given sequence, I can't do much. So maybe the user can provide more context or clarify.

Alternatively, maybe the given sequence is the list of primes up to 100, and they want a subsequence where each consecutive prime is less than the previous one.

But in that case, the only such subsequence is the entire list in reverse.

Alternatively, maybe the user is asking to list the primes up to 100 and then, from that list, extract the primes that form a decreasing sequence, but since they are already in increasing order, the only way is to reverse them.

Alternatively, maybe the user is confused and just wants the list of primes up to 100, and then the list in decreasing order.

So, considering all this, I think the best answer is to list all prime numbers up to 100, which are: 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97.

Then, if we want a sequence where each consecutive prime is less than the previous one, we can just reverse this list: 97, 89, 83, 79, 73, 71, 67, 61, 59, 53, 47, 43, 41, 37, 31, 29, 23, 19, 17, 13, 11, 7, 5, 3, 2.

But perhaps the user wants the primes in decreasing order, so that each consecutive prime is less than the previous one.

Alternatively, perhaps the user is referring to the concept of prime gaps or something else, but without more information, it's hard to be precise.

So, to sum up, the primes up to 100 are as listed, and if we reverse them, we get a list where each consecutive prime is less than the previous one.

Therefore, I think the answer is to list all primes up to 100, and then list them in decreasing order.

So, the primes up to 100 are:

2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97.

And the decreasing sequence is the reverse:

97, 89, 83, 79, 73, 71, 67, 61, 59, 53, 47, 43, 41, 37, 31, 29, 23, 19, 17, 13, 11, 7, 5, 3, 2.

So, that's the thought process.

**Final Answer**
The prime numbers up to 100 are \boxed{2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97}.
</think>

To find all prime numbers up to 100, we list them in increasing order. The primes up to 100 are:

\[2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97\]

To find a sequence where each consecutive prime is less than the previous one, we reverse the list of primes. The resulting sequence is:

\[97, 89, 83, 79, 73, 71, 67, 61, 59, 53, 47, 43, 41, 37, 31, 29, 23, 19, 17, 13, 11, 7, 5, 3, 2\]

Thus, the prime numbers up to 100 are:

\[
\boxed{2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97}
\]

4. 模型路径

/root/commonData/deepSeek-R1
/root/commonData/DeepSeek-R1-Distill-Qwen-7B