Views
No views yet
BenevolenceMessiah/Yi-Coder-9B-Chat-Instruct-TIES using llama.cpp via the ggml.ai's GGUF-my-repo space.
Refer to the original model card for more details on the model.1brew install llama.cpp
2llama-cli --hf-repo BenevolenceMessiah/Yi-Coder-9B-Chat-Instruct-TIES-Q8_0-GGUF --hf-file yi-coder-9b-chat-instruct-ties-q8_0.gguf -p "The meaning to life and the universe is"llama-server --hf-repo BenevolenceMessiah/Yi-Coder-9B-Chat-Instruct-TIES-Q8_0-GGUF --hf-file yi-coder-9b-chat-instruct-ties-q8_0.gguf -c 2048git clone https://github.com/ggerganov/llama.cppLLAMA_CURL=1 flag along with other hardware-specific flags (for ex: LLAMA_CUDA=1 for Nvidia GPUs on Linux).cd llama.cpp && LLAMA_CURL=1 make./llama-cli --hf-repo BenevolenceMessiah/Yi-Coder-9B-Chat-Instruct-TIES-Q8_0-GGUF --hf-file yi-coder-9b-chat-instruct-ties-q8_0.gguf -p "The meaning to life and the universe is"./llama-server --hf-repo BenevolenceMessiah/Yi-Coder-9B-Chat-Instruct-TIES-Q8_0-GGUF --hf-file yi-coder-9b-chat-instruct-ties-q8_0.gguf -c 20481models:
2 - model: 01-ai/Yi-Coder-9B
3 parameters:
4 density: 0.5
5 weight: 0.5
6 - model: 01-ai/Yi-Coder-9B-Chat
7 parameters:
8 density: 0.5
9 weight: 0.5
10
11merge_method: ties
12base_model: 01-ai/Yi-Coder-9B
13parameters:
14 normalize: false
15 int8_mask: true
16dtype: float16 'java', 'markdown', 'python', 'php', 'javascript', 'c++', 'c#', 'c', 'typescript', 'html', 'go', 'java_server_pages', 'dart', 'objective-c', 'kotlin', 'tex', 'swift', 'ruby', 'sql', 'rust', 'css', 'yaml', 'matlab', 'lua', 'json', 'shell', 'visual_basic', 'scala', 'rmarkdown', 'pascal', 'fortran', 'haskell', 'assembly', 'perl', 'julia', 'cmake', 'groovy', 'ocaml', 'powershell', 'elixir', 'clojure', 'makefile', 'coffeescript', 'erlang', 'lisp', 'toml', 'batchfile', 'cobol', 'dockerfile', 'r', 'prolog', 'verilog'
| Name | Type | Length | Download |
|---|---|---|---|
| Yi-Coder-9B-Chat | Chat | 128K | 🤗 Hugging Face • 🤖 ModelScope • 🟣 wisemodel |
| Yi-Coder-1.5B-Chat | Chat | 128K | 🤗 Hugging Face • 🤖 ModelScope • 🟣 wisemodel |
| Yi-Coder-9B | Base | 128K | 🤗 Hugging Face • 🤖 ModelScope • 🟣 wisemodel |
| Yi-Coder-1.5B | Base | 128K | 🤗 Hugging Face • 🤖 ModelScope • 🟣 wisemodel |

1from transformers import AutoTokenizer, AutoModelForCausalLM
2
3device = "cuda" # the device to load the model onto
4model_path = "01-ai/Yi-Coder-9B-Chat"
5
6tokenizer = AutoTokenizer.from_pretrained(model_path)
7model = AutoModelForCausalLM.from_pretrained(model_path, device_map="auto").eval()
8
9prompt = "Write a quick sort algorithm."
10messages = [
11 {"role": "system", "content": "You are a helpful assistant."},
12 {"role": "user", "content": prompt}
13]
14text = tokenizer.apply_chat_template(
15 messages,
16 tokenize=False,
17 add_generation_prompt=True
18)
19model_inputs = tokenizer([text], return_tensors="pt").to(device)
20
21generated_ids = model.generate(
22 model_inputs.input_ids,
23 max_new_tokens=1024,
24 eos_token_id=tokenizer.eos_token_id
25)
26generated_ids = [
27 output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
28]
29
30response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
31print(response)