Skip to content

Commit

Permalink
修改库名
Browse files Browse the repository at this point in the history
  • Loading branch information
ztxz16 committed Jul 9, 2024
1 parent 94a8480 commit a93b335
Show file tree
Hide file tree
Showing 25 changed files with 118 additions and 345 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# fastllm

[English Document](README_EN.md)

## 介绍

fastllm是纯c++实现,无第三方依赖的多平台高性能大模型推理库
Expand Down
415 changes: 93 additions & 322 deletions README_EN.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ GPU编译时,根据使用的CUDA版本,将cudart cublas的相关dll文件复
* %CUDA_PATH%\bin\cublas64_12.dll
* %CUDA_PATH%\bin\cublasLt64_12.dll

## fastllm_pytools
## ftllm

### 释放内存报错: CUDA error when release memory

Expand Down
2 changes: 1 addition & 1 deletion example/openai_server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
## 依赖
以下依赖在python 3.12.2上没有问题
1. 需要先安装fastllm_pytools工具包
1. 需要先安装ftllm工具包
2. 需要安装以下依赖
```bash
cd example/openai_server
Expand Down
2 changes: 1 addition & 1 deletion example/openai_server/fastllm_completion.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
ChatCompletionRole)

from protocal.openai_protocol import *
from fastllm_pytools import llm
from ftllm import llm

class ConversationMessage:
def __init__(self, role:str, content:str):
Expand Down
2 changes: 1 addition & 1 deletion test/basic/forward_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import torch
import tqdm
from transformers import AutoModelForCausalLM, AutoTokenizer
from fastllm_pytools import llm
from ftllm import llm

def args_parser():
parser = argparse.ArgumentParser(description = 'fastllm_test')
Expand Down
2 changes: 1 addition & 1 deletion test/basic/tokenizer_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import logging
import os
from transformers import AutoTokenizer
from fastllm_pytools import llm
from ftllm import llm

def args_parser():
parser = argparse.ArgumentParser(description = 'fastllm_test')
Expand Down
2 changes: 1 addition & 1 deletion test/cmmlu/baichuan.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def eval(model, tokenizer, subject, dev_df, test_df, num_few_shot, max_length, c
torch_dtype=torch.float16,
)

from fastllm_pytools import llm;
from ftllm import llm;
model = llm.from_hf(model, tokenizer, dtype = args.dtype);
model.direct_query = True;

Expand Down
2 changes: 1 addition & 1 deletion test/cmmlu/chatglm.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def eval_chat_multithread(model, tokenizer, subject, dev_df, test_df, num_few_sh
tokenizer = AutoTokenizer.from_pretrained(args.model_name_or_path, trust_remote_code=True,)
model = AutoModel.from_pretrained(args.model_name_or_path, trust_remote_code=True).cpu()

from fastllm_pytools import llm;
from ftllm import llm;
model = llm.from_hf(model, tokenizer, dtype = args.dtype);

# model.save("/root/test.flm");
Expand Down
2 changes: 1 addition & 1 deletion test/cmmlu/qwen.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def eval_chat_multithread(model, tokenizer, subject, dev_df, test_df, num_few_sh
torch_dtype=torch.float16,
)

from fastllm_pytools import llm;
from ftllm import llm;
model = llm.from_hf(model, tokenizer, dtype = args.dtype)
model.direct_query = True

Expand Down
2 changes: 1 addition & 1 deletion tools/fastllm_pytools/hf_model.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from fastllm_pytools import llm;
from ftllm import llm;
import ctypes;
import builtins, os, json
import numpy as np
Expand Down
2 changes: 1 addition & 1 deletion tools/fastllm_pytools/llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def from_hf(model,
bot_role = None,
history_sep = None,
dtype = "float16"):
from fastllm_pytools import hf_model;
from ftllm import hf_model;
return hf_model.create(model, tokenizer, pre_prompt = pre_prompt, user_role = user_role,
bot_role = bot_role, history_sep = history_sep, dtype = dtype);

Expand Down
2 changes: 1 addition & 1 deletion tools/scripts/alpaca2flm.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import sys
import torch
from transformers import AutoTokenizer, LlamaForCausalLM
from fastllm_pytools import torch2flm
from ftllm import torch2flm

if __name__ == "__main__":
model_name = sys.argv[3] if len(sys.argv) >= 4 else 'minlik/chinese-alpaca-33b-merged'
Expand Down
2 changes: 1 addition & 1 deletion tools/scripts/baichuan2_2flm.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
from transformers.generation.utils import GenerationConfig
from fastllm_pytools import torch2flm
from ftllm import torch2flm

if __name__ == "__main__":
modelpath = "baichuan-inc/Baichuan2-7B-Chat"
Expand Down
2 changes: 1 addition & 1 deletion tools/scripts/baichuan2flm.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
from transformers.generation.utils import GenerationConfig
from fastllm_pytools import torch2flm
from ftllm import torch2flm

if __name__ == "__main__":
modelpath = "baichuan-inc/baichuan-13B-Chat"
Expand Down
2 changes: 1 addition & 1 deletion tools/scripts/bert2flm.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import sys
from transformers import AutoTokenizer, AutoModel
from fastllm_pytools import torch2flm
from ftllm import torch2flm

if __name__ == "__main__":
modelpath = sys.argv[3] if len(sys.argv) >= 4 else 'BAAI/bge-small-zh-v1.5'
Expand Down
2 changes: 1 addition & 1 deletion tools/scripts/chatglm_export.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import sys
from transformers import AutoTokenizer, AutoModel
from fastllm_pytools import torch2flm
from ftllm import torch2flm

if __name__ == "__main__":
tokenizer = AutoTokenizer.from_pretrained("THUDM/chatglm2-6b", trust_remote_code=True)
Expand Down
2 changes: 1 addition & 1 deletion tools/scripts/cli_demo.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import argparse
from fastllm_pytools import llm
from ftllm import llm
import readline

def args_parser():
Expand Down
2 changes: 1 addition & 1 deletion tools/scripts/glm_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import torch
import binascii
from transformers import AutoTokenizer, AutoModel
from fastllm_pytools import torch2flm
from ftllm import torch2flm

def glmtofile(exportPath,
model,
Expand Down
2 changes: 1 addition & 1 deletion tools/scripts/llama3_to_flm.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import sys
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
from fastllm_pytools import torch2flm
from ftllm import torch2flm

if __name__ == "__main__":
modelNameOrPath = sys.argv[3] if len(sys.argv) >= 4 else 'meta-llama/Meta-Llama-3-8B'
Expand Down
2 changes: 1 addition & 1 deletion tools/scripts/llamalike2flm.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import sys
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
from fastllm_pytools import torch2flm
from ftllm import torch2flm

if __name__ == "__main__":
modelNameOrPath = sys.argv[3] if len(sys.argv) >= 4 else 'qwen/Qwen1.5-7B-Chat'
Expand Down
2 changes: 1 addition & 1 deletion tools/scripts/minicpm2flm.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import sys
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
from fastllm_pytools import torch2flm
from ftllm import torch2flm

if __name__ == "__main__":
modelNameOrPath = sys.argv[3] if len(sys.argv) >= 4 else "openbmb/MiniCPM-2B-dpo-fp16"
Expand Down
2 changes: 1 addition & 1 deletion tools/scripts/moss_export.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import sys
from transformers import AutoTokenizer, AutoModelForCausalLM
from fastllm_pytools import torch2flm
from ftllm import torch2flm

tokenizer = AutoTokenizer.from_pretrained("fnlp/moss-moon-003-sft", trust_remote_code=True);
model = AutoModelForCausalLM.from_pretrained("fnlp/moss-moon-003-sft", trust_remote_code=True).float();
Expand Down
2 changes: 1 addition & 1 deletion tools/scripts/qwen2flm.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import sys
from transformers import AutoModelForCausalLM, AutoTokenizer
from transformers.generation import GenerationConfig
from fastllm_pytools import torch2flm
from ftllm import torch2flm

if __name__ == "__main__":
tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen-7B-Chat", trust_remote_code=True)
Expand Down
2 changes: 1 addition & 1 deletion tools/scripts/web_demo.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import streamlit as st
from streamlit_chat import message
from fastllm_pytools import llm
from ftllm import llm
import sys

st.set_page_config(
Expand Down

0 comments on commit a93b335

Please sign in to comment.