Text Generation
Transformers
Safetensors
Portuguese
English
llama
decoder-only
instruct
code
portuguese
conversational
text-generation-inference
Instructions to use caikybaldo999/CBLM-Code-300M-Instruct with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use caikybaldo999/CBLM-Code-300M-Instruct with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="caikybaldo999/CBLM-Code-300M-Instruct") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("caikybaldo999/CBLM-Code-300M-Instruct") model = AutoModelForCausalLM.from_pretrained("caikybaldo999/CBLM-Code-300M-Instruct", device_map="auto") 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 caikybaldo999/CBLM-Code-300M-Instruct with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "caikybaldo999/CBLM-Code-300M-Instruct" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "caikybaldo999/CBLM-Code-300M-Instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/caikybaldo999/CBLM-Code-300M-Instruct
- SGLang
How to use caikybaldo999/CBLM-Code-300M-Instruct 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 "caikybaldo999/CBLM-Code-300M-Instruct" \ --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": "caikybaldo999/CBLM-Code-300M-Instruct", "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 "caikybaldo999/CBLM-Code-300M-Instruct" \ --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": "caikybaldo999/CBLM-Code-300M-Instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use caikybaldo999/CBLM-Code-300M-Instruct with Docker Model Runner:
docker model run hf.co/caikybaldo999/CBLM-Code-300M-Instruct
CBLM Code 300M instruction tuning
Browse files- README.md +33 -0
- chat_template.jinja +10 -0
- config.json +32 -0
- generation_config.json +11 -0
- model.safetensors +3 -0
- tokenizer.json +0 -0
- tokenizer_config.json +20 -0
README.md
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
library_name: transformers
|
| 3 |
+
pipeline_tag: text-generation
|
| 4 |
+
language:
|
| 5 |
+
- pt
|
| 6 |
+
- en
|
| 7 |
+
base_model: caikybaldo999/CBLM-Code-300M
|
| 8 |
+
tags:
|
| 9 |
+
- llama
|
| 10 |
+
- decoder-only
|
| 11 |
+
- instruct
|
| 12 |
+
- code
|
| 13 |
+
- portuguese
|
| 14 |
+
---
|
| 15 |
+
|
| 16 |
+
# CBLM Code 300M Instruct
|
| 17 |
+
|
| 18 |
+
Versão instruction-tuned de [caikybaldo999/CBLM-Code-300M](https://huggingface.co/caikybaldo999/CBLM-Code-300M).
|
| 19 |
+
|
| 20 |
+
- Arquitetura preservada do modelo-base: `LlamaForCausalLM`
|
| 21 |
+
- Parâmetros: `303,350,784`
|
| 22 |
+
- Contexto de SFT: `1024` tokens
|
| 23 |
+
- Treinamento completo dos pesos em BF16/FP16
|
| 24 |
+
- Dados de instrução em português e programação
|
| 25 |
+
|
| 26 |
+
## Formato de chat
|
| 27 |
+
|
| 28 |
+
Use `tokenizer.apply_chat_template(messages, add_generation_prompt=True)`.
|
| 29 |
+
|
| 30 |
+
## Limitações
|
| 31 |
+
|
| 32 |
+
Modelo experimental de aproximadamente 300M parâmetros. Pode errar fatos,
|
| 33 |
+
produzir código incorreto e gerar conteúdo inesperado. Verifique as respostas.
|
chat_template.jinja
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{% for message in messages %}{% if message['role'] == 'system' %}### Sistema:
|
| 2 |
+
{{ message['content'] }}
|
| 3 |
+
|
| 4 |
+
{% elif message['role'] == 'user' %}### Usuário:
|
| 5 |
+
{{ message['content'] }}
|
| 6 |
+
|
| 7 |
+
{% elif message['role'] == 'assistant' %}### Assistente:
|
| 8 |
+
{{ message['content'] }}{{ eos_token }}
|
| 9 |
+
{% endif %}{% endfor %}{% if add_generation_prompt %}### Assistente:
|
| 10 |
+
{% endif %}
|
config.json
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"LlamaForCausalLM"
|
| 4 |
+
],
|
| 5 |
+
"attention_bias": false,
|
| 6 |
+
"attention_dropout": 0.0,
|
| 7 |
+
"bos_token_id": 1,
|
| 8 |
+
"dtype": "bfloat16",
|
| 9 |
+
"eos_token_id": 2,
|
| 10 |
+
"head_dim": 64,
|
| 11 |
+
"hidden_act": "silu",
|
| 12 |
+
"hidden_size": 1024,
|
| 13 |
+
"initializer_range": 0.02,
|
| 14 |
+
"intermediate_size": 2304,
|
| 15 |
+
"max_position_embeddings": 1024,
|
| 16 |
+
"mlp_bias": false,
|
| 17 |
+
"model_type": "llama",
|
| 18 |
+
"num_attention_heads": 16,
|
| 19 |
+
"num_hidden_layers": 24,
|
| 20 |
+
"num_key_value_heads": 16,
|
| 21 |
+
"pad_token_id": 0,
|
| 22 |
+
"pretraining_tp": 1,
|
| 23 |
+
"rms_norm_eps": 1e-05,
|
| 24 |
+
"rope_parameters": {
|
| 25 |
+
"rope_theta": 10000.0,
|
| 26 |
+
"rope_type": "default"
|
| 27 |
+
},
|
| 28 |
+
"tie_word_embeddings": true,
|
| 29 |
+
"transformers_version": "5.14.1",
|
| 30 |
+
"use_cache": true,
|
| 31 |
+
"vocab_size": 32000
|
| 32 |
+
}
|
generation_config.json
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bos_token_id": 1,
|
| 3 |
+
"do_sample": true,
|
| 4 |
+
"eos_token_id": 2,
|
| 5 |
+
"max_new_tokens": 256,
|
| 6 |
+
"pad_token_id": 0,
|
| 7 |
+
"repetition_penalty": 1.1,
|
| 8 |
+
"temperature": 0.8,
|
| 9 |
+
"top_p": 0.95,
|
| 10 |
+
"transformers_version": "5.14.1"
|
| 11 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:22febd2130ee0e387ed0e396acd9c56571bc5017e5cc488d04590983f4764f0d
|
| 3 |
+
size 606726400
|
tokenizer.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"backend": "tokenizers",
|
| 3 |
+
"bos_token": "<|bos|>",
|
| 4 |
+
"clean_up_tokenization_spaces": false,
|
| 5 |
+
"eos_token": "<|eos|>",
|
| 6 |
+
"is_local": false,
|
| 7 |
+
"local_files_only": false,
|
| 8 |
+
"max_length": 1024,
|
| 9 |
+
"model_input_names": [
|
| 10 |
+
"input_ids",
|
| 11 |
+
"attention_mask"
|
| 12 |
+
],
|
| 13 |
+
"model_max_length": 1024,
|
| 14 |
+
"pad_token": "<|pad|>",
|
| 15 |
+
"return_token_type_ids": false,
|
| 16 |
+
"stride": 0,
|
| 17 |
+
"tokenizer_class": "TokenizersBackend",
|
| 18 |
+
"truncation_side": "right",
|
| 19 |
+
"truncation_strategy": "longest_first"
|
| 20 |
+
}
|