Commit a148da2c authored by liam's avatar liam
Browse files

: rm sensitive info in config.yaml, add readme of makefile. support old model_path config

parent 9a2e7057
...@@ -18,3 +18,4 @@ compile_commands.json ...@@ -18,3 +18,4 @@ compile_commands.json
ktransformers/server/local_store/ ktransformers/server/local_store/
ktransformers/server_test1.db ktransformers/server_test1.db
*.patch *.patch
img/
\ No newline at end of file
...@@ -151,7 +151,7 @@ Some preparation: ...@@ -151,7 +151,7 @@ Some preparation:
``` ```
install.bat install.bat
``` ```
4. If you are developer, you can make use of the makefile to compile and format the code. <br> the detailed usage of makefile is [here](./doc/en/makefile_usage.md)
<h3>Local Chat</h3> <h3>Local Chat</h3>
We provide a simple command-line local chat Python script that you can run for testing. We provide a simple command-line local chat Python script that you can run for testing.
......
# Makefile
## Target
### flake_find:
```bash
make flake_find
```
find all the python files under ./ktransformers dir and find the Error, Warning, Fatal... (their codes) into a list that are not consistent with the pep8 standard. For now we have get all this list in the .flake8 file's extend-ignore section in order to let flakes8 ignore them temporarily.(we may improve them in the future)
### format:
```bash
make format
```
we use black to format all the python files under ./ktransformers dir. It obeys the pep8 standard
but we modify the line length to 120 by add
```toml
[tool.black]
line-length = 120
preview = true
unstable = true
```
in the pyproject.toml file.
### dev_install:
```bash
make dev_install
```
install the package in the development mode. It means that the package is installed in the editable mode. So if you modify the code, you don't need to reinstall the package. We recommend the developer to use this method to install the package.
\ No newline at end of file
...@@ -24,9 +24,7 @@ model: ...@@ -24,9 +24,7 @@ model:
type: ktransformers type: ktransformers
name: DeepSeek-Coder-V2-Instruct name: DeepSeek-Coder-V2-Instruct
# path: /mnt/data/model/DeepSeek-Coder-V2-Instruct/
path: deepseek-ai/DeepSeek-V2-Lite-Chat path: deepseek-ai/DeepSeek-V2-Lite-Chat
# gguf_path: /mnt/data/model/DeepSeek-Coder-V2-GGUF-WJH/
gguf_path: ./DeepSeek-V2-Lite-Chat-GGUF gguf_path: ./DeepSeek-V2-Lite-Chat-GGUF
device: cuda:0 device: cuda:0
......
...@@ -14,7 +14,8 @@ class ArgumentParser: ...@@ -14,7 +14,8 @@ class ArgumentParser:
parser.add_argument("--ssl_certfile", type=str) parser.add_argument("--ssl_certfile", type=str)
parser.add_argument("--web", type=bool, default=self.cfg.mount_web) parser.add_argument("--web", type=bool, default=self.cfg.mount_web)
parser.add_argument("--model_name", type=str, default=self.cfg.model_name) parser.add_argument("--model_name", type=str, default=self.cfg.model_name)
parser.add_argument("--model_dir", type=str, default=self.cfg.model_dir) parser.add_argument("--model_dir", type=str)
parser.add_argument("--model_path", type=str)
parser.add_argument( parser.add_argument(
"--device", type=str, default=self.cfg.model_device, help="Warning: Abandoning this parameter" "--device", type=str, default=self.cfg.model_device, help="Warning: Abandoning this parameter"
) )
...@@ -100,6 +101,16 @@ class ArgumentParser: ...@@ -100,6 +101,16 @@ class ArgumentParser:
parser.add_argument("--prompt_file", type=str, default=self.cfg.prompt_file) parser.add_argument("--prompt_file", type=str, default=self.cfg.prompt_file)
args = parser.parse_args() args = parser.parse_args()
if (args.model_dir is not None):
if (args.model_path is not None):
# if pass model_dir and model_path, we use model_path
args.model_dir = args.model_path
else:
# if only pass model_dir, we use model_dir
args.model_path = args.model_dir
else:
args.model_dir = self.cfg.model_dir
args.model_path = self.cfg.model_path
# set config from args # set config from args
for key, value in vars(args).items(): for key, value in vars(args).items():
if value is not None and hasattr(self.cfg, key): if value is not None and hasattr(self.cfg, key):
......
...@@ -88,6 +88,8 @@ class Config(metaclass=Singleton): ...@@ -88,6 +88,8 @@ class Config(metaclass=Singleton):
self.model: dict = cfg.get("model", {}) self.model: dict = cfg.get("model", {})
self.backend_type: str = self.model.get("type", "transformers") self.backend_type: str = self.model.get("type", "transformers")
self.model_dir: str = self.model.get("path", "") self.model_dir: str = self.model.get("path", "")
# to make sure it consistent with previous version
self.model_path: str = self.model_dir
self.model_name: str = self.model.get("name", "") self.model_name: str = self.model.get("name", "")
self.model_device: str = self.model.get("device", "cuda:0") self.model_device: str = self.model.get("device", "cuda:0")
self.gguf_path: Optional[str] = self.model.get("gguf_path", None) self.gguf_path: Optional[str] = self.model.get("gguf_path", None)
......
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