-
Notifications
You must be signed in to change notification settings - Fork 55
/
Copy patharch.py
55 lines (52 loc) · 1.91 KB
/
arch.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# ===----------------------------------------------------------------------=== #
# Copyright (c) 2024, Modular Inc. All rights reserved.
#
# Licensed under the Apache License v2.0 with LLVM Exceptions:
# https://llvm.org/LICENSE.txt
#
# 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 max.pipelines import (
HuggingFaceFile,
SupportedArchitecture,
SupportedEncoding,
SupportedVersion,
TextTokenizer,
WeightsFormat,
)
from max.pipelines.kv_cache import KVCacheStrategy
from .model import MistralModel
mistral_arch = SupportedArchitecture(
name="MistralForCausalLM",
versions=[
SupportedVersion(
name="default",
encodings={
SupportedEncoding.bfloat16: (
[
HuggingFaceFile(
"mistralai/Mistral-Nemo-Instruct-2407", f
)
for f in [
"model-00001-of-00005.safetensors",
"model-00002-of-00005.safetensors",
"model-00003-of-00005.safetensors",
"model-00004-of-00005.safetensors",
"model-00005-of-00005.safetensors",
]
],
[KVCacheStrategy.CONTINUOUS],
)
},
default_encoding=SupportedEncoding.bfloat16,
)
],
default_version="default",
pipeline_model=MistralModel,
tokenizer=TextTokenizer,
default_weights_format=WeightsFormat.safetensors,
)