voidful commited on
Commit
ed68ae1
1 Parent(s): 4283b14

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +18 -16
README.md CHANGED
@@ -28,10 +28,13 @@ torch.set_default_device("cuda")
28
  model = AutoModelForCausalLM.from_pretrained("voidful/phi-1_5_chat_32k")
29
  tokenizer = AutoTokenizer.from_pretrained("voidful/phi-1_5_chat_32k",device_map="auto")
30
 
31
- from fastchat.conversation import get_conv_template
32
- conv = get_conv_template('qwen-7b-chat')
33
- conv.append_message(conv.roles[0], "how to make a keyboard?")
34
- conv.append_message(conv.roles[1], """To make a keyboard, you will need the following materials:
 
 
 
35
 
36
  1. A set of keys, such as those found on a standard computer keyboard.
37
  2. A circuit board, such as a MOSFET (Metal-Oxide-Semiconductor-Fluorescent) board.
@@ -47,24 +50,23 @@ Here is a basic outline of the steps involved in making a keyboard:
47
  4. Test the keyboard to ensure that it works properly.
48
  5. Package the keyboard in a box or case for shipping or sale.
49
 
50
- Note that this is just a basic outline, and there are many additional steps and considerations that will depend on the specific design and requirements of your keyboard.</s>""")
51
- conv.append_message(conv.roles[0], "where to buy the circuit?")
52
- prompt = conv.get_prompt()
 
53
 
54
- inputs = tokenizer(prompt, return_tensors="pt", return_attention_mask=True)
55
- outputs = model.generate(**inputs, max_length=1024)
56
- text = tokenizer.batch_decode(outputs[:,inputs.input_ids.shape[-1]:])[0]
57
  print(text)
58
  ```
59
 
60
  ### Result
61
  ```
 
62
 
63
- You can buy the circuit board from a variety of sources, including:
 
 
64
 
65
- 1. Online retailers: There are many online retailers that sell circuit boards, including Amazon, Best Buy, and Walmart.
66
- 2. Electronics stores: Many electronics stores, such as Best Buy, Walmart, and Target, carry circuit boards.
67
- 3. Specialty stores: There are also specialty stores that sell circuit boards, such as Circuit City, Best Buy, and Walmart.
68
-
69
- When buying a circuit board, it is important to consider factors such as the size and type of circuit board, the quality and reliability of the circuit board, and the cost and availability of the circuit board.<|im_end|>
70
  ```
 
28
  model = AutoModelForCausalLM.from_pretrained("voidful/phi-1_5_chat_32k")
29
  tokenizer = AutoTokenizer.from_pretrained("voidful/phi-1_5_chat_32k",device_map="auto")
30
 
31
+ messages = [
32
+ {
33
+ "role": "system",
34
+ "content": "You are a helpful assistant.",
35
+ },
36
+ {"role": "user", "content": "how to make a keyboard?"},
37
+ {"role": "assistant", "content": """To make a keyboard, you will need the following materials:
38
 
39
  1. A set of keys, such as those found on a standard computer keyboard.
40
  2. A circuit board, such as a MOSFET (Metal-Oxide-Semiconductor-Fluorescent) board.
 
50
  4. Test the keyboard to ensure that it works properly.
51
  5. Package the keyboard in a box or case for shipping or sale.
52
 
53
+ Note that this is just a basic outline, and there are many additional steps and considerations that will depend on the specific design and requirements of your keyboard.</s>"""},
54
+ {"role": "user", "content": "where to buy the circuit?"},
55
+ ]
56
+ tokenized_chat = tokenizer.apply_chat_template(messages, tokenize=True, add_generation_prompt=True, return_tensors="pt")
57
 
58
+ outputs = model.generate(tokenized_chat, max_length=1024)
59
+ text = tokenizer.batch_decode(outputs[:,tokenized_chat.shape[-1]:-1])[0]
 
60
  print(text)
61
  ```
62
 
63
  ### Result
64
  ```
65
+ There are several places where you can buy a circuit board. Here are some of the most common places:
66
 
67
+ 1. Electronics stores: Many electronics stores carry a variety of circuit boards for different purposes.
68
+ 2. Online marketplaces: There are several online marketplaces where you can buy circuit boards, such as Amazon, eBay, and Alibaba.
69
+ 3. Specialty stores: There are several specialty stores that carry a variety of circuit boards for different purposes, such as hobby stores, craft stores, and home improvement stores.
70
 
71
+ In general, it is a good idea to shop around and compare prices and features before making a purchase.
 
 
 
 
72
  ```