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
Update README.md
Browse files
README.md
CHANGED
|
@@ -17,7 +17,7 @@ widget:
|
|
| 17 |
|
| 18 |
<hr>
|
| 19 |
|
| 20 |
-
#
|
| 21 |
|
| 22 |
<hr>
|
| 23 |
|
|
@@ -104,50 +104,8 @@ alpaca_prompt = f'''Abaixo está uma instrução que descreve uma tarefa, juntam
|
|
| 104 |
{output}'''
|
| 105 |
```
|
| 106 |
|
| 107 |
-
## Parâmetros
|
| 108 |
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
# EN - README
|
| 113 |
-
|
| 114 |
-
<hr>
|
| 115 |
-
|
| 116 |
-
# Samba-1.1B
|
| 117 |
-
|
| 118 |
-
<p align="center">
|
| 119 |
-
<img width="250" alt="Samba Logo" src="https://cdn-uploads.huggingface.co/production/uploads/658c21f4c1229bf113295773/MuRvqTWpp-d0NRYQ0yRPL.png">
|
| 120 |
-
</p>
|
| 121 |
-
|
| 122 |
-
Samba is a 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.
|
| 123 |
-
|
| 124 |
-
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.
|
| 125 |
-
|
| 126 |
-
<p align="center">
|
| 127 |
-
<img width="250" alt="Countries Logo" src="https://cdn-uploads.huggingface.co/production/uploads/658c21f4c1229bf113295773/d3twZrXng5eDjg_LbH4pF.png">
|
| 128 |
-
</p>
|
| 129 |
-
|
| 130 |
-
### Model Description
|
| 131 |
-
|
| 132 |
-
- **Developed by:** [Leonardo Souza](https://huggingface.co/lrds-code)
|
| 133 |
-
- **Model type:** LLaMA-Based
|
| 134 |
-
- **License:** Academic Free License v3.0
|
| 135 |
-
- **Finetuned from model:** [TinyLlama-1.1B](https://huggingface.co/TinyLlama/TinyLlama-1.1B-Chat-v1.0)
|
| 136 |
-
|
| 137 |
-
## How to Use
|
| 138 |
-
|
| 139 |
-
```python
|
| 140 |
-
import torch
|
| 141 |
-
from transformers import pipeline
|
| 142 |
-
|
| 143 |
-
samba = pipeline('text-generation', model='lrds-code/samba-1.1B', torch_dtype=torch.bfloat16, device_map='auto')
|
| 144 |
-
|
| 145 |
-
messages = [{"role": "system",
|
| 146 |
-
"content": ""},
|
| 147 |
-
{"role": "user",
|
| 148 |
-
"content": "Quantos planetas existem no sistema solar?"}]
|
| 149 |
-
|
| 150 |
-
prompt = samba.tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
| 151 |
-
outputs = samba(prompt, max_new_tokens=256, do_sample=False, temperature=0.1, top_k=50, top_p=0.95)
|
| 152 |
-
print(outputs[0]['generated_text'])
|
| 153 |
-
```
|
|
|
|
| 17 |
|
| 18 |
<hr>
|
| 19 |
|
| 20 |
+
# README
|
| 21 |
|
| 22 |
<hr>
|
| 23 |
|
|
|
|
| 104 |
{output}'''
|
| 105 |
```
|
| 106 |
|
| 107 |
+
## Parâmetros Importantes
|
| 108 |
|
| 109 |
+
- **repetition_penalty:** é utilizado para evitar a repetição de palavras ou frases. Quando esse valor é ajustado para ser maior que 1, o modelo tenta diminuir a probabilidade de gerar palavras que já apareceram anteriormente. Basicamente, quanto maior o valor, mais o modelo tenta evitar repetições.
|
| 110 |
+
- **do_sample:** determina se o modelo deve ou não amostrar aleatoriamente a próxima palavra com base nas probabilidades calculadas. Portanto, **do_sample=True** introduz variação e imprevisibilidade no texto gerado, enquanto que se **do_sample=False** o modelo escolherá sempre a palavra mais provável como próxima palavra, o que pode levar a saídas mais determinísticas e, possivelmente, mais repetitivas.
|
| 111 |
+
- **temperature:** afeta a aleatoriedade na escolha da próxima palavra. Um valor baixo (próximo de 0) faz com que o modelo seja mais "confiante" nas suas escolhas, favorecendo palavras com alta probabilidade e levando a saídas mais previsíveis. Por outro lado, um valor alto aumenta a aleatoriedade, permitindo que o modelo escolha palavras menos prováveis, o que pode tornar o texto gerado mais variado e criativo.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|