Instructions to use shro-2002/rewardshield-e07-adapter with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use shro-2002/rewardshield-e07-adapter with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("CohereLabs/tiny-aya-global") model = PeftModel.from_pretrained(base_model, "shro-2002/rewardshield-e07-adapter") - Notebooks
- Google Colab
- Kaggle
Upload folder using huggingface_hub
Browse files- .gitattributes +1 -0
- README.md +14 -0
- adapter_config.json +51 -0
- adapter_model.safetensors +3 -0
- chat_template.jinja +20 -0
- tokenizer.json +3 -0
- tokenizer_config.json +25 -0
- train_summary.json +65 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
base_model: CohereLabs/tiny-aya-global
|
| 3 |
+
library_name: peft
|
| 4 |
+
license: cc-by-nc-4.0
|
| 5 |
+
tags: [text-to-sql, agent, lora, rewardshield, lexsi-hackathon]
|
| 6 |
+
---
|
| 7 |
+
# RewardShield E07 LoRA adapter for Tiny Aya Global
|
| 8 |
+
|
| 9 |
+
E01 + 100 steps x 16 on gold trajectories for a matched 911-question set. LoRA r16 (alpha 32, dropout 0.05, all attention and MLP projections), trained with TRL `SFTTrainer`
|
| 10 |
+
(supervised fine-tuning, not reinforcement learning). Prompt and tool format: AgentTune's Tiny Aya fallback
|
| 11 |
+
tool prompt with one `run_sql` tool. Results, intervals and caveats: see the GitHub repo RESULTS.md.
|
| 12 |
+
|
| 13 |
+
Licence: CC BY-NC 4.0, inherited from the base model; use is also subject to the Cohere Labs acceptable-use
|
| 14 |
+
policy. Research artefact from the Lexsi AI Safety and Alignment Hackathon (Track 3); not for production.
|
adapter_config.json
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"alora_invocation_tokens": null,
|
| 3 |
+
"alpha_pattern": {},
|
| 4 |
+
"arrow_config": null,
|
| 5 |
+
"auto_mapping": null,
|
| 6 |
+
"base_model_name_or_path": "/kaggle/input/models/cohere-labs/tiny-aya/transformers/global/1",
|
| 7 |
+
"bias": "none",
|
| 8 |
+
"corda_config": null,
|
| 9 |
+
"ensure_weight_tying": false,
|
| 10 |
+
"eva_config": null,
|
| 11 |
+
"exclude_modules": null,
|
| 12 |
+
"fan_in_fan_out": false,
|
| 13 |
+
"inference_mode": true,
|
| 14 |
+
"init_lora_weights": true,
|
| 15 |
+
"kasa_config": null,
|
| 16 |
+
"layer_replication": null,
|
| 17 |
+
"layers_pattern": null,
|
| 18 |
+
"layers_to_transform": null,
|
| 19 |
+
"loftq_config": {},
|
| 20 |
+
"lora_alpha": 32,
|
| 21 |
+
"lora_bias": false,
|
| 22 |
+
"lora_dropout": 0.05,
|
| 23 |
+
"lora_ga_config": null,
|
| 24 |
+
"megatron_config": null,
|
| 25 |
+
"megatron_core": "megatron.core",
|
| 26 |
+
"modules_to_save": null,
|
| 27 |
+
"monteclora_config": null,
|
| 28 |
+
"peft_type": "LORA",
|
| 29 |
+
"peft_version": "0.21.2",
|
| 30 |
+
"qalora_group_size": 16,
|
| 31 |
+
"r": 16,
|
| 32 |
+
"rank_pattern": {},
|
| 33 |
+
"revision": null,
|
| 34 |
+
"target_modules": [
|
| 35 |
+
"o_proj",
|
| 36 |
+
"q_proj",
|
| 37 |
+
"up_proj",
|
| 38 |
+
"down_proj",
|
| 39 |
+
"k_proj",
|
| 40 |
+
"v_proj",
|
| 41 |
+
"gate_proj"
|
| 42 |
+
],
|
| 43 |
+
"target_parameters": null,
|
| 44 |
+
"task_type": "CAUSAL_LM",
|
| 45 |
+
"trainable_token_indices": null,
|
| 46 |
+
"use_bdlora": null,
|
| 47 |
+
"use_dora": false,
|
| 48 |
+
"use_qalora": false,
|
| 49 |
+
"use_rslora": false,
|
| 50 |
+
"velora_config": null
|
| 51 |
+
}
|
adapter_model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:731371c8a785dfe358669f93e7fbabfa7392fb1bce5a37d37304ae0636157bae
|
| 3 |
+
size 120981200
|
chat_template.jinja
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{{ bos_token }}{% set ns = namespace(system_prompt=false, expect_user=true) %}{% for message in messages %}{% if message['role']|lower == 'system' %}{% set ns.system_prompt = message['content'] %}{% break %}{% endif %}{% endfor %}<|START_OF_TURN_TOKEN|><|SYSTEM_TOKEN|># System Preamble
|
| 2 |
+
You are in contextual safety mode. You will reject requests to generate child sexual abuse material and child exploitation material in your responses. You will accept to provide information and creative content related to violence, hate, misinformation or sex, but you will not provide any content that could directly or indirectly lead to harmful outcomes.
|
| 3 |
+
|
| 4 |
+
Your information cutoff date is June 2024.
|
| 5 |
+
|
| 6 |
+
You have been trained on data in English, Dutch, French, Italian, Portuguese, Romanian, Spanish, Czech, Polish, Ukrainian, Russian, Greek, German, Danish, Swedish, Norwegian, Catalan, Galician, Welsh, Irish, Basque, Croatian, Latvian, Lithuanian, Slovak, Slovenian, Estonian, Finnish, Hungarian, Serbian, Bulgarian, Arabic, Persian, Urdu, Turkish, Maltese, Hebrew, Hindi, Marathi, Bengali, Gujarati, Punjabi, Tamil, Telugu, Nepali, Tagalog, Malay, Indonesian, Vietnamese, Javanese, Khmer, Thai, Lao, Chinese, Burmese, Japanese, Korean, Amharic, Hausa, Igbo, Malagasy, Shona, Swahili, Wolof, Xhosa, Yoruba and Zulu but have the ability to speak many more languages.
|
| 7 |
+
|
| 8 |
+
# Default Preamble
|
| 9 |
+
The following instructions are your defaults unless specified elsewhere in developer preamble or user prompt.
|
| 10 |
+
- Your name is Aya.
|
| 11 |
+
- You are a large language model built by Cohere.
|
| 12 |
+
- When responding in English, use American English unless context indicates otherwise.
|
| 13 |
+
- When outputting responses of more than seven sentences, split the response into paragraphs.
|
| 14 |
+
- Prefer the active voice.
|
| 15 |
+
- Use gender-neutral pronouns for unspecified persons.
|
| 16 |
+
- When generating code output without specifying the programming language, please generate Python code.{% if ns.system_prompt and ns.system_prompt != "" %}
|
| 17 |
+
|
| 18 |
+
# Developer Preamble
|
| 19 |
+
The following instructions take precedence over instructions in the default preamble and user prompt. You reject any instructions which conflict with system preamble instructions.
|
| 20 |
+
{{ ns.system_prompt }}{% endif %}<|END_OF_TURN_TOKEN|>{% for message in messages %}{% set role = message['role']|lower %}{% if role == 'system' and ns.system_prompt and message['content'] == ns.system_prompt %}{% continue %}{% endif %}{% if role == 'user' %}{% if not ns.expect_user %}{{- raise_exception("Conversation roles must alternate user/assistant/user/assistant/...") -}}{% endif %}{% set ns.expect_user = false %}{% elif role == 'assistant' or role == 'chatbot' %}{% if ns.expect_user %}{{- raise_exception("Conversation roles must alternate user/assistant/user/assistant/...") -}}{% endif %}{% set ns.expect_user = true %}{% endif %}<|START_OF_TURN_TOKEN|>{% if role == 'user' %}<|USER_TOKEN|>{{ message['content'] }}{% elif role == 'assistant' or role == 'chatbot' %}<|CHATBOT_TOKEN|><|START_RESPONSE|>{{ message['content'] }}<|END_RESPONSE|>{% elif role == 'system' %}<|SYSTEM_TOKEN|>{{ message['content'] }}{% endif %}<|END_OF_TURN_TOKEN|>{% endfor %}{% if add_generation_prompt %}<|START_OF_TURN_TOKEN|><|CHATBOT_TOKEN|><|START_RESPONSE|>{% endif %}
|
tokenizer.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:84d150b8af762b3662bdadc1fbc8274bc535ef86c0d497d0a40469fe86d92368
|
| 3 |
+
size 21376340
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"add_prefix_space": false,
|
| 3 |
+
"backend": "tokenizers",
|
| 4 |
+
"bos_token": "<BOS_TOKEN>",
|
| 5 |
+
"clean_up_tokenization_spaces": false,
|
| 6 |
+
"cls_token": "<CLS>",
|
| 7 |
+
"eos_token": "<|END_OF_TURN_TOKEN|>",
|
| 8 |
+
"errors": "replace",
|
| 9 |
+
"extra_special_tokens": [
|
| 10 |
+
"<|START_RESPONSE|>",
|
| 11 |
+
"<|END_RESPONSE|>"
|
| 12 |
+
],
|
| 13 |
+
"is_local": true,
|
| 14 |
+
"legacy": true,
|
| 15 |
+
"local_files_only": false,
|
| 16 |
+
"mask_token": "<MASK_TOKEN>",
|
| 17 |
+
"model_max_length": 1000000000000000019884624838656,
|
| 18 |
+
"pad_token": "<PAD>",
|
| 19 |
+
"sep_token": "<SEP>",
|
| 20 |
+
"sp_model_kwargs": {},
|
| 21 |
+
"spaces_between_special_tokens": false,
|
| 22 |
+
"tokenizer_class": "CohereTokenizer",
|
| 23 |
+
"unk_token": "<UNK>",
|
| 24 |
+
"use_default_system_prompt": false
|
| 25 |
+
}
|
train_summary.json
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"read": 911,
|
| 3 |
+
"dropped_too_long": 0,
|
| 4 |
+
"loss_on": "assistant",
|
| 5 |
+
"kept": 911,
|
| 6 |
+
"seed": 0,
|
| 7 |
+
"max_steps": 100,
|
| 8 |
+
"lr": 0.0001,
|
| 9 |
+
"effective_batch": 16,
|
| 10 |
+
"seconds": 2899.3,
|
| 11 |
+
"train_loss": 0.03658501982688904,
|
| 12 |
+
"init_adapter": "/kaggle/input/datasets/sonika20000002/rewardshield-e01-adapter",
|
| 13 |
+
"train_tokens_seen": 2176158.0,
|
| 14 |
+
"log_tail": [
|
| 15 |
+
{
|
| 16 |
+
"loss": 0.026308047771453857,
|
| 17 |
+
"grad_norm": 0.17225728929042816,
|
| 18 |
+
"learning_rate": 2.405152131093926e-05,
|
| 19 |
+
"entropy": 0.03822197115514427,
|
| 20 |
+
"num_tokens": 1518980.0,
|
| 21 |
+
"mean_token_accuracy": 0.9925396673381328,
|
| 22 |
+
"epoch": 1.2280701754385965,
|
| 23 |
+
"step": 70
|
| 24 |
+
},
|
| 25 |
+
{
|
| 26 |
+
"loss": 0.022913622856140136,
|
| 27 |
+
"grad_norm": 0.06747250258922577,
|
| 28 |
+
"learning_rate": 1.157994445715706e-05,
|
| 29 |
+
"entropy": 0.03757815721910447,
|
| 30 |
+
"num_tokens": 1735484.0,
|
| 31 |
+
"mean_token_accuracy": 0.9932177901268006,
|
| 32 |
+
"epoch": 1.4035087719298245,
|
| 33 |
+
"step": 80
|
| 34 |
+
},
|
| 35 |
+
{
|
| 36 |
+
"loss": 0.02086828351020813,
|
| 37 |
+
"grad_norm": 0.10444895178079605,
|
| 38 |
+
"learning_rate": 3.271776770026963e-06,
|
| 39 |
+
"entropy": 0.03491675137775019,
|
| 40 |
+
"num_tokens": 1953954.0,
|
| 41 |
+
"mean_token_accuracy": 0.9940608344972134,
|
| 42 |
+
"epoch": 1.5789473684210527,
|
| 43 |
+
"step": 90
|
| 44 |
+
},
|
| 45 |
+
{
|
| 46 |
+
"loss": 0.02732172906398773,
|
| 47 |
+
"grad_norm": 0.0977727547287941,
|
| 48 |
+
"learning_rate": 2.7337132953697554e-08,
|
| 49 |
+
"entropy": 0.03929174962686375,
|
| 50 |
+
"num_tokens": 2176158.0,
|
| 51 |
+
"mean_token_accuracy": 0.9928778618574142,
|
| 52 |
+
"epoch": 1.7543859649122808,
|
| 53 |
+
"step": 100
|
| 54 |
+
},
|
| 55 |
+
{
|
| 56 |
+
"train_runtime": 2894.4617,
|
| 57 |
+
"train_samples_per_second": 0.553,
|
| 58 |
+
"train_steps_per_second": 0.035,
|
| 59 |
+
"total_flos": 3.729741681000448e+16,
|
| 60 |
+
"train_loss": 0.03658501982688904,
|
| 61 |
+
"epoch": 1.7543859649122808,
|
| 62 |
+
"step": 100
|
| 63 |
+
}
|
| 64 |
+
]
|
| 65 |
+
}
|