Text Generation
Transformers
Safetensors
Portuguese
llama
Portuguese
Tiny-Llama
PEFT
conversational
text-generation-inference
Instructions to use lrds-code/samba-1.1B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use lrds-code/samba-1.1B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="lrds-code/samba-1.1B") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("lrds-code/samba-1.1B") model = AutoModelForCausalLM.from_pretrained("lrds-code/samba-1.1B") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use lrds-code/samba-1.1B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "lrds-code/samba-1.1B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "lrds-code/samba-1.1B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/lrds-code/samba-1.1B
- SGLang
How to use lrds-code/samba-1.1B 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 "lrds-code/samba-1.1B" \ --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": "lrds-code/samba-1.1B", "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 "lrds-code/samba-1.1B" \ --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": "lrds-code/samba-1.1B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use lrds-code/samba-1.1B with Docker Model Runner:
docker model run hf.co/lrds-code/samba-1.1B
Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: afl-3.0
|
| 3 |
+
datasets:
|
| 4 |
+
- ju-resplande/rebel-pt
|
| 5 |
+
- paulofinardi/OIG_small_chip2_portuguese_brasil
|
| 6 |
+
- Guilherme34/Cabrita-lora-ptbr
|
| 7 |
+
- dominguesm/Canarim-Instruct-PTBR-Dataset
|
| 8 |
+
language:
|
| 9 |
+
- en
|
| 10 |
+
- pt
|
| 11 |
+
pipeline_tag: text-generation
|
| 12 |
+
library_name: transformers
|
| 13 |
+
widget:
|
| 14 |
+
- text: >
|
| 15 |
+
Pergunta: Quantos planetas existem no sistema solar?
|
| 16 |
+
---
|
| 17 |
+
# Samba-1.1B
|
| 18 |
+
|
| 19 |
+
Samba is an LLM trained on portuguese language data. The model is based on [TinyLlama-1.1B](https://huggingface.co/TinyLlama/TinyLlama-1.1B-Chat-v1.0), a 1.1B parameter version of LLaMA-2.
|
| 20 |
+
|
| 21 |
+
The LLM Samba project aims to provide more LLM options in Portuguese, while also providing less complex models so that users with less computational power can take advantage of the LLMs.
|
| 22 |
+
|
| 23 |
+
In support of portuguese-speaking countries. 🇦🇴🇧🇷🇨🇻🇬🇼🇬🇶🇲🇿🇵🇹🇸🇹🇹🇱
|
| 24 |
+
|
| 25 |
+
## Model Details
|
| 26 |
+
|
| 27 |
+
This model was fine-tuned on two datasets ([rebel-pt](https://huggingface.co/datasets/ju-resplande/rebel-pt) and [OIG_small_chip2_portuguese_brasil](https://huggingface.co/datasets/paulofinardi/OIG_small_chip2_portuguese_brasil) with portuguese data that total approximately 1 million samples.
|
| 28 |
+
|
| 29 |
+
## Limitations
|
| 30 |
+
|
| 31 |
+
Keep in mind the limitations of this model. It is a model with 1.1B of trained parameters and may present some glitches or hallucinations.
|
| 32 |
+
|
| 33 |
+
## Future Updates
|
| 34 |
+
|
| 35 |
+
- Add more data from the Portuguese language.
|
| 36 |
+
- Make quantized versions available.
|
| 37 |
+
|
| 38 |
+
### Model Description
|
| 39 |
+
|
| 40 |
+
- **Developed by:** [Leonardo Souza](https://huggingface.co/lrds-code)
|
| 41 |
+
- **Model type:** LLaMA-Based
|
| 42 |
+
- **License:** Academic Free License v3.0
|
| 43 |
+
- **Finetuned from model:** [TinyLlama-1.1B](https://huggingface.co/TinyLlama/TinyLlama-1.1B-Chat-v1.0)
|
| 44 |
+
|
| 45 |
+
## How to Get Started with the Model
|
| 46 |
+
|
| 47 |
+
```python
|
| 48 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 49 |
+
|
| 50 |
+
model = AutoModelForCausalLM.from_pretrained('lrds-code/samba-tiny-llama2-sft')
|
| 51 |
+
tokenizer = AutoTokenizer.from_pretrained('lrds-code/samba-tiny-llama2-sft')
|
| 52 |
+
|
| 53 |
+
text = 'Pergunta: Como desenvolver habilidades de programação em python?'
|
| 54 |
+
inputs = tokenizer(text, return_tensors='pt')
|
| 55 |
+
|
| 56 |
+
outputs = model.generate(**inputs)
|
| 57 |
+
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
| 58 |
+
|
| 59 |
+
## Pergunta: Como desenvolver habilidades de programação em python?
|
| 60 |
+
## Resposta: Para desenvolver habilidades de programação em Python, você precisa aprender a ler e escrever código.
|
| 61 |
+
## Você também precisa entender o que significa cada parte do código e como ela funciona.
|
| 62 |
+
## Você também precisa entender como usar bibliotecas e frameworks para criar aplicativos.
|
| 63 |
+
## Além disso, você precisa entender como usar o IDE (Integrated Development Environment) para desenvolver e testar seu código.
|
| 64 |
+
|
| 65 |
+
```
|