mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-09-04 02:25:08 +00:00
update
This commit is contained in:
@@ -4,8 +4,7 @@
|
|||||||
import torch
|
import torch
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
root_path = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||||
root_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
|
||||||
model_path = os.path.join(root_path, "models")
|
model_path = os.path.join(root_path, "models")
|
||||||
vector_storepath = os.path.join(root_path, "vector_store")
|
vector_storepath = os.path.join(root_path, "vector_store")
|
||||||
|
|
||||||
|
@@ -1,2 +0,0 @@
|
|||||||
|
|
||||||
from model.loader import *
|
|
@@ -1,15 +1,23 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
#-*- coding: utf-8 -*-
|
#-*- coding: utf-8 -*-
|
||||||
|
|
||||||
from pilot.model.loader import ModerLoader
|
import torch
|
||||||
from fastchat.serve.inference import generate_stream
|
from fastchat.serve.inference import generate_stream, compress_module
|
||||||
from pilot.configs.model_config import *
|
|
||||||
|
BASE_MODE = "/home/magic/workspace/github/DB-GPT/models/vicuna-13b"
|
||||||
|
from transformers import AutoTokenizer, AutoModelForCausalLM
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
||||||
model_path = llm_model_config[LLM_MODEL]
|
device = "cuda" if torch.cuda.is_available() else "cpu"
|
||||||
|
tokenizer = AutoTokenizer.from_pretrained(BASE_MODE, use_fast=False)
|
||||||
|
model = AutoModelForCausalLM.from_pretrained(
|
||||||
|
BASE_MODE,
|
||||||
|
low_cpu_mem_usage=True,
|
||||||
|
torch_dtype=torch.float16,
|
||||||
|
device_map="auto",
|
||||||
|
)
|
||||||
|
|
||||||
ml = ModerLoader(model_path)
|
print(device)
|
||||||
model, tokenizer = ml.loader(load_8bit=True)
|
#compress_module(model, device)
|
||||||
print(model)
|
print(model, tokenizer)
|
||||||
print(tokenizer)
|
|
Reference in New Issue
Block a user