-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
121 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
apiVersion: llmaz.io/v1alpha1 | ||
kind: Model | ||
metadata: | ||
name: llama3-8b | ||
spec: | ||
familyName: llama3 | ||
dataSource: | ||
name: ModelScope | ||
modelID: LLM-Research/Meta-Llama-3-8B | ||
inferenceFlavors: | ||
- name: t4 # usually refer to the model type | ||
requests: | ||
nvidia.com/gpu: 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
apiVersion: inference.llmaz.io/v1alpha1 | ||
kind: Playground | ||
metadata: | ||
name: llama3-8b | ||
spec: | ||
replicas: 1 | ||
modelClaim: | ||
modelName: llama3-8b |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
""" | ||
Copyright 2024. | ||
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. | ||
""" | ||
|
||
import concurrent.futures | ||
from modelscope import snapshot_download | ||
from loader.model_hub.model_hub import ModelHub, MODEL_LOCAL_DIR | ||
|
||
MODEL_SCOPE = "ModelScope" | ||
MAX_WORKERS = 4 | ||
|
||
|
||
class ModelScope(ModelHub): | ||
@classmethod | ||
def name(cls) -> str: | ||
return MODEL_SCOPE | ||
|
||
@classmethod | ||
def load_model(cls, model_id: str) -> None: | ||
print(f"Start to download model {model_id}") | ||
|
||
with concurrent.futures.ThreadPoolExecutor(max_workers=MAX_WORKERS) as executor: | ||
futures = [] | ||
futures.append( | ||
executor.submit( | ||
snapshot_download, | ||
model_id=model_id, | ||
local_dir=MODEL_LOCAL_DIR, | ||
).add_done_callback(handle_completion) | ||
) | ||
|
||
|
||
def handle_completion(future): | ||
filename = future.result() | ||
print(f"Download completed for {filename}") |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters