Instructions to use Sujith2121/tinyllama-dora-model with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use Sujith2121/tinyllama-dora-model with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("TinyLlama/TinyLlama-1.1B-Chat-v1.0") model = PeftModel.from_pretrained(base_model, "Sujith2121/tinyllama-dora-model") - Transformers
How to use Sujith2121/tinyllama-dora-model with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Sujith2121/tinyllama-dora-model") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("Sujith2121/tinyllama-dora-model", dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use Sujith2121/tinyllama-dora-model with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Sujith2121/tinyllama-dora-model" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Sujith2121/tinyllama-dora-model", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Sujith2121/tinyllama-dora-model
- SGLang
How to use Sujith2121/tinyllama-dora-model with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "Sujith2121/tinyllama-dora-model" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Sujith2121/tinyllama-dora-model", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "Sujith2121/tinyllama-dora-model" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Sujith2121/tinyllama-dora-model", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Sujith2121/tinyllama-dora-model with Docker Model Runner:
docker model run hf.co/Sujith2121/tinyllama-dora-model
Update README.md
Browse files
README.md
CHANGED
|
@@ -3,61 +3,104 @@ library_name: peft
|
|
| 3 |
license: apache-2.0
|
| 4 |
base_model: TinyLlama/TinyLlama-1.1B-Chat-v1.0
|
| 5 |
tags:
|
| 6 |
-
- base_model:adapter:TinyLlama/TinyLlama-1.1B-Chat-v1.0
|
| 7 |
-
-
|
| 8 |
-
-
|
|
|
|
|
|
|
| 9 |
pipeline_tag: text-generation
|
|
|
|
| 10 |
model-index:
|
| 11 |
-
- name: tinyllama-dora-model
|
| 12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
---
|
| 14 |
|
| 15 |
-
<!-- This model card has been generated automatically according to the information the Trainer had access to. You
|
| 16 |
-
should probably proofread and complete it, then remove this comment. -->
|
| 17 |
-
|
| 18 |
# tinyllama-dora-model
|
| 19 |
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
|
| 24 |
-
|
| 25 |
|
| 26 |
-
|
| 27 |
|
| 28 |
-
|
|
|
|
|
|
|
| 29 |
|
| 30 |
-
|
| 31 |
|
| 32 |
-
##
|
| 33 |
|
| 34 |
-
|
|
|
|
| 35 |
|
| 36 |
-
|
| 37 |
|
| 38 |
-
##
|
| 39 |
|
| 40 |
-
|
| 41 |
-
- learning_rate: 5e-05
|
| 42 |
-
- train_batch_size: 2
|
| 43 |
-
- eval_batch_size: 2
|
| 44 |
-
- seed: 42
|
| 45 |
-
- optimizer: Use OptimizerNames.ADAMW_TORCH_FUSED with betas=(0.9,0.999) and epsilon=1e-08 and optimizer_args=No additional optimizer arguments
|
| 46 |
-
- lr_scheduler_type: linear
|
| 47 |
-
- num_epochs: 1
|
| 48 |
-
- mixed_precision_training: Native AMP
|
| 49 |
|
| 50 |
-
|
| 51 |
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 56 |
|
| 57 |
-
##
|
| 58 |
|
| 59 |
-
|
| 60 |
-
- Transformers 5.0.0
|
| 61 |
-
- Pytorch 2.10.0+cu128
|
| 62 |
-
- Datasets 4.8.3
|
| 63 |
-
- Tokenizers 0.22.2
|
|
|
|
| 3 |
license: apache-2.0
|
| 4 |
base_model: TinyLlama/TinyLlama-1.1B-Chat-v1.0
|
| 5 |
tags:
|
| 6 |
+
- base_model:adapter:TinyLlama/TinyLlama-1.1B-Chat-v1.0
|
| 7 |
+
- dora
|
| 8 |
+
- qlora
|
| 9 |
+
- transformers
|
| 10 |
+
- text-generation
|
| 11 |
pipeline_tag: text-generation
|
| 12 |
+
|
| 13 |
model-index:
|
| 14 |
+
- name: tinyllama-dora-model
|
| 15 |
+
results:
|
| 16 |
+
- task:
|
| 17 |
+
type: text-generation
|
| 18 |
+
dataset:
|
| 19 |
+
name: mlabonne/guanaco-llama2-1k
|
| 20 |
+
type: instruction-tuning
|
| 21 |
+
metrics:
|
| 22 |
+
- type: loss
|
| 23 |
+
value: 1.5644
|
| 24 |
+
name: validation_loss
|
| 25 |
---
|
| 26 |
|
|
|
|
|
|
|
|
|
|
| 27 |
# tinyllama-dora-model
|
| 28 |
|
| 29 |
+
## Model Description
|
| 30 |
+
|
| 31 |
+
This model is a parameter-efficient fine-tuned version of TinyLlama/TinyLlama-1.1B-Chat-v1.0 using DoRA combined with 4-bit quantization.
|
| 32 |
+
|
| 33 |
+
---
|
| 34 |
+
|
| 35 |
+
## Key Features
|
| 36 |
+
|
| 37 |
+
* Base Model: TinyLlama-1.1B-Chat
|
| 38 |
+
* Fine-tuning Method: DoRA
|
| 39 |
+
* Quantization: 4-bit
|
| 40 |
+
* Framework: Transformers + PEFT
|
| 41 |
|
| 42 |
+
---
|
| 43 |
|
| 44 |
+
## Intended Use
|
| 45 |
|
| 46 |
+
* Instruction-based text generation
|
| 47 |
+
* Conversational AI
|
| 48 |
+
* Research and experimentation
|
| 49 |
|
| 50 |
+
---
|
| 51 |
|
| 52 |
+
## Limitations
|
| 53 |
|
| 54 |
+
* Small dataset (1k samples)
|
| 55 |
+
* May produce incorrect outputs
|
| 56 |
|
| 57 |
+
---
|
| 58 |
|
| 59 |
+
## Dataset
|
| 60 |
|
| 61 |
+
mlabonne/guanaco-llama2-1k
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
|
| 63 |
+
---
|
| 64 |
|
| 65 |
+
## Training Details
|
| 66 |
+
|
| 67 |
+
* Learning Rate: 5e-5
|
| 68 |
+
* Batch Size: 2
|
| 69 |
+
* Epochs: 1
|
| 70 |
+
|
| 71 |
+
---
|
| 72 |
|
| 73 |
+
## Results
|
| 74 |
+
|
| 75 |
+
Validation Loss: 1.5644
|
| 76 |
+
Perplexity = exp(loss)
|
| 77 |
+
|
| 78 |
+
---
|
| 79 |
+
|
| 80 |
+
## Usage
|
| 81 |
+
|
| 82 |
+
```python
|
| 83 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 84 |
+
from peft import PeftModel
|
| 85 |
+
|
| 86 |
+
base_model = "TinyLlama/TinyLlama-1.1B-Chat-v1.0"
|
| 87 |
+
adapter_model = "Sujith2121/tinyllama-dora-model"
|
| 88 |
+
|
| 89 |
+
tokenizer = AutoTokenizer.from_pretrained(adapter_model)
|
| 90 |
+
|
| 91 |
+
model = AutoModelForCausalLM.from_pretrained(base_model, device_map="auto")
|
| 92 |
+
model = PeftModel.from_pretrained(model, adapter_model)
|
| 93 |
+
|
| 94 |
+
prompt = "Explain Docker simply"
|
| 95 |
+
|
| 96 |
+
inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
|
| 97 |
+
outputs = model.generate(**inputs, max_new_tokens=100)
|
| 98 |
+
|
| 99 |
+
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
| 100 |
+
```
|
| 101 |
+
|
| 102 |
+
---
|
| 103 |
|
| 104 |
+
## License
|
| 105 |
|
| 106 |
+
Apache 2.0
|
|
|
|
|
|
|
|
|
|
|
|