Comments (3)
I meet the similar case. Here is my code:
def worker(rank, this_model):
try:
if this_model is None:
client = mii.client('qwen')
else:
client = this_model
response = client.generate(["xxx"], max_new_tokens=1024, stop="<|im_end|>", do_sample=False, return_full_text=True)
print("in worker rank:", rank, " response:", response)
except Exception as e:
print(f"Capture error:{e}")
finally:
print("final")
model = mii.serve(model_dir, deployment_name="qwen", tensor_parallel=xx, replica_num=replica_num)
job_process = []
for rank in range(0, replica_num):
if rank == 0:
job_process.append(threading.Thread(target=worker,args=(rank,model,)))
else:
job_process.append(threading.Thread(target=worker,args=(rank,None,)))
for process in job_process:
process.start()
for process in job_process:
process.join()
When using threading.Thread
, it works well. However, it will be blocked in client.generate
if using multiprocessing.Process
.
from deepspeed-mii.
I meet the similar case. Here is my code:
def worker(rank, this_model): try: if this_model is None: client = mii.client('qwen') else: client = this_model response = client.generate(["xxx"], max_new_tokens=1024, stop="<|im_end|>", do_sample=False, return_full_text=True) print("in worker rank:", rank, " response:", response) except Exception as e: print(f"Capture error:{e}") finally: print("final") model = mii.serve(model_dir, deployment_name="qwen", tensor_parallel=xx, replica_num=replica_num) job_process = [] for rank in range(0, replica_num): if rank == 0: job_process.append(threading.Thread(target=worker,args=(rank,model,))) else: job_process.append(threading.Thread(target=worker,args=(rank,None,))) for process in job_process: process.start() for process in job_process: process.join()
When using
threading.Thread
, it works well. However, it will be blocked inclient.generate
if usingmultiprocessing.Process
.
Since the threading.Thread
is fake in python due to GIL
, this code can not make full use of concurrency. It means that I still need multiprocessing.Process
to start a new client. However, it does not work well mentioned above.
from deepspeed-mii.
I meet the similar case. Here is my code:
def worker(rank, this_model): try: if this_model is None: client = mii.client('qwen') else: client = this_model response = client.generate(["xxx"], max_new_tokens=1024, stop="<|im_end|>", do_sample=False, return_full_text=True) print("in worker rank:", rank, " response:", response) except Exception as e: print(f"Capture error:{e}") finally: print("final") model = mii.serve(model_dir, deployment_name="qwen", tensor_parallel=xx, replica_num=replica_num) job_process = [] for rank in range(0, replica_num): if rank == 0: job_process.append(threading.Thread(target=worker,args=(rank,model,))) else: job_process.append(threading.Thread(target=worker,args=(rank,None,))) for process in job_process: process.start() for process in job_process: process.join()
When using
threading.Thread
, it works well. However, it will be blocked inclient.generate
if usingmultiprocessing.Process
.Since the
threading.Thread
is fake in python due toGIL
, this code can not make full use of concurrency. It means that I still needmultiprocessing.Process
to start a new client. However, it does not work well mentioned above.
I find the official example. Maybe we should start the server and clients like these ways.
from deepspeed-mii.
Related Issues (20)
- how can I use deepspeed to split the model to submit GPU?
- Is openai compatible server still working? HOT 1
- How do I launch the api on a graphics card other than cuda: 0 HOT 1
- How is the prompt segmentation specifically implemented for Dynamic SplitFuse? Is there any code implement or code snippet ?
- [FEATURE] Access to logits and final hidden layer HOT 1
- RuntimeError: The server socket has failed to listen on any local network address HOT 1
- Only running one replica even though setting many replicas
- [Problem]errno: 98 - Address already in use
- Performance with vllm HOT 1
- error when using Qwen1.5-32B
- ValueError: Unsupported model type phi3 HOT 1
- BUG in run_batch_processing
- Cannot run Yi-34B-Chat => ValueError: Unsupported q_ratio: 7 HOT 2
- [REQUEST] Mixtral-8x22B support
- [REQUEST] LLAMA-3 support
- Does deepspeed-mii support prefix_allowed_tokens_fn?
- DeepSpeed-MII 能加载量化的int4或者int8的模型吗?
- Tf32 support
- How can I use the same prompt to produce the same text output as vllm
- Support LLava next stronger
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from deepspeed-mii.