mirror of
https://github.com/hpcaitech/ColossalAI.git
synced 2025-09-08 12:30:42 +00:00
[Inference] ADD async and sync Api server using FastAPI (#5396)
* add api server * fix * add * add completion service and fix bug * add generation config * revise shardformer * fix bugs * add docstrings and fix some bugs * fix bugs and add choices for prompt template
This commit is contained in:
16
colossalai/inference/server/utils.py
Normal file
16
colossalai/inference/server/utils.py
Normal file
@@ -0,0 +1,16 @@
|
||||
# make it singleton
|
||||
class NumericIDGenerator:
|
||||
_instance = None
|
||||
|
||||
def __new__(cls):
|
||||
if cls._instance is None:
|
||||
cls._instance = super(NumericIDGenerator, cls).__new__(cls)
|
||||
cls._instance.current_id = 0
|
||||
return cls._instance
|
||||
|
||||
def __call__(self):
|
||||
self.current_id += 1
|
||||
return self.current_id
|
||||
|
||||
|
||||
id_generator = NumericIDGenerator()
|
Reference in New Issue
Block a user