Text Generation
Transformers
Safetensors
English
llama
nlp
llm
text-generation-inference
Inference Endpoints
richardmfan commited on
Commit
f41eb8e
1 Parent(s): 3b58f6d

Update README.md

Browse files

add new commands + script

Files changed (1) hide show
  1. README.md +14 -4
README.md CHANGED
@@ -38,16 +38,26 @@ We present AmberChat, an instruction following model finetuned from [LLM360/Ambe
38
  # Loading AmberChat
39
 
40
  ```python
 
41
  from transformers import LlamaTokenizer, LlamaForCausalLM
42
 
43
  tokenizer = LlamaTokenizer.from_pretrained("LLM360/AmberChat")
44
  model = LlamaForCausalLM.from_pretrained("LLM360/AmberChat")
45
 
46
- input_text = "How old are you?"
47
- input_ids = tokenizer(input_text, return_tensors="pt").input_ids
48
 
49
- outputs = model.generate(input_ids)
50
- print(tokenizer.decode(outputs[0]))
 
 
 
 
 
 
 
 
 
51
  ```
52
 
53
  # AmberChat Finetuning Details
 
38
  # Loading AmberChat
39
 
40
  ```python
41
+ import torch
42
  from transformers import LlamaTokenizer, LlamaForCausalLM
43
 
44
  tokenizer = LlamaTokenizer.from_pretrained("LLM360/AmberChat")
45
  model = LlamaForCausalLM.from_pretrained("LLM360/AmberChat")
46
 
47
+ #template adapated from fastchat
48
+ template= "A chat between a curious human and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the human's questions.\n### Human: Got any creative ideas for a 10 year old’s birthday?\n### Assistant: Of course! Here are some creative ideas for a 10-year-old's birthday party:\n1. Treasure Hunt: Organize a treasure hunt in your backyard or nearby park. Create clues and riddles for the kids to solve, leading them to hidden treasures and surprises.\n2. Science Party: Plan a science-themed party where kids can engage in fun and interactive experiments. You can set up different stations with activities like making slime, erupting volcanoes, or creating simple chemical reactions.\n3. Outdoor Movie Night: Set up a backyard movie night with a projector and a large screen or white sheet. Create a cozy seating area with blankets and pillows, and serve popcorn and snacks while the kids enjoy a favorite movie under the stars.\n4. DIY Crafts Party: Arrange a craft party where kids can unleash their creativity. Provide a variety of craft supplies like beads, paints, and fabrics, and let them create their own unique masterpieces to take home as party favors.\n5. Sports Olympics: Host a mini Olympics event with various sports and games. Set up different stations for activities like sack races, relay races, basketball shooting, and obstacle courses. Give out medals or certificates to the participants.\n6. Cooking Party: Have a cooking-themed party where the kids can prepare their own mini pizzas, cupcakes, or cookies. Provide toppings, frosting, and decorating supplies, and let them get hands-on in the kitchen.\n7. Superhero Training Camp: Create a superhero-themed party where the kids can engage in fun training activities. Set up an obstacle course, have them design their own superhero capes or masks, and organize superhero-themed games and challenges.\n8. Outdoor Adventure: Plan an outdoor adventure party at a local park or nature reserve. Arrange activities like hiking, nature scavenger hunts, or a picnic with games. Encourage exploration and appreciation for the outdoors.\nRemember to tailor the activities to the birthday child's interests and preferences. Have a great celebration!\n### Human: {prompt}\n### Assistant:"
49
 
50
+ prompt = "How do I mount a tv to drywall safely?"
51
+
52
+ input_str = template.format(prompt=prompt)
53
+ input_ids = tokenizer(input_str, return_tensors="pt").input_ids
54
+ outputs = model.generate(input_ids, max_length=1000)
55
+ print(tokenizer.batch_decode(outputs[:, input_ids.shape[1]:-1])[0].strip())
56
+ ```
57
+
58
+ Alternatively, you may use [FastChat](https://github.com/lm-sys/FastChat):
59
+ ```bash
60
+ python3 -m fastchat.serve.cli --model-path LLM360/AmberChat
61
  ```
62
 
63
  # AmberChat Finetuning Details