From b94edc955e97afdd94bb3509fe6754ef9602d5fa Mon Sep 17 00:00:00 2001 From: Cherrytest Date: Sat, 21 Oct 2023 00:22:08 +0000 Subject: [PATCH] Update README.md --- README.md | 35 ++++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 65de519..d3439ee 100644 --- a/README.md +++ b/README.md @@ -21,13 +21,38 @@ The models follow the conversation format of [Llama-2-chat](https://huggingface. You are a helpful, respectful and honest assistant. ``` -7B, 13B, and 70B models are available on Huggingface model hub. -|Model|Huggingface Repo| +### How to use in modelscope +```python +import torch +from modelscope import Model, AutoTokenizer + + +model = Model.from_pretrained("ZhipuAI/agentlm-7b", revision='master', device_map='auto', torch_dtype=torch.float16) +tokenizer = AutoTokenizer.from_pretrained("ZhipuAI/agentlm-7b", revision='master') + +prompt = """[INST] <> +[INST] <> +You are a helpful, respectful and honest assistant. +<> + +There's a llama in my garden 😱 What should I do? [/INST]""" +inputs = tokenizer(prompt, return_tensors="pt") + +# Generate +generate_ids = model.generate(inputs.input_ids.to(model.device), max_length=30) +print(tokenizer.batch_decode(generate_ids, skip_special_tokens=True, clean_up_tokenization_spaces=False)[0]) +``` + + + +7B, 13B, and 70B models are available on ModelScope model hub. + +|Model|ModelScope Repo| |---|---| -|AgentLM-7B| [🤗Huggingface Repo](https://huggingface.co/THUDM/agentlm-7b) | -|AgentLM-13B| [🤗Huggingface Repo](https://huggingface.co/THUDM/agentlm-13b) | -|AgentLM-70B| [🤗Huggingface Repo](https://huggingface.co/THUDM/agentlm-70b) | +|AgentLM-7B| [ModelScope Repo](https://modelscope.cn/models/ZhipuAI/agentlm-7b) | +|AgentLM-13B| [ModelScope Repo](https://modelscope.cn/models/ZhipuAI/agentlm-13b) | +|AgentLM-70B| [ModelScope Repo](https://modelscope.cn/models/ZhipuAI/agentlm-70b) | ## Citation