├── .gitignore ├── requirements.txt ├── char_encoder.py ├── my_encoder.py ├── README.md ├── main.py ├── model.py ├── data └── jokes.txt └── LICENSE /.gitignore: -------------------------------------------------------------------------------- 1 | data/* 2 | models/* 3 | .idea/ 4 | __pycache__ 5 | 6 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | # server 2 | fastapi[all] 3 | uvicorn[standard] 4 | sse-starlette 5 | 6 | # LLM 7 | torch 8 | tiktoken 9 | numpy -------------------------------------------------------------------------------- /char_encoder.py: -------------------------------------------------------------------------------- 1 | class CharEncoder: 2 | def __init__(self, train_on): 3 | self.found_tokens = list(set(train_on)) 4 | 5 | lookup = dict() 6 | for i, char_token in enumerate(self.found_tokens): 7 | lookup[char_token] = i 8 | 9 | self.tokens = torch.empty((len(train_on),), dtype=torch.long) 10 | for i, char in enumerate(train_on): 11 | self.tokens[i] = lookup[char] 12 | 13 | @property 14 | def n_vocab(self): 15 | return len(self.found_tokens) 16 | 17 | def decode(self, indices): 18 | return "".join([self.found_tokens[i] for i in indices]) 19 | 20 | -------------------------------------------------------------------------------- /my_encoder.py: -------------------------------------------------------------------------------- 1 | import tiktoken 2 | import torch 3 | 4 | class MyEncoder: 5 | def __init__(self, train_on): 6 | self.enc = tiktoken.get_encoding("p50k_base") 7 | encoded = self.enc.encode(train_on) 8 | self.found_tokens = list(set(encoded)) 9 | lookup = dict() 10 | for i, p50_token in enumerate(self.found_tokens): 11 | lookup[p50_token] = i 12 | 13 | self.tokens = torch.empty((len(encoded),), dtype=torch.long) 14 | for i, p50 in enumerate(encoded): 15 | self.tokens[i] = lookup[p50] 16 | 17 | @property 18 | def n_vocab(self): 19 | return len(self.found_tokens) 20 | 21 | def decode(self, indices): 22 | return self.enc.decode([self.found_tokens[i] for i in indices]) 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # mygpt 2 | An easily-trained baby GPT that can stand in for the real thing. Based on Andrej Karpathy's makemore, but set up to mimic a llama-cpp server. 3 | 4 | The main points of differentiation are: 5 | - my version is token-based (tiktoken) 6 | - code to load up multiple text files as a training set 7 | - a minimal server which is a drop-in replacement for the OpenAI REST API 8 | - extra inference parameters, such as top_k, and the supression of tokens which you do not want to see (ie glitch tokens or annoyingly repeated tokens). 9 | 10 | 11 | 12 | So you can train the default tiny 15M parameter model, and use that in your projects instead of ChatGPT. 13 | 14 | 15 | This is not production-ready; it's a toy implementation for educational purposes. 16 | 17 | ## Setup 18 | 19 | pip install -r requirements.txt 20 | 21 | Add as many text files as you want to the "data" folder as a trianing set. 22 | 23 | ## Using it 24 | 25 | It is not very configurable at the moment -tweak the code in main.py to get it to do what you want. 26 | 27 | ### Training 28 | 29 | Uncomment "train()" in main.py. It will save checkpoints of the model parameters into the "models" folder. 30 | 31 | ### Inference / text generation 32 | 33 | Once you have trained the model, comment "train()" and uncomment "inference()". Setup whatever prompt you want. Then run the script to see the generated text appear. 34 | 35 | 36 | 37 | ## Example output 38 | 39 | These are some sample responses from a model trained on a dozen old Encyclopedia Brittanica volumes for a couple of hours on an NVidia 4GB GPU, then fine-tuned on 120 dad-jokes from the internet. 40 | 41 | ``` 42 | Q: What is a dog? 43 | A: To get a frog. 44 | 45 | Q: Why did the chicken cross the road? 46 | A: Because it was Sunday. 47 | ``` 48 | 49 | With "Q: " as a prompt, it will make its own "jokes": 50 | 51 | ``` 52 | Q: How do you cross a race with no cold birds? 53 | A: Because they did the toothache entirely. 54 | 55 | Q: Why did a figureur hit a like? 56 | A: Because a joke. 57 | ```` 58 | 59 | Pure comic genius! 60 | 61 | The prompt format is: 62 | ``` 63 | Q: {user question} 64 | ``` 65 | 66 | Here is part of the fine-tuning set (real dad jokes from the internet - not what was generated): 67 | Q: What do you call a fake noodle? A: An impasta 68 | Q: How do you organise a space party? A: You planet! 69 | 70 | 71 | ## Improving the performance 72 | 73 | This code is an educational exercise; it has a self-attention head built from first principles. 74 | 75 | You can get a great memory + speed saving by replacing the self-attention head with a prebuilt module from pytorch. Replace the old Block class with this code: 76 | 77 | ``` 78 | class Block(nn.Module): 79 | """ Intersperse communication (attention) and computation """ 80 | 81 | def __init__(self, n_embd, n_head): 82 | super().__init__() 83 | self.sa = nn.MultiheadAttention(n_embd, n_head, dropout=dropout) 84 | self.ffwd = FeedForward(n_embd) 85 | self.ln1 = nn.LayerNorm(n_embd) 86 | self.ln2 = nn.LayerNorm(n_embd) 87 | 88 | def forward(self, x): 89 | l1_results = self.ln1(x) 90 | sa_results, _ = self.sa(l1_results, l1_results, l1_results, need_weights=False) 91 | x = x + sa_results # note the x+ is a residual connection to help with optimisation 92 | x = x + self.ffwd(self.ln2(x)) 93 | return x 94 | ``` 95 | 96 | I got a ~30% memory reduction. 97 | 98 | This is probably because many separate steps in our layers can be mathematically simplified when the layers are combined into a single module. 99 | Plus, pytorch is no doubt much better optimised than our naive python implementation. 100 | 101 | -------------------------------------------------------------------------------- /main.py: -------------------------------------------------------------------------------- 1 | # A FastAPI server which mimics the python-cpp server. 2 | # Only implements barely enough to be usable. 3 | 4 | import asyncio 5 | import json 6 | 7 | import torch 8 | import tiktoken 9 | 10 | from model import GPTModel, get_batch, device 11 | 12 | from fastapi import FastAPI, Request 13 | from pydantic import BaseModel 14 | from typing import Sequence 15 | from contextlib import asynccontextmanager 16 | from sse_starlette.sse import EventSourceResponse 17 | 18 | enc = tiktoken.get_encoding("p50k_base") 19 | m = None 20 | 21 | @asynccontextmanager 22 | async def lifespan(app: FastAPI): 23 | global enc, m 24 | # Load the ML model 25 | model = GPTModel(enc.n_vocab) 26 | m = model.to(device) 27 | print("Loading model...") 28 | m.load_state_dict(torch.load("models/encyclopedias.pt")) 29 | 30 | yield 31 | # Clean up the ML models and release the resources 32 | 33 | app = FastAPI(lifespan=lifespan) 34 | 35 | 36 | class CreateCompletionRequest(BaseModel): 37 | prompt: str 38 | stream: bool = False 39 | stop: Sequence[str] 40 | max_tokens: int = 100 41 | temperature: float 42 | 43 | @app.get("/v1/models") 44 | async def models(request: Request): 45 | return {"data": [{"id": "mygpt"}]} 46 | 47 | @app.post("/v1/completions") 48 | async def completions(request: Request, body: CreateCompletionRequest): 49 | """ This file can be served as a drop-in replacement for a llama-cpp server. 50 | Only the minimal functionality needed to make it work is implemented. """ 51 | global enc, m 52 | 53 | def on_generated(token): 54 | return 55 | 56 | stops = [{"choices": [{"text": enc.encode(stop)[0]}]} for stop in body.stop] 57 | 58 | prompt_tokens = enc.encode(body.prompt) 59 | idx = torch.tensor([prompt_tokens], dtype=torch.long, device=device) 60 | ret = m.generate(idx, max_new_tokens=body.max_tokens, stop_tokens=stops, generated=on_generated) 61 | 62 | tokens = ret.tolist()[0] 63 | 64 | if body.stream: 65 | # This is a terrible hack to do response streaming: just wait until it is done and then dribble out the tokens. 66 | # Couldn't be bothered converting my model to async. 67 | chunks = [json.dumps({"choices": [{"text": enc.decode([token])}]}) for token in tokens] 68 | 69 | def new_messages(): 70 | # Check if data in table 71 | if len(chunks) == 0: 72 | return None 73 | else: 74 | return True 75 | 76 | async def event_generator(): 77 | while True: 78 | if await request.is_disconnected(): 79 | break 80 | 81 | if new_messages(): 82 | yield chunks.pop(0) 83 | else: 84 | break 85 | 86 | await asyncio.sleep(0.01) 87 | 88 | return EventSourceResponse(event_generator()) 89 | else: 90 | return {"resp": enc.decode(tokens)} 91 | 92 | def text_from_path(path): 93 | """ Load all the text files found at this path into one huge lump of text and return it. """ 94 | import glob 95 | text = "" 96 | for filename in glob.glob(path+"*.txt"): 97 | with open(filename) as f: 98 | lines = f.readlines() 99 | for line in lines: 100 | text += line 101 | return text 102 | 103 | def text_from_file(): 104 | """ Open a single file and return its contents. """ 105 | text = "" 106 | with open('data/input.txt') as f: 107 | lines = f.readlines() 108 | for line in lines: 109 | text += line 110 | return text 111 | 112 | 113 | def train(): 114 | """ Train the model and save it at regular checkpoints. """ 115 | global enc, m 116 | 117 | # Change this path to where your training data is, as a folder full of .txt files 118 | text = text_from_path("data/encyclopedias/") 119 | 120 | tokens = torch.tensor(enc.encode(text), dtype=torch.long) 121 | 122 | print(f"Vocab size {enc.n_vocab}") 123 | print(f"Training data size {len(tokens)}") 124 | 125 | model = GPTModel(enc.n_vocab) 126 | m = model.to(device) 127 | print(sum(p.numel() for p in m.parameters()) / 1e6, "M parameters") 128 | 129 | # Try to load the old model so we can continue training it from where we left off. 130 | try: 131 | m.load_state_dict(torch.load("models/encyclopedias.pt")) 132 | except FileNotFoundError: 133 | print("Model file not found, starting new training...") 134 | print("Loaded model. Beginning training...") 135 | 136 | optimizer = torch.optim.AdamW(m.parameters(), lr=1e-3) 137 | 138 | epoch = 300 139 | for checkpoints in range(30000): 140 | loss_total = 0 141 | for steps in range(epoch): 142 | xb, yb = get_batch(tokens) 143 | logits, loss = m(xb, yb) 144 | optimizer.zero_grad(set_to_none=True) 145 | loss.backward() 146 | optimizer.step() 147 | loss_total += loss.item() 148 | 149 | print(loss_total/epoch) 150 | 151 | torch.save(model.state_dict(), "models/encyclopedias.pt") 152 | print("Done with training!") 153 | 154 | 155 | def inference(): 156 | """ Generate a stream of text from a starting prompt. """ 157 | global m, enc 158 | 159 | model = GPTModel(enc.n_vocab) 160 | m = model.to(device) 161 | 162 | # This is the model that was trained previously. The hyperparameters in model.py must match exactly to when it was trained, or there'll be an error. 163 | print("Loading model...") 164 | m.load_state_dict(torch.load("models/victorian-jokes.pt")) 165 | 166 | def on_generated(token): 167 | #print(f"{enc.decode([token])}({token.item()})", end="") 168 | print(enc.decode([token]), end="") 169 | 170 | 171 | stops = [enc.encode(".")[0], enc.encode("?")[0], enc.encode("!")[0]] 172 | prompt = "Q: Why did the chicken cross the road?\n" 173 | print(f"{prompt}", end="") 174 | prompt_tokens = enc.encode(prompt) 175 | # supress = torch.tensor([0, 930], dtype=torch.long, device=device) # the and and: 290, 262 as a testy= 176 | supress = [] 177 | idx = torch.tensor([prompt_tokens], dtype=torch.long, device=device) 178 | m.generate(idx, max_new_tokens=400, stop_tokens=None, generated=on_generated, top_k=16, sample=True, supress_tokens=supress) 179 | print("\n") 180 | 181 | if __name__ == '__main__': 182 | print(f"Using device {device}") 183 | 184 | # Uncomment this to train the model 185 | #train() 186 | 187 | inference() 188 | -------------------------------------------------------------------------------- /model.py: -------------------------------------------------------------------------------- 1 | # This model is largely based on Andrej Karparthy's "makemore" videos, with some refinements to the inference method. 2 | 3 | import torch 4 | import torch.nn as nn 5 | from torch.nn import functional as F 6 | 7 | # for victorian 8 | device = "cuda" if torch.cuda.is_available() else "cpu" 9 | batch_size = 64 # How many sequences in parallel - 64 saturates my 4GB CUDA card pretty well 10 | block_size = 32 # context length, was 8 11 | n_embd = 120 # num embedding dimensions 12 | n_layer = 16 13 | dropout = 0.2 14 | 15 | # for encyclopedias 16 | # device = "cuda" if torch.cuda.is_available() else "cpu" 17 | # batch_size = 36 # How many sequences in parallel - 64 saturates my 4GB CUDA card pretty well 18 | # block_size = 64 # context length, was 8 19 | # n_embd = 128 # num embedding dimensions 20 | # n_layer = 20 21 | # dropout = 0.3 22 | 23 | 24 | def get_batch(tokens): 25 | ix = torch.randint(len(tokens) - block_size, (batch_size, )) 26 | x = torch.stack([tokens[i:i+block_size] for i in ix]) 27 | y = torch.stack([tokens[i+1:i+block_size+1] for i in ix]) 28 | return x.to(device), y.to(device) 29 | 30 | # K = "here's what I am" 31 | # Q = "here's what I'm looking for in my past" 32 | # V = "here's what I will output based on what I found" 33 | 34 | class Head(nn.Module): 35 | def __init__(self, head_size): 36 | super().__init__() 37 | self.key = nn.Linear(n_embd, head_size, bias=False) 38 | self.query = nn.Linear(n_embd, head_size, bias=False) 39 | self.value = nn.Linear(n_embd, head_size, bias=False) 40 | self.register_buffer("tril", torch.tril(torch.ones(block_size, block_size))) 41 | self.dropout = nn.Dropout(dropout) 42 | 43 | def forward(self, x): 44 | B, T, C = x.shape 45 | k = self.key(x) 46 | q = self.query(x) 47 | 48 | wei = q @ k.transpose(-2, -1) * C ** -0.5 49 | wei = wei.masked_fill(self.tril[:T, :T] == 0, float("-inf")) 50 | wei = F.softmax(wei, dim=-1) 51 | wei = self.dropout(wei) 52 | v = self.value(x) 53 | out = wei @ v 54 | return out 55 | 56 | 57 | class MultiHeadAttention(nn.Module): 58 | def __init__(self, num_heads, head_size): 59 | super().__init__() 60 | self.heads = nn.ModuleList([Head(head_size) for _ in range(num_heads)]) 61 | self.proj = nn.Linear(n_embd, n_embd) 62 | self.dropout = nn.Dropout(dropout) 63 | 64 | def forward(self, x): 65 | out = torch.cat([h(x) for h in self.heads], dim=-1) 66 | out = self.dropout(self.proj(out)) 67 | return out 68 | 69 | 70 | class FeedForward(nn.Module): 71 | """ Simple computation layer so we are not raw-dogging the output of the attention heads. """ 72 | 73 | def __init__(self, n_embd): 74 | super().__init__() 75 | self.net = nn.Sequential( 76 | nn.Linear(n_embd, 4 * n_embd), 77 | nn.ReLU(), 78 | nn.Linear(4 * n_embd, n_embd), 79 | nn.Dropout(dropout) 80 | ) 81 | 82 | def forward(self, x): 83 | return self.net(x) 84 | 85 | 86 | class Block(nn.Module): 87 | """ Intersperse communication (attention) and computation """ 88 | 89 | def __init__(self, n_embd, n_head): 90 | super().__init__() 91 | head_size = n_embd // n_head 92 | self.sa = MultiHeadAttention(n_head, 93 | head_size) # all smaller heads are concatenated to give same size output as embedding size 94 | self.ffwd = FeedForward(n_embd) 95 | self.ln1 = nn.LayerNorm(n_embd) 96 | self.ln2 = nn.LayerNorm(n_embd) 97 | 98 | def forward(self, x): 99 | x = x + self.sa(self.ln1(x)) # note the x+ is a residual connection to help with optimisation 100 | x = x + self.ffwd(self.ln2(x)) 101 | return x 102 | 103 | 104 | class GPTModel(nn.Module): 105 | def __init__(self, vocab_size): 106 | super().__init__() 107 | n_heads = 4 108 | self.token_embedding_table = nn.Embedding(vocab_size, n_embd) 109 | self.position_embedding_table = nn.Embedding(block_size, n_embd) 110 | self.blocks = nn.Sequential(*[Block(n_embd, n_head=n_heads) for _ in range(n_layer)]) 111 | self.layer_norm = nn.LayerNorm(n_embd) 112 | self.lm_head = nn.Linear(n_embd, vocab_size) 113 | 114 | def forward(self, idx, targets=None): 115 | B, T = idx.shape 116 | 117 | tok_emb = self.token_embedding_table(idx) # (B, T, C) 118 | pos_emb = self.position_embedding_table(torch.arange(T, device=device)) 119 | x = tok_emb + pos_emb 120 | x = self.blocks(x) 121 | x = self.layer_norm(x) 122 | logits = self.lm_head(x) # (B. T. vocab size) 123 | 124 | if targets is None: 125 | loss = None 126 | else: 127 | B, T, C = logits.shape 128 | logits = logits.view(B * T, C) # Put tensor in form that cross_entropy func accepts 129 | targets = targets.view(B * T) 130 | loss = F.cross_entropy(logits, targets) 131 | return logits, loss 132 | 133 | def generate(self, idx, max_new_tokens, stop_tokens=None, generated=None, top_k=5, sample=True, supress_tokens=[]): 134 | """ Generate a stream of tokens. 135 | :param idx prompt 136 | :param max_new_tokens max tokens to generate 137 | :param stop_tokens immediately stop on any of these tokens 138 | :param generated callback for when a new token is generated. Useful for chatbot behaviour. 139 | :param top_k only sample the top n most likely tokens. 140 | :param sample always choose the top most likely token if false, otherwise take based on probability. 141 | :param supress_tokens choose tokens to supress, ie glitch tokens or anything that messes with your output. Try removing 'and' or 'the'. 142 | :return the generated tokens.""" 143 | for _ in range(max_new_tokens): 144 | idx_cond = idx[:, -block_size:] # 145 | logits, loss = self(idx_cond) 146 | logits = logits[:, -1, :] 147 | if top_k: 148 | topk_values, topk_indices = torch.topk(logits, top_k) 149 | threshold = topk_values[:, [-1]] 150 | logits[logits < threshold] = float('-inf') 151 | 152 | #print("B:"+str(logits[:,930].item())) 153 | 154 | if len(supress_tokens) > 0: 155 | logits = logits.index_fill(1, supress_tokens, float('-inf')) 156 | 157 | #print("A:"+str(logits[:,930].item())) 158 | 159 | probs = F.softmax(logits, dim=-1) 160 | if sample: 161 | idx_next = torch.multinomial(probs, num_samples=1) 162 | else: 163 | _, idx_next = torch.topk(logits, k=1, dim=-1) 164 | if generated: 165 | generated(idx_next) 166 | idx = torch.cat((idx, idx_next), dim=1) 167 | next_token = idx_next.item() 168 | if stop_tokens and next_token in stop_tokens: 169 | return idx 170 | return idx 171 | 172 | -------------------------------------------------------------------------------- /data/jokes.txt: -------------------------------------------------------------------------------- 1 | Q: Did you hear about the painter who was hospitalized? 2 | A: Reports say it was due to too many strokes. 3 | 4 | Q: Why did the robber take a bath? 5 | A: Because he wanted to make a clean getaway. 6 | 7 | Q: What happens if life gives you melons? 8 | A: You’re dyslexic 9 | 10 | Q: What did the blanket say to the bed? 11 | A: Don’t worry, I’ve got you covered! 12 | 13 | Q: Why should you take a pencil to bed? 14 | A: To draw the curtains! 15 | 16 | Q: What do you call a frozen dog? 17 | A: A pupsicle. 18 | 19 | Q. What did the tie say to the hat? 20 | A. You go on ahead and I’ll hang around 21 | 22 | Q: What washes up on very small beaches? 23 | A: Microwaves! 24 | 25 | Q: What goes through towns, up & over hills, but doesn’t move? 26 | A: The road! 27 | 28 | Q: Why did the cross-eyed teacher lose her job? 29 | A: Because she couldn’t control her pupils 30 | 31 | Q: What do you call someone who is afraid of Santa? 32 | A: A Clausterphobic 33 | 34 | Q: What three candies can you find in every school? 35 | A: Nerds, DumDums, and Smarties. 36 | 37 | Q: What stays in the corner and travels all over the world? 38 | A: A stamp. 39 | 40 | Q: What do you call a man with no body and just a nose? 41 | A: Nobody nose. 42 | 43 | Q: Why did the computer go to the doctor? 44 | A: Because it had a virus! 45 | 46 | Q: What do you call a computer that sings? 47 | A: A-Dell 48 | 49 | Q: Did you hear about the shampoo shortage in Jamaica? 50 | A: It’s dread-full. 51 | 52 | Q: How do you make a tissue dance? 53 | A: Put a little boogey in it! 54 | 55 | Q: Did you hear about the angry pancake? 56 | A: He just flipped. 57 | 58 | Q: What do prisoners use to call each other? 59 | A: Cell phones. 60 | 61 | Q: What do you call a cow with a twitch? 62 | A: Beef Jerky. 63 | 64 | Q: Why did the traffic light turn red? 65 | A: You would too if you had to change in the middle of the street! 66 | 67 | Q: What did one elevator say to the other elevator? 68 | A: I think I’m coming down with something! 69 | 70 | Q: What do you call a window that raps? 71 | A: PANEZ 72 | 73 | Q: “How do you shoot a killer bee?” 74 | A: “With a bee-bee gun.” 75 | 76 | Q: How do you drown a Hipster? 77 | A: In the mainstream. 78 | 79 | Q: What kind of jokes do you make in the shower? 80 | A: Clean Jokes! 81 | 82 | Q: What does a nosey pepper do? 83 | A: Gets jalapeno business! 84 | 85 | Q: What do you call a fake noodle? 86 | A: An Impasta 87 | 88 | Q: What do you call an alligator in a vest? 89 | A: An Investigator 90 | 91 | Q: Why did Johnny throw the clock out of the window? 92 | A: Because he wanted to see time fly! 93 | 94 | Q: When do you stop at green and go at red? 95 | A: When you’re eating a watermelon! 96 | 97 | Q: What did the tailor think of her new job? 98 | A: It was sew-sew. 99 | 100 | Q: What is an astronaut’s favorite place on a computer? 101 | A: The Spacebar! 102 | 103 | Q: What exam do young witches have to pass? 104 | A: A spell-ing test! 105 | 106 | Q: What do you call a sheep with no head and no legs? 107 | A: A cloud! 108 | 109 | Q: Which weighs more, a ton of feathers or a ton of bricks? 110 | A: Neither, they both weigh a ton! 111 | 112 | Q: Did you hear about the blonde who gave her cat a bath? 113 | A: She still hasn’t gotten all the hair off her tongue. 114 | 115 | Q: What has one horn and gives milk 116 | A: A milk truck. 117 | 118 | Q: What concert costs 25 cents? 119 | A: 50 Cent featuring Nickleback. 120 | 121 | Q: Can February March? 122 | A: No. But April May. 123 | 124 | Q: Why did the tree go to the dentist? 125 | A: To get a root canal. 126 | 127 | Q: Why is Basketball such a messy sport? 128 | A: Because you dribble on the floor! 129 | 130 | Q: How do you communicate with a fish? 131 | A: Drop him a line! 132 | 133 | Q: Where do sheep go to get haircuts? 134 | A: To the Baa Baa shop! 135 | 136 | Q: What kind of shoes do all spies wear? 137 | A: Sneakers. 138 | 139 | Q: Why did the soccer player bring string to the game? 140 | A: So he could tie the score. 141 | 142 | Q: Why is a baseball team similar to a muffin? 143 | A: They both depend on the batter. 144 | 145 | Q: How do you repair a broken tomato? 146 | A: Tomato Paste! 147 | 148 | Q: Why did the baby strawberry cry? 149 | A: Because his parents were in a jam! 150 | 151 | Q: What did the hamburger name his daughter? 152 | A: Patty! 153 | 154 | Q: Who can shave 10 times a day and still have a beard? 155 | A: A barber. 156 | 157 | Q: What do you call a horse that can’t lose a race? 158 | A: Sherbet 159 | 160 | Q: What do you call a dentist in the army? 161 | A: A drill sergeant 162 | 163 | Q: What do you get when you plant kisses? 164 | A: Tu-lips (two-lips) 165 | 166 | Q: What did the daddy chimney say to the baby chimney? 167 | A: You are to little to smoke! 168 | 169 | Q: What do you call a ghosts mom and dad? 170 | A: Transparents 171 | 172 | Q: What did Winnie The Pooh say to his agent? 173 | A: Show me the honey! 174 | 175 | Q: What did the man say to the wall? 176 | A: One more crack like that and I’ll plaster ya! 177 | 178 | Q: What do you get when you cross a fridge with a radio? 179 | A: Cool Music. 180 | 181 | Q: What do you get when you cross Sonic The Hedgehog and Curious George? 182 | A: Fast Curious 183 | 184 | Q: Did you hear about the hairdresser? 185 | A: She dyed. 186 | 187 | Q: What do you call a musician with problems? 188 | A: a trebled man. 189 | 190 | Q: What is the best day to go to the beach? 191 | A: Sunday, of course! 192 | 193 | Q: Which building is the largest? 194 | A: The library, because it has the most stories. 195 | 196 | Q: What do you call an illegally parked frog? 197 | A: Toad. 198 | 199 | Q: What do you call a very religious person that sleep walks? 200 | A: A Roman Catholic 201 | 202 | Q: Did you hear about the crab that went to the seafood disco? 203 | A: He pulled a muscle 204 | 205 | Q: Did you hear about the carrot detective? 206 | A: He got to the root of every case. 207 | 208 | Q: Why don’t skeletons fight each other? 209 | A: They don’t have the guts. 210 | 211 | Q: What do you call cheese that is not yours? 212 | A: Nacho Cheese 213 | 214 | Q: What streets do ghosts haunt? 215 | A: Dead ends! 216 | 217 | Q: What’s easy to get into but hard to get out of? 218 | A: Trouble 219 | 220 | Q: Why did the dinosaur cross the road? 221 | A: Because the chicken joke wasn’t invented yet. 222 | 223 | Q: What kind of lights did Noah use on the Ark? 224 | A: Flood lights! 225 | 226 | Q: Why did Goofy put a clock under his desk? 227 | A: Because he wanted to work over-time! 228 | 229 | Q: Do you know why diarrhea is hereditary? 230 | A: Because it runs through your jeans. What would you do if I stole a kiss? Call the Police 231 | 232 | Q: What do you call a South American girl who is always in a hurry? 233 | A: Urgent Tina 234 | 235 | Q: Why do birds fly south for the winter? 236 | A: Its easier than walking! 237 | 238 | Q: What kind of key opens a banana? 239 | A: A monkey! 240 | 241 | Q: Did you hear about the vampire bicycle that went round biting people’s arms off? 242 | A: It was a vicious cycle. 243 | 244 | Q: What do you call leftover aliens? 245 | A: Extra Terrestrials. 246 | 247 | Q: What’s taken before you get it? 248 | A: Your picture. 249 | 250 | Q: Whats the difference between roast beef and pea soup? 251 | A: You can roast beef, but you cant pea soup! 252 | 253 | Q: What happens if you eat yeast and shoe polish? 254 | A: Every morning you’ll rise and shine! 255 | 256 | Q: “What’s the difference between a guitar and a fish?” 257 | A: “You can’t tuna fish.” 258 | 259 | Q: What do you call a baby monkey? 260 | A: A Chimp off the old block. 261 | 262 | Q: What did the femur say to the patella? 263 | A: I kneed you. 264 | 265 | Q: Why did the picture go to jail? 266 | A: Because it was framed. 267 | 268 | Q: What do you call a three-footed aardvark? 269 | A: A yardvark! 270 | 271 | Q: What’s the first bet that most people make in their lives? 272 | A: The alpha bet 273 | 274 | Q. What do you get when you cross a cow and a duck? 275 | A. Milk and quackers! 276 | 277 | Q: How do you organize a space party? 278 | A: You planet! 279 | 280 | Q: Why do fish live in salt water? 281 | A: Because pepper makes them sneeze! 282 | 283 | Q: Why did the man put his money in the freezer? 284 | A: He wanted cold hard cash! 285 | 286 | Q: What do you get when you cross a snowman with a vampire? 287 | A: Frostbite. 288 | 289 | Q: What has one head, one foot and four legs? 290 | A: A Bed 291 | 292 | Q: What is the difference between a school teacher and a train? 293 | A: The teacher says spit your gum out and the train says “chew chew chew”. 294 | 295 | Q: Why did the birdie go to the hospital? 296 | A: To get a tweetment. 297 | 298 | Q: What did Delaware? 299 | A: A New Jersey 300 | 301 | Q: Why did Tony go out with a prune? 302 | A: Because he couldn’t find a date! 303 | 304 | Q: What did the little mountain say to the big mountain? 305 | A: Hi Cliff! 306 | 307 | Q: What do you call an s synth pop band with a scoop of ice cream? 308 | A: Depeche a la Mode. 309 | 310 | Q: Why do sea-gulls fly over the sea? 311 | A: Because if they flew over the bay they would be bagels! 312 | 313 | Q: What dog keeps the best time? 314 | A: A watch dog. 315 | 316 | Q: What did the penny say to the other penny? 317 | A: We make perfect cents. 318 | 319 | Q: Why did the man with one hand cross the road? 320 | A: To get to the second hand shop. 321 | 322 | Q: Why did the boy sprinkle sugar on his pillow before he went to sleep? 323 | A: So he could have sweet dreams. 324 | 325 | Q: What happens if life gives you melons? 326 | A: Your dyslexic 327 | 328 | Q: What did one raindrop say to the other? 329 | A: My plop is bigger than your plop. 330 | 331 | Q: Why did the balloon burst 332 | A: Because is saw a lolly pop 333 | 334 | Q: Which is the longest word in the dictionary? 335 | A: “Smiles”, because there is a mile between each “s”! 336 | 337 | Q: What happened to the wooden car with wooden wheels and wooden engine? 338 | A: It wooden go! 339 | 340 | Q: Which month do soldiers hate most? 341 | A: The month of March! 342 | 343 | Q: Whens the best time to go to the dentist? 344 | A: Tooth-hurty 345 | 346 | Q: What did one aspiring wig say to the other aspiring wig? 347 | A: I wanna get a head! 348 | 349 | Q: Did you hear about the paddle sale at the boat store? 350 | A: It was quite an oar deal. 351 | 352 | Q: What do you call a guy who never farts in public? 353 | A: A private tutor. 354 | 355 | Q: What do you call a bear with no socks on? 356 | A: Bare-foot. 357 | 358 | Q: What can you serve but never eat? 359 | A: A volleyball. 360 | 361 | Q: Why can’t a leopard hide? 362 | A: Because he’s always spotted! 363 | 364 | Q: What do you give a dog with a fever? 365 | A: Mustard, its the best thing for a hot dog! 366 | 367 | Q: What do you get when you cross a cat with a lemon? 368 | A: A sour puss! 369 | 370 | Q: What runs but can’t walk? 371 | A: The faucet! 372 | 373 | Q: What kind of bed does a mermaid sleep in? 374 | A: A water bed! 375 | 376 | Q: What kind of crackers do firemen like in their soup? 377 | A: Firecrackers! 378 | 379 | Q: Did you hear about the two bed bugs who met in the mattress? 380 | A: They got married in the spring. 381 | 382 | Q: Why do watermelons have fancy weddings? 383 | A: Because they cantaloupe. 384 | 385 | Q: Have you heard the joke about the butter? 386 | A: I better not tell you, it might spread. 387 | 388 | Q: What did the judge say to the dentist? 389 | A: Do you swear to pull the tooth, the whole tooth and nothing but the tooth. 390 | 391 | Q: Why did the boy tiptoe past the medicine cabinet? 392 | A: He didn’t want to wake the sleeping pills! 393 | 394 | Q: What goes up when the rain comes down? 395 | A: An umbrella. 396 | 397 | Q: What sound do porcupines make when they kiss? 398 | A: Ouch 399 | 400 | Q: Why was the guy looking for fast food ON his friend? 401 | A: Because his friend said dinner is ON me. 402 | 403 | Q: Did you hear the joke about the roof? 404 | A: Never mind, it’s over your head! 405 | 406 | Q: What did the leopard say after eating his owner? 407 | A: Man, that hit the “spot.” 408 | 409 | Q: What do you call a sleeping bull? 410 | A: A bulldozer! 411 | 412 | Q: What do you call security guards working outside Samsung shops? 413 | A: Guardians of the Galaxy. 414 | 415 | Q: What do you call a bee that lives in America? 416 | A: USB 417 | 418 | Q: How do you make a tissue dance? 419 | A: Put a bogey in it. 420 | 421 | Q: Why didn’t the skeleton go to the dance? 422 | A: Because he had no-body to go with. 423 | 424 | Q: How do crazy people go through the forest? 425 | A: They take the psycho path. 426 | 427 | Q: What does the Lone Ranger say when he takes out the garbage? 428 | A: To the dump, to the dump, to the dump dump dump. 429 | 430 | Q: How many books can you put in an empty backpack? 431 | A: One! After that its not empty! 432 | 433 | Q: What kind of button won’t unbutton? 434 | A: A bellybutton! 435 | 436 | Q: Why does a milking stool have only legs? 437 | A: Because the cow has the utter. 438 | 439 | Q: Did you hear about the monster with five legs? 440 | A: His trousers fit him like a glove. 441 | 442 | Q: Why don’t you see giraffes in elementary school? 443 | A: Because they’re all in High School! 444 | 445 | Q: How do baseball players stay cool? 446 | A: They sit next to their fans. 447 | 448 | Q: Why was the math book sad? 449 | A: Because it had too many problems. 450 | 451 | Q: What's the difference between a shoping trolley and a University vice chancellor? 452 | A: You fill them both up with as much food and alcohol you can, but it's only the shopping 453 | trolley that has a mind of its own. 454 | 455 | Q. How do you catch a polar bear? 456 | A. You cut a hole in the ice and you put peas all round the edge and when the polar bear 457 | comes along and stops for a pea, you kick it in the ice hole. 458 | 459 | Q: Why should you never iron a four leaf clover? 460 | A: You should never press your luck! 461 | 462 | Q: What's ET short for? 463 | A: Because he's got little legs. 464 | 465 | Q: What's the difference between a buffalo and a bison? 466 | A: You can't wash your hands in a buffalo. -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | --------------------------------------------------------------------------------