Views
No views yet

karakuri-rd@karakuri.ai1from transformers import AutoTokenizer
2
3tokenizer = AutoTokenizer.from_pretrained("karakuri-ai/karakuri-lm-8x7b-instruct-v0.1")
4
5messages = [
6 {"role": "system", "content": "You are a helpful assistant."},
7 {"role": "user", "content": "Hello!"},
8 {"role": "assistant", "content": "Hello! How can I help you today?"},
9 {"role": "user", "content": "I'm planning a day trip to Tokyo this weekend. Can you recommend a quick sightseeing plan?"}
10]
11tokenizer.apply_chat_template(messages, add_generation_prompt=True, tokenize=False)1messages = [
2 {"role": "user", "content": "I'm planning a day trip to Tokyo this weekend. Can you recommend a quick sightseeing plan?"}
3]
4tools = [
5 {
6 "name": "internet_search",
7 "description": "Returns a list of relevant document snippets for a textual query retrieved from the internet",
8 "parameters": {
9 "type": "object",
10 "properties": {
11 "query": {
12 "type": "string",
13 "description": "Query to search the internet with"
14 }
15 },
16 "required": ["query"]
17 }
18 },
19 {
20 "name": "directly_answer",
21 "description": "Calls a standard (un-augmented) AI chatbot to generate a response given the conversation history",
22 "parameters": {
23 "type": "object",
24 "properties": {}
25 }
26 }
27]
28tokenizer.apply_chat_template(
29 messages,
30 chat_template="tool_use",
31 tools=tools,
32 add_generation_prompt=True,
33 tokenize=False,
34)1messages = [
2 {"role": "user", "content": "I'm planning a day trip to Tokyo this weekend. Can you recommend a quick sightseeing plan?"}
3]
4documents = [
5 {
6 "title": "Tsukiji Outer Market",
7 "text": "While the inner wholesale market has moved to Toyosu, Tsukiji Outer Market remains a bustling hub for fresh seafood and street food. Enjoy sushi, sashimi, and other delicacies while exploring the vibrant market streets.",
8 },
9 {
10 "title": "Meiji Shrine",
11 "text": "Nestled in a lush forest in the heart of the city, Meiji Shrine offers a peaceful retreat from the urban hustle. Dedicated to Emperor Meiji and Empress Shoken, the shrine is a popular site for traditional Japanese weddings. Stroll along the serene paths and experience a moment of tranquility."
12 }
13]
14tokenizer.apply_chat_template(
15 messages,
16 chat_template="rag",
17 documents=documents,
18 add_generation_prompt=True,
19 tokenize=False,
20)apply_chat_template method as follows:1messages = [
2 {"role": "user", "content": "I'm planning a day trip to Tokyo this weekend. Can you recommend a quick sightseeing plan?"}
3]
4tokenizer.apply_chat_template(
5 messages,
6 add_generation_prompt=True,
7 tokenize=False,
8 helpfulness=0,
9 correctness=0,
10 coherence=2,
11 complexity=0,
12 verbosity=3,
13 quality=0,
14 toxicity=4,
15 humor=1,
16 creativity=1,
17)1from transformers import AutoModelForCausalLM
2
3model = AutoModelForCausalLM.from_pretrained(
4 "karakuri-ai/karakuri-lm-8x7b-instruct-v0.1",
5 torch_dtype="auto",
6 device_map="auto",
7)
8
9messages = [
10 {"role": "system", "content": "You are a helpful assistant."},
11 {"role": "user", "content": "I'm planning a day trip to Tokyo this weekend. Can you recommend a quick sightseeing plan?"}
12]
13
14input_ids = tokenizer.apply_chat_template(
15 messages,
16 add_generation_prompt=True,
17 return_tensors="pt",
18).to(model.device)
19outputs = model.generate(input_ids, max_new_tokens=512)
20tokenizer.decode(outputs[0][input_ids.shape[-1]:])| Dataset | # Tokens / Epoch | # Epochs | # Tokens | Percent |
|---|---|---|---|---|
| databricks/databricks-dolly-15k | 3M | 5 | 16M | 1.5% |
| glaiveai/glaive-code-assistant-v3 | 520M | 0.3 | 156M | 14.6% |
| glaiveai/glaive-function-calling-v2 | 52M | 3 | 157M | 14.7% |
| gretelai/synthetic_text_to_sql | 19M | 3 | 57M | 5.3% |
| meta-math/MetaMathQA | 81M | 1 | 81M | 7.6% |
| microsoft/orca-math-word-problems-200k | 67M | 1 | 67M | 6.3% |
| neural-bridge/rag-dataset-12000 | 12M | 5 | 61M | 5.7% |
| neural-bridge/rag-hallucination-dataset-1000 | 1M | 5 | 5M | 0.5% |
| nvidia/HelpSteer | 24M | 5 | 118M | 11.0% |
| OpenAssistant/oasst2 | 27M | 5 | 133M | 12.4% |
| KARAKURI Instruction Dataset | 1M | 5 | 6M | 0.6% |
| KARAKURI Corpus | 214M | 1 | 214M | 20.0% |
@misc{karakuri_lm_8x7b_instruct_v01,
author = { {KARAKURI} {I}nc. },
title = { {KARAKURI} {LM} 8x7{B} {I}nstruct v0.1 },
year = { 2024 },
url = { https://huggingface.co/karakuri-ai/karakuri-lm-8x7b-instruct-v0.1 },
publisher = { Hugging Face },
journal = { Hugging Face repository }
}