Skip to content

Commit

Permalink
add stubs for models
Browse files Browse the repository at this point in the history
  • Loading branch information
goliaro committed Jul 21, 2023
1 parent 42b6081 commit b88d85f
Show file tree
Hide file tree
Showing 6 changed files with 80 additions and 8 deletions.
2 changes: 1 addition & 1 deletion python/flexflow/serve/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from .serve import LLM, SamplingConfig
from .serve import LLM, SamplingConfig
17 changes: 17 additions & 0 deletions python/flexflow/serve/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright 2023 CMU, Facebook, LANL, MIT, NVIDIA, and Stanford (alphabetical)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from .llama import FlexFlowLLAMA
from .opt import FlexFlowOPT
from .falcon import FlexFlowFalcon
19 changes: 19 additions & 0 deletions python/flexflow/serve/models/falcon.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright 2023 CMU, Facebook, LANL, MIT, NVIDIA, and Stanford (alphabetical)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from flexflow.core import *

class FlexFlowFalcon:
def __init__(self):
pass
19 changes: 19 additions & 0 deletions python/flexflow/serve/models/llama.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright 2023 CMU, Facebook, LANL, MIT, NVIDIA, and Stanford (alphabetical)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from flexflow.core import *

class FlexFlowLLAMA:
def __init__(self):
pass
19 changes: 19 additions & 0 deletions python/flexflow/serve/models/opt.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright 2023 CMU, Facebook, LANL, MIT, NVIDIA, and Stanford (alphabetical)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from flexflow.core import *

class FlexFlowOPT:
def __init__(self):
pass
12 changes: 5 additions & 7 deletions python/flexflow/serve/serve.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from flexflow.core import *
from flexflow.serve.models import FlexFlowLLAMA, FlexFlowOPT, FlexFlowFalcon
from transformers import AutoConfig
import sys

Expand All @@ -26,16 +26,14 @@ class LLM:
def __init__(self, model_name, data_type="half"):
self.model_name = model_name
self.supported_models = {
"LlamaForCausalLM": 'placeholder',
"LLaMAForCausalLM": 'placeholder',
"OPTForCausalLM": 'placeholder',
"RWForCausalLM": 'placeholder' # falcon
"LlamaForCausalLM": FlexFlowLLAMA,
"LLaMAForCausalLM": FlexFlowLLAMA,
"OPTForCausalLM": FlexFlowOPT,
"RWForCausalLM": FlexFlowFalcon # falcon
}
self.model_type = self.__get_ff_model_type(model_name)
self.data_type = data_type
self.default_config = SamplingConfig()

self.ffconfig = FFConfig()

def __get_ff_model_type(self, model_name):
hf_config = AutoConfig.from_pretrained(model_name)
Expand Down

0 comments on commit b88d85f

Please sign in to comment.