初始化项目,由ModelHub XC社区提供模型
Model: HuggingFaceTB/SmolLM-360M-Instruct Source: Original Platform
This commit is contained in:
44
.gitattributes
vendored
Normal file
44
.gitattributes
vendored
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
*.7z filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.arrow filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.bin filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.ftz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.gz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.h5 filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.joblib filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.model filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.npy filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.npz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.onnx filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.ot filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.parquet filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pb filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pickle filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pkl filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pt filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pth filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.rar filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
||||||
|
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tar filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tflite filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tgz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.wasm filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.xz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.zip filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.zst filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
||||||
|
model.safetensors filter=lfs diff=lfs merge=lfs -text
|
||||||
|
onnx/model.onnx filter=lfs diff=lfs merge=lfs -text
|
||||||
|
onnx/model_bnb4.onnx filter=lfs diff=lfs merge=lfs -text
|
||||||
|
onnx/model_fp16.onnx filter=lfs diff=lfs merge=lfs -text
|
||||||
|
onnx/model_int8.onnx filter=lfs diff=lfs merge=lfs -text
|
||||||
|
onnx/model_q4.onnx filter=lfs diff=lfs merge=lfs -text
|
||||||
|
onnx/model_q4f16.onnx filter=lfs diff=lfs merge=lfs -text
|
||||||
|
onnx/model_quantized.onnx filter=lfs diff=lfs merge=lfs -text
|
||||||
|
onnx/model_uint8.onnx filter=lfs diff=lfs merge=lfs -text
|
||||||
109
README.md
Normal file
109
README.md
Normal file
@@ -0,0 +1,109 @@
|
|||||||
|
---
|
||||||
|
license: apache-2.0
|
||||||
|
base_model: HuggingFaceTB/SmolLM-360M
|
||||||
|
tags:
|
||||||
|
- alignment-handbook
|
||||||
|
- trl
|
||||||
|
- sft
|
||||||
|
datasets:
|
||||||
|
- Magpie-Align/Magpie-Pro-300K-Filtered
|
||||||
|
- bigcode/self-oss-instruct-sc2-exec-filter-50k
|
||||||
|
- teknium/OpenHermes-2.5
|
||||||
|
- HuggingFaceTB/everyday-conversations-llama3.1-2k
|
||||||
|
library_name: transformers
|
||||||
|
language:
|
||||||
|
- en
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
# SmolLM-360M-Instruct
|
||||||
|
|
||||||
|
<center>
|
||||||
|
<img src="https://huggingface.co/datasets/HuggingFaceTB/images/resolve/main/banner_smol.png" alt="SmolLM" width="1100" height="600">
|
||||||
|
</center>
|
||||||
|
|
||||||
|
|
||||||
|
## Model Summary
|
||||||
|
Chat with the model at: https://huggingface.co/spaces/HuggingFaceTB/instant-smol
|
||||||
|
|
||||||
|
SmolLM is a series of language models available in three sizes: 135M, 360M, and 1.7B parameters.
|
||||||
|
|
||||||
|
These models are trained on [SmolLM-Corpus](https://huggingface.co/datasets/HuggingFaceTB/smollm-corpus), a curated collection of high-quality educational and synthetic data designed for training LLMs. For further details, we refer to our [blogpost](https://huggingface.co/blog/smollm).
|
||||||
|
|
||||||
|
To build SmolLM-Instruct, we finetune the base models on publicly available datasets.
|
||||||
|
|
||||||
|
## Changelog
|
||||||
|
|
||||||
|
|Release|Description|
|
||||||
|
|-|-|
|
||||||
|
|v0.1| Initial release of SmolLM-Instruct. We finetune on the permissive subset of the [WebInstructSub](https://huggingface.co/datasets/TIGER-Lab/WebInstructSub) dataset, combined with [StarCoder2-Self-OSS-Instruct](https://huggingface.co/datasets/bigcode/self-oss-instruct-sc2-exec-filter-50k). Then, we perform DPO (Direct Preference Optimization) for one epoch on [HelpSteer](https://huggingface.co/datasets/nvidia/HelpSteer) for the 135M and 1.7B models, and [argilla/dpo-mix-7k](https://huggingface.co/datasets/argilla/dpo-mix-7k) for the 360M model.|
|
||||||
|
|v0.2| We changed the finetuning mix to datasets more suitable for smol models. We train on a new dataset of 2k simple everyday conversations we generated by llama3.1-70B [everyday-conversations-llama3.1-2k](https://huggingface.co/datasets/HuggingFaceTB/everyday-conversations-llama3.1-2k/), [Magpie-Pro-300K-Filtere](https://huggingface.co/datasets/Magpie-Align/Magpie-Pro-300K-Filtered), [StarCoder2-Self-OSS-Instruct](https://huggingface.co/datasets/bigcode/self-oss-instruct-sc2-exec-filter-50k), and a small subset of [OpenHermes-2.5](https://huggingface.co/datasets/teknium/OpenHermes-2.5)|
|
||||||
|
|
||||||
|
|
||||||
|
v0.2 models are better at staying on topic and responding appropriately to standard prompts, such as greetings and questions about their role as AI assistants. SmolLM-360M-Instruct (v0.2) has a 63.3% win rate over SmolLM-360M-Instruct (v0.1) on AlpacaEval. You can find the details [here](https://huggingface.co/datasets/HuggingFaceTB/alpaca_eval_details/).
|
||||||
|
|
||||||
|
You can load v0.1 models by specifying `revision="v0.1"` in the transformers code:
|
||||||
|
```python
|
||||||
|
model = AutoModelForCausalLM.from_pretrained("HuggingFaceTB/SmolLM-360M-Instruct", revision="v0.1")
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
### Local Applications
|
||||||
|
⚡ For local applications, you can find optimized implementations of the model in MLC, GGUF and Transformers.js formats, in addition to fast in-browser demos in this collection: https://huggingface.co/collections/HuggingFaceTB/local-smollms-66c0f3b2a15b4eed7fb198d0
|
||||||
|
|
||||||
|
We noticed that 4bit quantization degrades the quality of the 135M and 360M, so we use `q016` for MLC and ONNX/Transformers.js checkpoints for the WebGPU demos. We also suggest using temperature 0.2 and top-p 0.9.
|
||||||
|
|
||||||
|
### Transformers
|
||||||
|
```bash
|
||||||
|
pip install transformers
|
||||||
|
```
|
||||||
|
|
||||||
|
```python
|
||||||
|
# pip install transformers
|
||||||
|
from transformers import AutoModelForCausalLM, AutoTokenizer
|
||||||
|
checkpoint = "HuggingFaceTB/SmolLM-360M-Instruct"
|
||||||
|
|
||||||
|
device = "cuda" # for GPU usage or "cpu" for CPU usage
|
||||||
|
tokenizer = AutoTokenizer.from_pretrained(checkpoint)
|
||||||
|
# for multiple GPUs install accelerate and do `model = AutoModelForCausalLM.from_pretrained(checkpoint, device_map="auto")`
|
||||||
|
model = AutoModelForCausalLM.from_pretrained(checkpoint).to(device)
|
||||||
|
|
||||||
|
messages = [{"role": "user", "content": "What is the capital of France."}]
|
||||||
|
input_text=tokenizer.apply_chat_template(messages, tokenize=False)
|
||||||
|
print(input_text)
|
||||||
|
inputs = tokenizer.encode(input_text, return_tensors="pt").to(device)
|
||||||
|
outputs = model.generate(inputs, max_new_tokens=50, temperature=0.2, top_p=0.9, do_sample=True)
|
||||||
|
print(tokenizer.decode(outputs[0]))
|
||||||
|
```
|
||||||
|
|
||||||
|
### Chat in TRL
|
||||||
|
You can also use the TRL CLI to chat with the model from the terminal:
|
||||||
|
```bash
|
||||||
|
pip install trl
|
||||||
|
trl chat --model_name_or_path HuggingFaceTB/SmolLM-360M-Instruct --device cpu
|
||||||
|
```
|
||||||
|
|
||||||
|
## Limitations
|
||||||
|
|
||||||
|
Additionally, the generated content may not always be factually accurate, logically consistent, or free from biases present in the training data, we invite users to leverage them as assistive tools rather than definitive sources of information. We find that they can handle general knowledge questions, creative writing and basic Python programming. But they are English only and may have difficulty with arithmetics, editing tasks and complex reasoning. For more details about the models' capabilities, please refer to our [blog post](https://huggingface.co/blog/smollm).
|
||||||
|
|
||||||
|
## Training parameters
|
||||||
|
We train the models using the [alignment-handbook](https://github.com/huggingface/alignment-handbook) with the datasets mentioned in the changelog, using these parameters for v0.2 (most of them are from Zephyr Gemma recipe):
|
||||||
|
- 1 epoch
|
||||||
|
- lr 1e-3
|
||||||
|
- cosine schedule
|
||||||
|
- warmup ratio 0.1
|
||||||
|
- global batch size 262k tokens
|
||||||
|
|
||||||
|
You can find the training recipe here: https://github.com/huggingface/alignment-handbook/tree/smollm/recipes/smollm
|
||||||
|
|
||||||
|
|
||||||
|
# Citation
|
||||||
|
```bash
|
||||||
|
@misc{allal2024SmolLM,
|
||||||
|
title={SmolLM - blazingly fast and remarkably powerful},
|
||||||
|
author={Loubna Ben Allal and Anton Lozhkov and Elie Bakouch and Leandro von Werra and Thomas Wolf},
|
||||||
|
year={2024},
|
||||||
|
}
|
||||||
|
```
|
||||||
30
config.json
Normal file
30
config.json
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
{
|
||||||
|
"_name_or_path": "HuggingFaceTB/SmolLM-360M",
|
||||||
|
"architectures": [
|
||||||
|
"LlamaForCausalLM"
|
||||||
|
],
|
||||||
|
"attention_bias": false,
|
||||||
|
"attention_dropout": 0.0,
|
||||||
|
"bos_token_id": 1,
|
||||||
|
"eos_token_id": 2,
|
||||||
|
"hidden_act": "silu",
|
||||||
|
"hidden_size": 960,
|
||||||
|
"initializer_range": 0.02,
|
||||||
|
"intermediate_size": 2560,
|
||||||
|
"max_position_embeddings": 2048,
|
||||||
|
"mlp_bias": false,
|
||||||
|
"model_type": "llama",
|
||||||
|
"num_attention_heads": 15,
|
||||||
|
"num_hidden_layers": 32,
|
||||||
|
"num_key_value_heads": 5,
|
||||||
|
"pad_token_id": 2,
|
||||||
|
"pretraining_tp": 1,
|
||||||
|
"rms_norm_eps": 1e-05,
|
||||||
|
"rope_scaling": null,
|
||||||
|
"rope_theta": 10000.0,
|
||||||
|
"tie_word_embeddings": true,
|
||||||
|
"torch_dtype": "bfloat16",
|
||||||
|
"transformers_version": "4.42.3",
|
||||||
|
"use_cache": true,
|
||||||
|
"vocab_size": 49152
|
||||||
|
}
|
||||||
1
configuration.json
Normal file
1
configuration.json
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{"framework": "pytorch", "task": "text-generation", "allow_remote": true}
|
||||||
8
generation_config.json
Normal file
8
generation_config.json
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"_from_model_config": true,
|
||||||
|
"bos_token_id": 1,
|
||||||
|
"eos_token_id": 2,
|
||||||
|
"pad_token_id": 2,
|
||||||
|
"max_new_tokens": 40,
|
||||||
|
"transformers_version": "4.42.3"
|
||||||
|
}
|
||||||
48901
merges.txt
Normal file
48901
merges.txt
Normal file
File diff suppressed because it is too large
Load Diff
3
model.safetensors
Normal file
3
model.safetensors
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:7f841de9bf656ea5af3c8d89e5647ee0f39121b28adf4202d1eec02f69619c5e
|
||||||
|
size 723674912
|
||||||
3
onnx/model.onnx
Normal file
3
onnx/model.onnx
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:454394e1f92c1479bf71926b2cc845a3e29040c0844ba0d97ce693a390bca40c
|
||||||
|
size 1448299818
|
||||||
3
onnx/model_bnb4.onnx
Normal file
3
onnx/model_bnb4.onnx
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:359ed0877d941aa2adf227aed8c209017dc0a7de6416ef322df6492356ba50e9
|
||||||
|
size 366990971
|
||||||
3
onnx/model_fp16.onnx
Normal file
3
onnx/model_fp16.onnx
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:5e617d2597f06572ed87667f62a8a29e18bd5763fcb2606f7ad956b3f42d1cc6
|
||||||
|
size 724678342
|
||||||
3
onnx/model_int8.onnx
Normal file
3
onnx/model_int8.onnx
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:c42d79415353fe2d1470c2b3e27ad1dd84595cd2d31c93773d93e2df92ab5bcb
|
||||||
|
size 363269280
|
||||||
3
onnx/model_q4.onnx
Normal file
3
onnx/model_q4.onnx
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:d8001535cd703e7c9afe6f6cf8f48e41ec6e162eb677ac39632787ad380ac2d7
|
||||||
|
size 386650043
|
||||||
3
onnx/model_q4f16.onnx
Normal file
3
onnx/model_q4f16.onnx
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:e1a788453e1393e8642f43ca729b7f2301ba61cc1f8ac1f1904c809869fc1ffb
|
||||||
|
size 272513495
|
||||||
3
onnx/model_quantized.onnx
Normal file
3
onnx/model_quantized.onnx
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:c42d79415353fe2d1470c2b3e27ad1dd84595cd2d31c93773d93e2df92ab5bcb
|
||||||
|
size 363269280
|
||||||
3
onnx/model_uint8.onnx
Normal file
3
onnx/model_uint8.onnx
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:8f3309c58be313a8dce00de2f9d009e52c273d814ddc230e0a83e7cee8075c63
|
||||||
|
size 363269392
|
||||||
28
special_tokens_map.json
Normal file
28
special_tokens_map.json
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
{
|
||||||
|
"additional_special_tokens": [
|
||||||
|
{
|
||||||
|
"content": "<|im_start|>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"content": "<|im_end|>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"bos_token": "<|im_start|>",
|
||||||
|
"eos_token": "<|im_end|>",
|
||||||
|
"pad_token": "<|im_end|>",
|
||||||
|
"unk_token": {
|
||||||
|
"content": "<|endoftext|>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false
|
||||||
|
}
|
||||||
|
}
|
||||||
106
test_prompts.py
Normal file
106
test_prompts.py
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
from transformers import AutoModelForCausalLM, AutoTokenizer
|
||||||
|
|
||||||
|
BASE_PATH = "/fsx/loubna/projects/alignment-handbook/recipes/cosmo2/sft/data"
|
||||||
|
TEMPERATURE = 0.2
|
||||||
|
TOP_P = 0.9
|
||||||
|
|
||||||
|
CHECKPOINT = "loubnabnl/smollm-350M-instruct-add-basics"
|
||||||
|
|
||||||
|
print(f"💾 Loading the model and tokenizer: {CHECKPOINT}...")
|
||||||
|
device = "cuda"
|
||||||
|
tokenizer = AutoTokenizer.from_pretrained(CHECKPOINT)
|
||||||
|
model_s = AutoModelForCausalLM.from_pretrained(CHECKPOINT).to(device)
|
||||||
|
|
||||||
|
print("🧪 Testing single-turn conversations...")
|
||||||
|
L = [
|
||||||
|
"Hi",
|
||||||
|
"Hello",
|
||||||
|
"Tell me a joke",
|
||||||
|
"Who are you?",
|
||||||
|
"What's your name?",
|
||||||
|
"How do I make pancakes?",
|
||||||
|
"Can you tell me what is gravity?",
|
||||||
|
"What is the capital of Morocco?",
|
||||||
|
"What's 2+2?",
|
||||||
|
"Hi, what is 2+1?",
|
||||||
|
"What's 3+5?",
|
||||||
|
"Write a poem about Helium",
|
||||||
|
"Hi, what are some popular dishes from Japan?",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
for i in range(len(L)):
|
||||||
|
print(f"🔮 {L[i]}")
|
||||||
|
messages = [{"role": "user", "content": L[i]}]
|
||||||
|
input_text = tokenizer.apply_chat_template(messages, tokenize=False)
|
||||||
|
inputs = tokenizer.encode(input_text, return_tensors="pt").to(device)
|
||||||
|
outputs = model_s.generate(
|
||||||
|
inputs, max_new_tokens=200, top_p=TOP_P, do_sample=True, temperature=TEMPERATURE
|
||||||
|
)
|
||||||
|
with open(
|
||||||
|
f"{BASE_PATH}/{CHECKPOINT.split('/')[-1]}_temp_{TEMPERATURE}_topp{TOP_P}.txt",
|
||||||
|
"a",
|
||||||
|
) as f:
|
||||||
|
f.write("=" * 50 + "\n")
|
||||||
|
f.write(tokenizer.decode(outputs[0]))
|
||||||
|
f.write("\n")
|
||||||
|
|
||||||
|
|
||||||
|
print("🧪 Now testing multi-turn conversations...")
|
||||||
|
# Multi-turn conversations
|
||||||
|
messages_1 = [
|
||||||
|
{"role": "user", "content": "Hi"},
|
||||||
|
{"role": "assistant", "content": "Hello! How can I help you today?"},
|
||||||
|
{"role": "user", "content": "What's 2+2?"},
|
||||||
|
]
|
||||||
|
messages_2 = [
|
||||||
|
{"role": "user", "content": "Hi"},
|
||||||
|
{"role": "assistant", "content": "Hello! How can I help you today?"},
|
||||||
|
{"role": "user", "content": "What's 2+2?"},
|
||||||
|
{"role": "assistant", "content": "4"},
|
||||||
|
{"role": "user", "content": "Why?"},
|
||||||
|
]
|
||||||
|
messages_3 = [
|
||||||
|
{"role": "user", "content": "Who are you?"},
|
||||||
|
{"role": "assistant", "content": "I am an AI assistant. How can I help you today?"},
|
||||||
|
{"role": "user", "content": "What's your name?"},
|
||||||
|
]
|
||||||
|
messages_4 = [
|
||||||
|
{"role": "user", "content": "Tell me a joke"},
|
||||||
|
{"role": "assistant", "content": "Sure! Why did the tomato turn red?"},
|
||||||
|
{"role": "user", "content": "Why?"},
|
||||||
|
]
|
||||||
|
messages_5 = [
|
||||||
|
{"role": "user", "content": "Can you tell me what is gravity?"},
|
||||||
|
{
|
||||||
|
"role": "assistant",
|
||||||
|
"content": "Sure! Gravity is a force that attracts objects toward each other. It is what keeps us on the ground and what makes things fall.",
|
||||||
|
},
|
||||||
|
{"role": "user", "content": "Who discovered it?"},
|
||||||
|
]
|
||||||
|
messages_6 = [
|
||||||
|
{"role": "user", "content": "How do I make pancakes?"},
|
||||||
|
{
|
||||||
|
"role": "assistant",
|
||||||
|
"content": "Sure! Here is a simple recipe for pancakes: Ingredients: 1 cup flour, 1 cup milk, 1 egg, 1 tbsp sugar, 1 tsp baking powder, 1/2 tsp salt. Instructions: 1. Mix all the dry ingredients together in a bowl. 2. Add the milk and egg and mix until smooth. 3. Heat a non-stick pan over medium heat. 4. Pour 1/4 cup of batter onto the pan. 5. Cook until bubbles form on the surface, then flip and cook for another minute. 6. Serve with your favorite toppings.",
|
||||||
|
},
|
||||||
|
{"role": "user", "content": "What are some popular toppings?"},
|
||||||
|
]
|
||||||
|
|
||||||
|
L = [messages_1, messages_2, messages_3, messages_4, messages_5, messages_6]
|
||||||
|
|
||||||
|
for i in range(len(L)):
|
||||||
|
input_text = tokenizer.apply_chat_template(L[i], tokenize=False)
|
||||||
|
inputs = tokenizer.encode(input_text, return_tensors="pt").to(device)
|
||||||
|
outputs = model_s.generate(
|
||||||
|
inputs, max_new_tokens=200, top_p=TOP_P, do_sample=True, temperature=TEMPERATURE
|
||||||
|
)
|
||||||
|
with open(
|
||||||
|
f"{BASE_PATH}/{CHECKPOINT.split('/')[-1]}_temp_{TEMPERATURE}_topp{TOP_P}_MT.txt",
|
||||||
|
"a",
|
||||||
|
) as f:
|
||||||
|
f.write("=" * 50 + "\n")
|
||||||
|
f.write(tokenizer.decode(outputs[0]))
|
||||||
|
f.write("\n")
|
||||||
|
|
||||||
|
print("🔥 Done!")
|
||||||
98249
tokenizer.json
Normal file
98249
tokenizer.json
Normal file
File diff suppressed because it is too large
Load Diff
154
tokenizer_config.json
Normal file
154
tokenizer_config.json
Normal file
@@ -0,0 +1,154 @@
|
|||||||
|
{
|
||||||
|
"add_prefix_space": false,
|
||||||
|
"added_tokens_decoder": {
|
||||||
|
"0": {
|
||||||
|
"content": "<|endoftext|>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"1": {
|
||||||
|
"content": "<|im_start|>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"2": {
|
||||||
|
"content": "<|im_end|>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"3": {
|
||||||
|
"content": "<repo_name>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"4": {
|
||||||
|
"content": "<reponame>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"5": {
|
||||||
|
"content": "<file_sep>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"6": {
|
||||||
|
"content": "<filename>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"7": {
|
||||||
|
"content": "<gh_stars>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"8": {
|
||||||
|
"content": "<issue_start>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"9": {
|
||||||
|
"content": "<issue_comment>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"10": {
|
||||||
|
"content": "<issue_closed>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"11": {
|
||||||
|
"content": "<jupyter_start>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"12": {
|
||||||
|
"content": "<jupyter_text>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"13": {
|
||||||
|
"content": "<jupyter_code>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"14": {
|
||||||
|
"content": "<jupyter_output>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"15": {
|
||||||
|
"content": "<jupyter_script>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"16": {
|
||||||
|
"content": "<empty_output>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false,
|
||||||
|
"special": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additional_special_tokens": [
|
||||||
|
"<|im_start|>",
|
||||||
|
"<|im_end|>"
|
||||||
|
],
|
||||||
|
"bos_token": "<|im_start|>",
|
||||||
|
"chat_template": "{% for message in messages %}{{'<|im_start|>' + message['role'] + '\n' + message['content'] + '<|im_end|>' + '\n'}}{% endfor %}{% if add_generation_prompt %}{{ '<|im_start|>assistant\n' }}{% endif %}",
|
||||||
|
"clean_up_tokenization_spaces": false,
|
||||||
|
"eos_token": "<|im_end|>",
|
||||||
|
"model_max_length": 2048,
|
||||||
|
"pad_token": "<|im_end|>",
|
||||||
|
"tokenizer_class": "GPT2Tokenizer",
|
||||||
|
"unk_token": "<|endoftext|>",
|
||||||
|
"vocab_size": 49152
|
||||||
|
}
|
||||||
1
vocab.json
Normal file
1
vocab.json
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user