Skip to content

Commit

Permalink
DOC: Autogen model spec (#752)
Browse files Browse the repository at this point in the history
  • Loading branch information
onesuper authored Dec 12, 2023
1 parent 3dd3bb1 commit cda4f22
Show file tree
Hide file tree
Showing 89 changed files with 1,662 additions and 1,229 deletions.
83 changes: 83 additions & 0 deletions doc/source/gen_docs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# Copyright 2022-2023 XProbe Inc.
#
# 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 json
import os
from jinja2 import Environment, FileSystemLoader


def main():
template_dir = '../templates'
env = Environment(loader=FileSystemLoader(template_dir))

with open('../../xinference/model/llm/llm_family.json', 'r') as file:
models = json.load(file)

sorted_models = sorted(models, key=lambda x: x['model_name'].lower())
output_dir = './models/builtin/llm'
os.makedirs(output_dir, exist_ok=True)

for model in sorted_models:
rendered = env.get_template('llm.rst.jinja').render(model)
output_file_path = os.path.join(output_dir, f"{model['model_name'].lower()}.rst")
with open(output_file_path, 'w') as output_file:
output_file.write(rendered)

index_file_path = os.path.join(output_dir, "index.rst")
with open(index_file_path, "w") as file:

rendered_index = env.get_template('llm_index.rst.jinja').render(models=sorted_models)
file.write(rendered_index)


with open('../../xinference/model/embedding/model_spec.json', 'r') as file:
models = json.load(file)

sorted_models = sorted(models, key=lambda x: x['model_name'].lower())
output_dir = './models/builtin/embedding'
os.makedirs(output_dir, exist_ok=True)

for model in sorted_models:
rendered = env.get_template('embedding.rst.jinja').render(model)
output_file_path = os.path.join(output_dir, f"{model['model_name'].lower()}.rst")
with open(output_file_path, 'w') as output_file:
output_file.write(rendered)

index_file_path = os.path.join(output_dir, "index.rst")
with open(index_file_path, "w") as file:

rendered_index = env.get_template('embedding_index.rst.jinja').render(models=sorted_models)
file.write(rendered_index)

with open('../../xinference/model/rerank/model_spec.json', 'r') as file:
models = json.load(file)

sorted_models = sorted(models, key=lambda x: x['model_name'].lower())
output_dir = './models/builtin/rerank'
os.makedirs(output_dir, exist_ok=True)

for model in sorted_models:
rendered = env.get_template('rerank.rst.jinja').render(model)
output_file_path = os.path.join(output_dir, f"{model['model_name'].lower()}.rst")
with open(output_file_path, 'w') as output_file:
output_file.write(rendered)

index_file_path = os.path.join(output_dir, "index.rst")
with open(index_file_path, "w") as file:

rendered_index = env.get_template('rerank_index.rst.jinja').render(models=sorted_models)
file.write(rendered_index)

if __name__ == "__main__":
main()
33 changes: 0 additions & 33 deletions doc/source/models/builtin/Yi-chat.rst

This file was deleted.

67 changes: 0 additions & 67 deletions doc/source/models/builtin/code-llama-instruct.rst

This file was deleted.

65 changes: 0 additions & 65 deletions doc/source/models/builtin/code-llama-python.rst

This file was deleted.

64 changes: 0 additions & 64 deletions doc/source/models/builtin/code-llama.rst

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.. _models_builtin_bge_base_en_v1.5:
.. _models_builtin_bge-base-en-v1.5:

================
bge-base-en-v1.5
Expand All @@ -17,5 +17,4 @@ Specifications

Execute the following command to launch the model::

xinference launch --model-name bge-base-en-v1.5 --model-type embedding

xinference launch --model-name bge-base-en-v1.5 --model-type embedding
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.. _models_builtin_bge_base_en:
.. _models_builtin_bge-base-en:

===========
bge-base-en
Expand All @@ -17,6 +17,4 @@ Specifications

Execute the following command to launch the model::

xinference launch --model-name bge-base-en --model-type embedding


xinference launch --model-name bge-base-en --model-type embedding
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.. _models_builtin_bge_base_zh_v1.5:
.. _models_builtin_bge-base-zh-v1.5:

================
bge-base-zh-v1.5
Expand All @@ -17,5 +17,4 @@ Specifications

Execute the following command to launch the model::

xinference launch --model-name bge-base-zh-v1.5 --model-type embedding

xinference launch --model-name bge-base-zh-v1.5 --model-type embedding
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.. _models_builtin_bge_base_zh:
.. _models_builtin_bge-base-zh:

===========
bge-base-zh
Expand All @@ -11,11 +11,10 @@ bge-base-zh
Specifications
^^^^^^^^^^^^^^

- **Dimensions:** 1024
- **Dimensions:** 768
- **Max Tokens:** 512
- **Model ID:** BAAI/bge-base-zh

Execute the following command to launch the model::

xinference launch --model-name bge-base-zh --model-type embedding

xinference launch --model-name bge-base-zh --model-type embedding
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.. _models_builtin_bge_large_en_v1.5:
.. _models_builtin_bge-large-en-v1.5:

=================
bge-large-en-v1.5
Expand All @@ -17,5 +17,4 @@ Specifications

Execute the following command to launch the model::

xinference launch --model-name bge-large-en-v1.5 --model-type embedding

xinference launch --model-name bge-large-en-v1.5 --model-type embedding
Loading

0 comments on commit cda4f22

Please sign in to comment.