Text Generation
Transformers
PyTorch
English
llama
custom_code
text-generation-inference
Inference Endpoints
Ashmal commited on
Commit
96a9417
1 Parent(s): 59ac8a2

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +87 -0
README.md CHANGED
@@ -1,3 +1,90 @@
1
  ---
2
  license: apache-2.0
 
 
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: apache-2.0
3
+ datasets:
4
+ - WizardLM/WizardLM_evol_instruct_V2_196k
5
+ - icybee/share_gpt_90k_v1
6
+ language:
7
+ - en
8
+ library_name: transformers
9
+ pipeline_tag: text-generation
10
  ---
11
+
12
+ # MobiLlama-0.5B-Chat
13
+
14
+ We present MobiLlama-0.5B-Chat, an instruction following model finetuned on [MBZUAI/MobiLlama-05B](https://huggingface.co/MBZUAI/MobiLlama-05B).
15
+
16
+ ## Model Description
17
+
18
+ - **Model type:** Language model with the same architecture as LLaMA-7B
19
+ - **Language(s) (NLP):** English
20
+ - **License:** Apache 2.0
21
+ - **Resources for more information:**
22
+ - [Metrics](https://github.com/LLM360/Analysis360)
23
+ - [Finetuning Code](https://github.com/lm-sys/FastChat)
24
+
25
+
26
+ # Loading MobiLlama-0.5B-Chat
27
+
28
+ ```python
29
+ import torch
30
+ from transformers import AutoTokenizer, AutoModelForCausalLM
31
+
32
+ tokenizer = AutoTokenizer.from_pretrained("MBZUAI/MobiLlama-05B-Chat")
33
+ model = AutoModelForCausalLM.from_pretrained("MBZUAI/MobiLlama-05B-Chat")
34
+
35
+ #template adapated from fastchat
36
+ 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:"
37
+
38
+ prompt = "What are the psychological effects of urban living on mental health?"
39
+
40
+ input_str = template.format(prompt=prompt)
41
+ input_ids = tokenizer(input_str, return_tensors="pt").input_ids
42
+ outputs = model.generate(input_ids, max_length=1000)
43
+ print(tokenizer.batch_decode(outputs[:, input_ids.shape[1]:-1])[0].strip())
44
+ ```
45
+
46
+ Alternatively, you may use [FastChat](https://github.com/lm-sys/FastChat):
47
+ ```bash
48
+ python3 -m fastchat.serve.cli --model-path MBZUAI/MobiLlama-05B-Chat
49
+ ```
50
+
51
+
52
+ ## Hyperparameters
53
+ | Hyperparameter | Value |
54
+ | ----------- | ----------- |
55
+ | Total Parameters | 0.52B |
56
+ | Hidden Size | 2048 |
57
+ | Intermediate Size (MLPs) | 5632 |
58
+ | Number of Attention Heads | 32 |
59
+ | Number of Hidden Lyaers | 22 |
60
+ | RMSNorm ɛ | 1e^-5 |
61
+ | Max Seq Length | 2048 |
62
+ | Vocab Size | 32000 |
63
+
64
+ | Training Hyperparameter | Value |
65
+ | ----------- | ----------- |
66
+ | learning_rate | 2e-5 |
67
+ | num_train_epochs | 3 |
68
+ | per_device_train_batch_size | 2 |
69
+ | gradient_accumulation_steps | 16 |
70
+ | warmup_ratio | 0.04 |
71
+ | model_max_length | 2048 |
72
+
73
+
74
+
75
+ ## Evaluation
76
+ | Evaluation Benchmark | MobiLlama-05B-Chat | MobiLlama-1.2B-Chat |
77
+ | ----------- | ----------- | ----------- |
78
+ | HellaSwag | 0.5042 | 0.6244 |
79
+ | MMLU | 0.2677 | 0.2635 |
80
+ | Arc Challenge | 0.2935 | 0.3558 |
81
+ | TruthfulQA | 0.3997 | 0.3848 |
82
+ | CrowsPairs | 0.5694 | 0.679 |
83
+ | PIQA | 0.7078 | 0.7557 |
84
+ | Race | 0.3320 | 0.3598 |
85
+ | SIQA | 0.4165 | 0.4396 |
86
+ | Winogrande | 0.5659 | 0.5966 |
87
+
88
+
89
+ ## Intended Uses
90
+ Given the nature of the training data, the MobiLlama-05B model is best suited for prompts using the QA format, the chat format, and the code format.