Update README.md
Browse files
    	
        README.md
    CHANGED
    
    | 
         @@ -19,4 +19,46 @@ base_model: unsloth/gemma-7b-bnb-4bit 
     | 
|
| 19 | 
         | 
| 20 | 
         
             
            This gemma model was trained 2x faster with [Unsloth](https://github.com/unslothai/unsloth) and Huggingface's TRL library.
         
     | 
| 21 | 
         | 
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 22 | 
         
             
            [<img src="https://raw.githubusercontent.com/unslothai/unsloth/main/images/unsloth%20made%20with%20love.png" width="200"/>](https://github.com/unslothai/unsloth)
         
     | 
| 
         | 
|
| 19 | 
         | 
| 20 | 
         
             
            This gemma model was trained 2x faster with [Unsloth](https://github.com/unslothai/unsloth) and Huggingface's TRL library.
         
     | 
| 21 | 
         | 
| 22 | 
         
            +
            ```py
         
     | 
| 23 | 
         
            +
            if False:
         
     | 
| 24 | 
         
            +
                from unsloth import FastLanguageModel
         
     | 
| 25 | 
         
            +
                model, tokenizer = FastLanguageModel.from_pretrained(
         
     | 
| 26 | 
         
            +
                    model_name = "Andyrasika/lora_gemma", 
         
     | 
| 27 | 
         
            +
                    max_seq_length = max_seq_length,
         
     | 
| 28 | 
         
            +
                    dtype = dtype,
         
     | 
| 29 | 
         
            +
                    load_in_4bit = load_in_4bit,
         
     | 
| 30 | 
         
            +
                )
         
     | 
| 31 | 
         
            +
                FastLanguageModel.for_inference(model) # Enable native 2x faster inference
         
     | 
| 32 | 
         
            +
             
     | 
| 33 | 
         
            +
            alpaca_prompt = """Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
         
     | 
| 34 | 
         
            +
             
     | 
| 35 | 
         
            +
            ### Instruction:
         
     | 
| 36 | 
         
            +
            {}
         
     | 
| 37 | 
         
            +
             
     | 
| 38 | 
         
            +
            ### Input:
         
     | 
| 39 | 
         
            +
            {}
         
     | 
| 40 | 
         
            +
             
     | 
| 41 | 
         
            +
            ### Response:
         
     | 
| 42 | 
         
            +
            {}"""
         
     | 
| 43 | 
         
            +
             
     | 
| 44 | 
         
            +
            inputs = tokenizer(
         
     | 
| 45 | 
         
            +
            [
         
     | 
| 46 | 
         
            +
                alpaca_prompt.format(
         
     | 
| 47 | 
         
            +
                    "What is a famous tall tower in Paris?", # instruction
         
     | 
| 48 | 
         
            +
                    "", # input
         
     | 
| 49 | 
         
            +
                    "", # output - leave this blank for generation!
         
     | 
| 50 | 
         
            +
                )
         
     | 
| 51 | 
         
            +
            ], return_tensors = "pt").to("cuda")
         
     | 
| 52 | 
         
            +
             
     | 
| 53 | 
         
            +
            outputs = model.generate(**inputs, max_new_tokens = 64, use_cache = True)
         
     | 
| 54 | 
         
            +
            tokenizer.batch_decode(outputs)
         
     | 
| 55 | 
         
            +
            ```
         
     | 
| 56 | 
         
            +
            Output
         
     | 
| 57 | 
         
            +
            ```
         
     | 
| 58 | 
         
            +
            ['<bos>Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the
         
     | 
| 59 | 
         
            +
            request.\n\n### Instruction:\nWhat is a famous tall tower in Paris?\n\n### Input:\n\n\n### Response:\nOne of the most famous tall towers in Paris is the Eiffel Tower.
         
     | 
| 60 | 
         
            +
            It is a wrought-iron lattice tower on the Champ de Mars in Paris, France. It is named after the engineer Gustave Eiffel, whose company designed and built the tower.
         
     | 
| 61 | 
         
            +
            The tower is 324 meters (1,063 feet']
         
     | 
| 62 | 
         
            +
            ```
         
     | 
| 63 | 
         
            +
             
     | 
| 64 | 
         
             
            [<img src="https://raw.githubusercontent.com/unslothai/unsloth/main/images/unsloth%20made%20with%20love.png" width="200"/>](https://github.com/unslothai/unsloth)
         
     |