jerryzh168 commited on
Commit
12562be
·
verified ·
1 Parent(s): 3d272da

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +25 -15
README.md CHANGED
@@ -29,22 +29,32 @@ pip install vllm --pre --extra-index-url https://wheels.vllm.ai/nightly
29
  ```Py
30
  from vllm import LLM, SamplingParams
31
 
32
- llm = LLM(model="pytorch/Phi-4-mini-instruct-float8dq", trust_remote_code=True)
33
-
34
- messages = [
35
- {"role": "system", "content": "You are a helpful AI assistant."},
36
- {"role": "user", "content": "Can you provide ways to eat combinations of bananas and dragonfruits?"},
37
- {"role": "assistant", "content": "Sure! Here are some ways to eat bananas and dragonfruits together: 1. Banana and dragonfruit smoothie: Blend bananas and dragonfruits together with some milk and honey. 2. Banana and dragonfruit salad: Mix sliced bananas and dragonfruits together with some lemon juice and honey."},
38
- {"role": "user", "content": "What about solving an 2x + 3 = 7 equation?"},
39
  ]
40
-
41
- sampling_params = SamplingParams(
42
- max_tokens=500,
43
- temperature=0.0,
44
- )
45
-
46
- output = llm.chat(messages=messages, sampling_params=sampling_params)
47
- print(output[0].outputs[0].text)
 
 
 
 
 
 
 
 
 
 
 
48
  ```
49
 
50
  ## Serving
 
29
  ```Py
30
  from vllm import LLM, SamplingParams
31
 
32
+ # Sample prompts.
33
+ prompts = [
34
+ "Hello, my name is",
35
+ "The president of the United States is",
36
+ "The capital of France is",
37
+ "The future of AI is",
 
38
  ]
39
+ # Create a sampling params object.
40
+ sampling_params = SamplingParams(temperature=0.8, top_p=0.95)
41
+
42
+
43
+ if __name__ == '__main__':
44
+ # Create an LLM.
45
+ llm = LLM(model="pytorch/Phi-4-mini-instruct-float8dq")
46
+ # Generate texts from the prompts.
47
+ # The output is a list of RequestOutput objects
48
+ # that contain the prompt, generated text, and other information.
49
+ outputs = llm.generate(prompts, sampling_params)
50
+ # Print the outputs.
51
+ print("\nGenerated Outputs:\n" + "-" * 60)
52
+ for output in outputs:
53
+ prompt = output.prompt
54
+ generated_text = output.outputs[0].text
55
+ print(f"Prompt: {prompt!r}")
56
+ print(f"Output: {generated_text!r}")
57
+ print("-" * 60)
58
  ```
59
 
60
  ## Serving