"docs/source/vscode:/vscode.git/clone" did not exist on "d3c1645550a3e4e524a1a51de1f360e73fbd87f4"
Unverified Commit 62a4a339 authored by Xuehai Pan's avatar Xuehai Pan Committed by GitHub
Browse files

docs: fix module docstrings and copyright headers (#2077)

parent 2797bc34
""" # Copyright 2023-2024 SGLang Team
Copyright 2023-2024 SGLang Team # Licensed under the Apache License, Version 2.0 (the "License");
Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License.
you may not use this file except in compliance with the License. # You may obtain a copy of the License at
You may obtain a copy of the License at #
# http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0 #
# Unless required by applicable law or agreed to in writing, software
Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS,
distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and
See the License for the specific language governing permissions and # limitations under the License.
limitations under the License. # ==============================================================================
"""
import json import json
import os import os
......
""" # Copyright 2023-2024 SGLang Team
Copyright 2023-2024 SGLang Team # Licensed under the Apache License, Version 2.0 (the "License");
Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License.
you may not use this file except in compliance with the License. # You may obtain a copy of the License at
You may obtain a copy of the License at #
# http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0 #
# Unless required by applicable law or agreed to in writing, software
Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS,
distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and
See the License for the specific language governing permissions and # limitations under the License.
limitations under the License. # ==============================================================================
"""
# Integrates "S-LoRA: Serving Thousands of Concurrent LoRA Adapters" # Integrates "S-LoRA: Serving Thousands of Concurrent LoRA Adapters"
# and "Punica: Multi-Tenant LoRA Serving" # and "Punica: Multi-Tenant LoRA Serving"
import logging import logging
import re import re
...@@ -146,9 +144,9 @@ class LoRAManager: ...@@ -146,9 +144,9 @@ class LoRAManager:
} }
else: else:
logger.warning( logger.warning(
f"WARNING: get_module_name() is not defined, " "WARNING: get_module_name() is not defined, "
f"which is used to map config module name to model implementation module name." "which is used to map config module name to model implementation module name."
f"Use the default one, but please check if it is correct for your model." "Use the default one, but please check if it is correct for your model."
) )
self.target_modules = { self.target_modules = {
get_module_name(module) for module in self.origin_target_modules get_module_name(module) for module in self.origin_target_modules
...@@ -194,9 +192,9 @@ class LoRAManager: ...@@ -194,9 +192,9 @@ class LoRAManager:
hidden_dim_A, _ = self.base_model.get_hidden_dim(module_A) hidden_dim_A, _ = self.base_model.get_hidden_dim(module_A)
else: else:
logger.warning( logger.warning(
f"WARNING: get_hidden_dim() is not defined, " "WARNING: get_hidden_dim() is not defined, "
f"which is used to get the hidden dim for different lora modules" "which is used to get the hidden dim for different lora modules"
f"Use the default one, but please check if it is correct for your model." "Use the default one, but please check if it is correct for your model."
) )
hidden_dim_A, _ = get_hidden_dim(module_A, self.base_hf_config) hidden_dim_A, _ = get_hidden_dim(module_A, self.base_hf_config)
c = self.loras[-1].get_stacked_multiply(module_A) c = self.loras[-1].get_stacked_multiply(module_A)
...@@ -218,9 +216,9 @@ class LoRAManager: ...@@ -218,9 +216,9 @@ class LoRAManager:
_, hidden_dim_B = self.base_model.get_hidden_dim(module_B) _, hidden_dim_B = self.base_model.get_hidden_dim(module_B)
else: else:
logger.warning( logger.warning(
f"WARNING: get_hidden_dim() is not defined, " "WARNING: get_hidden_dim() is not defined, "
f"which is used to get the hidden dim for different lora modules" "which is used to get the hidden dim for different lora modules"
f"Use the default one, but please check if it is correct for your model." "Use the default one, but please check if it is correct for your model."
) )
_, hidden_dim_B = get_hidden_dim(module_B, self.base_hf_config) _, hidden_dim_B = get_hidden_dim(module_B, self.base_hf_config)
c = self.loras[-1].get_stacked_multiply(module_B) c = self.loras[-1].get_stacked_multiply(module_B)
......
""" # Copyright 2023-2024 SGLang Team
Copyright 2023-2024 SGLang Team # Licensed under the Apache License, Version 2.0 (the "License");
Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License.
you may not use this file except in compliance with the License. # You may obtain a copy of the License at
You may obtain a copy of the License at #
# http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0 #
# Unless required by applicable law or agreed to in writing, software
Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS,
distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and
See the License for the specific language governing permissions and # limitations under the License.
limitations under the License. # ==============================================================================
"""
"""A controller that dispatches requests to multiple data parallel workers.""" """A controller that dispatches requests to multiple data parallel workers."""
import logging import logging
......
""" # Copyright 2023-2024 SGLang Team
Copyright 2023-2024 SGLang Team # Licensed under the Apache License, Version 2.0 (the "License");
Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License.
you may not use this file except in compliance with the License. # You may obtain a copy of the License at
You may obtain a copy of the License at #
# http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0 #
# Unless required by applicable law or agreed to in writing, software
Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS,
distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and
See the License for the specific language governing permissions and # limitations under the License.
limitations under the License. # ==============================================================================
"""
"""DetokenizerManager is a process that detokenizes the token ids.""" """DetokenizerManager is a process that detokenizes the token ids."""
import dataclasses import dataclasses
......
""" # Copyright 2023-2024 SGLang Team
Copyright 2023-2024 SGLang Team # Licensed under the Apache License, Version 2.0 (the "License");
Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License.
you may not use this file except in compliance with the License. # You may obtain a copy of the License at
You may obtain a copy of the License at #
# http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0 #
# Unless required by applicable law or agreed to in writing, software
Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS,
distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and
See the License for the specific language governing permissions and # limitations under the License.
limitations under the License. # ==============================================================================
"""
""" """
The definition of objects transfered between different The definition of objects transfered between different
processes (TokenizerManager, DetokenizerManager, Controller). processes (TokenizerManager, DetokenizerManager, Controller).
......
""" # Copyright 2023-2024 SGLang Team
Copyright 2023-2024 SGLang Team # Licensed under the Apache License, Version 2.0 (the "License");
Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License.
you may not use this file except in compliance with the License. # You may obtain a copy of the License at
You may obtain a copy of the License at #
# http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0 #
# Unless required by applicable law or agreed to in writing, software
Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS,
distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and
See the License for the specific language governing permissions and # limitations under the License.
limitations under the License. # ==============================================================================
"""
""" """
Store information about requests and batches. Store information about requests and batches.
......
""" # Copyright 2023-2024 SGLang Team
Copyright 2023-2024 SGLang Team # Licensed under the Apache License, Version 2.0 (the "License");
Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License.
you may not use this file except in compliance with the License. # You may obtain a copy of the License at
You may obtain a copy of the License at #
# http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0 #
# Unless required by applicable law or agreed to in writing, software
Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS,
distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and
See the License for the specific language governing permissions and # limitations under the License.
limitations under the License. # ==============================================================================
"""
"""Request scheduler policy""" """Request scheduler policy"""
import os import os
......
""" # Copyright 2023-2024 SGLang Team
Copyright 2023-2024 SGLang Team # Licensed under the Apache License, Version 2.0 (the "License");
Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License.
you may not use this file except in compliance with the License. # You may obtain a copy of the License at
You may obtain a copy of the License at #
# http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0 #
# Unless required by applicable law or agreed to in writing, software
Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS,
distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and
See the License for the specific language governing permissions and # limitations under the License.
limitations under the License. # ==============================================================================
"""
"""A scheduler that manages a tensor parallel GPU worker.""" """A scheduler that manages a tensor parallel GPU worker."""
import dataclasses import dataclasses
......
""" # Copyright 2023-2024 SGLang Team
Copyright 2023-2024 SGLang Team # Licensed under the Apache License, Version 2.0 (the "License");
Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License.
you may not use this file except in compliance with the License. # You may obtain a copy of the License at
You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, software
Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS,
distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and
See the License for the specific language governing permissions and # limitations under the License.
limitations under the License. # ==============================================================================
"""
import copy import copy
import uuid import uuid
......
""" # Copyright 2023-2024 SGLang Team
Copyright 2023-2024 SGLang Team # Licensed under the Apache License, Version 2.0 (the "License");
Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License.
you may not use this file except in compliance with the License. # You may obtain a copy of the License at
You may obtain a copy of the License at #
# http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0 #
# Unless required by applicable law or agreed to in writing, software
Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS,
distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and
See the License for the specific language governing permissions and # limitations under the License.
limitations under the License. # ==============================================================================
"""
"""TokenizerManager is a process that tokenizes the text.""" """TokenizerManager is a process that tokenizes the text."""
import asyncio import asyncio
......
""" # Copyright 2023-2024 SGLang Team
Copyright 2023-2024 SGLang Team # Licensed under the Apache License, Version 2.0 (the "License");
Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License.
you may not use this file except in compliance with the License. # You may obtain a copy of the License at
You may obtain a copy of the License at #
# http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0 #
# Unless required by applicable law or agreed to in writing, software
Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS,
distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and
See the License for the specific language governing permissions and # limitations under the License.
limitations under the License. # ==============================================================================
"""
"""A tensor parallel worker.""" """A tensor parallel worker."""
import logging import logging
......
""" # Copyright 2023-2024 SGLang Team
Copyright 2023-2024 SGLang Team # Licensed under the Apache License, Version 2.0 (the "License");
Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License.
you may not use this file except in compliance with the License. # You may obtain a copy of the License at
You may obtain a copy of the License at #
# http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0 #
# Unless required by applicable law or agreed to in writing, software
Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS,
distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and
See the License for the specific language governing permissions and # limitations under the License.
limitations under the License. # ==============================================================================
"""
"""A tensor parallel worker.""" """A tensor parallel worker."""
import dataclasses import dataclasses
......
""" # Copyright 2023-2024 SGLang Team
Copyright 2023-2024 SGLang Team # Licensed under the Apache License, Version 2.0 (the "License");
Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License.
you may not use this file except in compliance with the License. # You may obtain a copy of the License at
You may obtain a copy of the License at #
# http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0 #
# Unless required by applicable law or agreed to in writing, software
Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS,
distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and
See the License for the specific language governing permissions and # limitations under the License.
limitations under the License. # ==============================================================================
"""
"""Utilities for Prometheus Metrics Collection.""" """Utilities for Prometheus Metrics Collection."""
from dataclasses import dataclass from dataclasses import dataclass
......
""" # Copyright 2023-2024 SGLang Team
Copyright 2023-2024 SGLang Team # Licensed under the Apache License, Version 2.0 (the "License");
Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License.
you may not use this file except in compliance with the License. # You may obtain a copy of the License at
You may obtain a copy of the License at #
# http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0 #
# Unless required by applicable law or agreed to in writing, software
Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS,
distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and
See the License for the specific language governing permissions and # limitations under the License.
limitations under the License. # ==============================================================================
"""
""" """
Records the latency of some functions Records the latency of some functions
""" """
......
""" # Copyright 2023-2024 SGLang Team
Copyright 2023-2024 SGLang Team # Licensed under the Apache License, Version 2.0 (the "License");
Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License.
you may not use this file except in compliance with the License. # You may obtain a copy of the License at
You may obtain a copy of the License at #
# http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0 #
# Unless required by applicable law or agreed to in writing, software
Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS,
distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and
See the License for the specific language governing permissions and # limitations under the License.
limitations under the License. # ==============================================================================
"""
# Source: https://github.com/LLaVA-VL/LLaVA-NeXT/blob/main/llava/mm_utils.py # Source: https://github.com/LLaVA-VL/LLaVA-NeXT/blob/main/llava/mm_utils.py
""" """
......
from __future__ import annotations # Copyright 2023-2024 SGLang Team
# Licensed under the Apache License, Version 2.0 (the "License");
""" # you may not use this file except in compliance with the License.
Copyright 2023-2024 SGLang Team # You may obtain a copy of the License at
Licensed under the Apache License, Version 2.0 (the "License"); #
you may not use this file except in compliance with the License. # http://www.apache.org/licenses/LICENSE-2.0
You may obtain a copy of the License at #
# Unless required by applicable law or agreed to in writing, software
http://www.apache.org/licenses/LICENSE-2.0 # distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Unless required by applicable law or agreed to in writing, software # See the License for the specific language governing permissions and
distributed under the License is distributed on an "AS IS" BASIS, # limitations under the License.
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.
"""
"""Run the model with cuda graph and torch.compile.""" """Run the model with cuda graph and torch.compile."""
from __future__ import annotations
import bisect import bisect
from contextlib import contextmanager from contextlib import contextmanager
from typing import TYPE_CHECKING, Callable from typing import TYPE_CHECKING, Callable
......
from __future__ import annotations # Copyright 2023-2024 SGLang Team
# Licensed under the Apache License, Version 2.0 (the "License");
""" # you may not use this file except in compliance with the License.
Copyright 2023-2024 SGLang Team # You may obtain a copy of the License at
Licensed under the Apache License, Version 2.0 (the "License"); #
you may not use this file except in compliance with the License. # http://www.apache.org/licenses/LICENSE-2.0
You may obtain a copy of the License at #
# Unless required by applicable law or agreed to in writing, software
http://www.apache.org/licenses/LICENSE-2.0 # distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Unless required by applicable law or agreed to in writing, software # See the License for the specific language governing permissions and
distributed under the License is distributed on an "AS IS" BASIS, # limitations under the License.
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.
"""
""" """
Store information about a forward batch. Store information about a forward batch.
...@@ -31,6 +27,8 @@ ScheduleBatch -> ModelWorkerBatch -> ForwardBatch ...@@ -31,6 +27,8 @@ ScheduleBatch -> ModelWorkerBatch -> ForwardBatch
It contains low-level tensor data. Most of the data consists of GPU tensors. It contains low-level tensor data. Most of the data consists of GPU tensors.
""" """
from __future__ import annotations
from dataclasses import dataclass from dataclasses import dataclass
from enum import IntEnum, auto from enum import IntEnum, auto
from typing import TYPE_CHECKING, List, Optional from typing import TYPE_CHECKING, List, Optional
......
""" # Copyright 2023-2024 SGLang Team
Copyright 2023-2024 SGLang Team # Licensed under the Apache License, Version 2.0 (the "License");
Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License.
you may not use this file except in compliance with the License. # You may obtain a copy of the License at
You may obtain a copy of the License at #
# http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0 #
# Unless required by applicable law or agreed to in writing, software
Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS,
distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and
See the License for the specific language governing permissions and # limitations under the License.
limitations under the License. # ==============================================================================
"""
"""ModelRunner runs the forward passes of the models.""" """ModelRunner runs the forward passes of the models."""
import gc import gc
......
""" # Copyright 2023-2024 SGLang Team
Copyright 2023-2024 SGLang Team # Licensed under the Apache License, Version 2.0 (the "License");
Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License.
you may not use this file except in compliance with the License. # You may obtain a copy of the License at
You may obtain a copy of the License at #
# http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0 #
# Unless required by applicable law or agreed to in writing, software
Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS,
distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and
See the License for the specific language governing permissions and # limitations under the License.
limitations under the License. # ==============================================================================
"""
# coding=utf-8
# Adapted from # Adapted from
# https://github.com/THUDM/ChatGLM2-6B # https://github.com/THUDM/ChatGLM2-6B
"""Inference-only ChatGLM model compatible with THUDM weights.""" """Inference-only ChatGLM model compatible with THUDM weights."""
from typing import Iterable, Optional, Tuple from typing import Iterable, Optional, Tuple
import torch import torch
......
""" # Copyright 2023-2024 SGLang Team
Copyright 2023-2024 SGLang Team # Licensed under the Apache License, Version 2.0 (the "License");
Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License.
you may not use this file except in compliance with the License. # You may obtain a copy of the License at
You may obtain a copy of the License at #
# http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0 #
# Unless required by applicable law or agreed to in writing, software
Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS,
distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and
See the License for the specific language governing permissions and # limitations under the License.
limitations under the License. # ==============================================================================
"""
# coding=utf-8
# Copyright 2024 Cohere and the HuggingFace Inc. team. All rights reserved. # Copyright 2024 Cohere and the HuggingFace Inc. team. All rights reserved.
# #
# This code is based on EleutherAI's GPT-NeoX library and the GPT-NeoX # This code is based on EleutherAI's GPT-NeoX library and the GPT-NeoX
...@@ -32,12 +29,14 @@ limitations under the License. ...@@ -32,12 +29,14 @@ limitations under the License.
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
# ==============================================================================
# Adapted from # Adapted from
# https://github.com/vllm-project/vllm/blob/c7f2cf2b7f67bce5842fedfdba508440fe257375/vllm/model_executor/models/commandr.py#L1 # https://github.com/vllm-project/vllm/blob/c7f2cf2b7f67bce5842fedfdba508440fe257375/vllm/model_executor/models/commandr.py#L1
# This file is based on the LLama model definition file in transformers # This file is based on the LLama model definition file in transformers
"""PyTorch Cohere model.""" """PyTorch Cohere model."""
from typing import Iterable, Optional, Tuple from typing import Iterable, Optional, Tuple
import torch import torch
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment