Add files using upload-large-folder tool
Browse files- .gitattributes +5 -35
- Dockerfile +24 -0
- data/log_dataset.jsonl +0 -0
- data_analyser.py +0 -0
- docker-compose.yml +19 -0
- merged_tinyllama_logger/config.json +29 -0
- merged_tinyllama_logger/generation_config.json +7 -0
- merged_tinyllama_logger/special_tokens_map.json +30 -0
- merged_tinyllama_logger/tokenizer.json +0 -0
- merged_tinyllama_logger/tokenizer_config.json +43 -0
- merging_model.py +52 -0
- model_output/incremental_1_logs/README.md +202 -0
- model_output/incremental_1_logs/adapter_config.json +29 -0
- model_output/incremental_1_logs/checkpoint-575/README.md +202 -0
- model_output/incremental_1_logs/checkpoint-575/adapter_config.json +29 -0
- model_output/incremental_1_logs/checkpoint-575/special_tokens_map.json +24 -0
- model_output/incremental_1_logs/checkpoint-575/tokenizer.json +0 -0
- model_output/incremental_1_logs/checkpoint-575/tokenizer_config.json +43 -0
- model_output/incremental_1_logs/checkpoint-575/trainer_state.json +625 -0
- model_output/incremental_1_logs/special_tokens_map.json +24 -0
- model_output/incremental_1_logs/tokenizer.json +0 -0
- model_output/incremental_1_logs/tokenizer_config.json +43 -0
- model_output/phi2_finetuned_logs/README.md +202 -0
- model_output/phi2_finetuned_logs/adapter_config.json +29 -0
- model_output/phi2_finetuned_logs/special_tokens_map.json +24 -0
- model_output/phi2_finetuned_logs/tokenizer.json +0 -0
- model_output/phi2_finetuned_logs/tokenizer_config.json +43 -0
- phivenv/Lib/site-packages/certifi-2025.8.3.dist-info/INSTALLER +1 -0
- phivenv/Lib/site-packages/certifi-2025.8.3.dist-info/METADATA +77 -0
- phivenv/Lib/site-packages/certifi-2025.8.3.dist-info/RECORD +14 -0
- phivenv/Lib/site-packages/certifi-2025.8.3.dist-info/WHEEL +5 -0
- phivenv/Lib/site-packages/certifi-2025.8.3.dist-info/licenses/LICENSE +20 -0
- phivenv/Lib/site-packages/certifi-2025.8.3.dist-info/top_level.txt +1 -0
- phivenv/Lib/site-packages/certifi/__init__.py +4 -0
- phivenv/Lib/site-packages/certifi/__main__.py +12 -0
- phivenv/Lib/site-packages/certifi/__pycache__/__init__.cpython-39.pyc +0 -0
- phivenv/Lib/site-packages/certifi/__pycache__/__main__.cpython-39.pyc +0 -0
- phivenv/Lib/site-packages/certifi/__pycache__/core.cpython-39.pyc +0 -0
- phivenv/Lib/site-packages/certifi/cacert.pem +0 -0
- phivenv/Lib/site-packages/certifi/core.py +83 -0
- phivenv/Lib/site-packages/certifi/py.typed +0 -0
- phivenv/Lib/site-packages/charset_normalizer/api.py +669 -0
- phivenv/Lib/site-packages/isympy.py +342 -0
- phivenv/Lib/site-packages/numpy-2.0.2-cp39-cp39-win_amd64.whl +0 -0
- phivenv/Lib/site-packages/typing_extensions.py +0 -0
- phivenv/pyvenv.cfg +3 -0
- requirements.txt +0 -0
- testing_merged_model.py +74 -0
- training_phi2.py +107 -0
- upload_to_hub.py +26 -0
.gitattributes
CHANGED
|
@@ -1,35 +1,5 @@
|
|
| 1 |
-
*.
|
| 2 |
-
*.
|
| 3 |
-
*.
|
| 4 |
-
*.
|
| 5 |
-
*.
|
| 6 |
-
*.ftz filter=lfs diff=lfs merge=lfs -text
|
| 7 |
-
*.gz filter=lfs diff=lfs merge=lfs -text
|
| 8 |
-
*.h5 filter=lfs diff=lfs merge=lfs -text
|
| 9 |
-
*.joblib filter=lfs diff=lfs merge=lfs -text
|
| 10 |
-
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
| 11 |
-
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
| 12 |
-
*.model filter=lfs diff=lfs merge=lfs -text
|
| 13 |
-
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
| 14 |
-
*.npy filter=lfs diff=lfs merge=lfs -text
|
| 15 |
-
*.npz filter=lfs diff=lfs merge=lfs -text
|
| 16 |
-
*.onnx filter=lfs diff=lfs merge=lfs -text
|
| 17 |
-
*.ot filter=lfs diff=lfs merge=lfs -text
|
| 18 |
-
*.parquet filter=lfs diff=lfs merge=lfs -text
|
| 19 |
-
*.pb filter=lfs diff=lfs merge=lfs -text
|
| 20 |
-
*.pickle filter=lfs diff=lfs merge=lfs -text
|
| 21 |
-
*.pkl filter=lfs diff=lfs merge=lfs -text
|
| 22 |
-
*.pt filter=lfs diff=lfs merge=lfs -text
|
| 23 |
-
*.pth filter=lfs diff=lfs merge=lfs -text
|
| 24 |
-
*.rar filter=lfs diff=lfs merge=lfs -text
|
| 25 |
-
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 26 |
-
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
| 27 |
-
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
| 28 |
-
*.tar filter=lfs diff=lfs merge=lfs -text
|
| 29 |
-
*.tflite filter=lfs diff=lfs merge=lfs -text
|
| 30 |
-
*.tgz filter=lfs diff=lfs merge=lfs -text
|
| 31 |
-
*.wasm filter=lfs diff=lfs merge=lfs -text
|
| 32 |
-
*.xz 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
|
|
|
|
| 1 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
| 2 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 3 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
| 4 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
| 5 |
+
*.tar filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Dockerfile
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM nvidia/cuda:12.1.1-devel-ubuntu22.04
|
| 2 |
+
|
| 3 |
+
ENV DEBIAN_FRONTEND=noninteractive
|
| 4 |
+
ENV PYTHONUNBUFFERED=1
|
| 5 |
+
|
| 6 |
+
RUN apt-get update && \
|
| 7 |
+
apt-get install -y python3 python3-pip git build-essential && \
|
| 8 |
+
rm -rf /var/lib/apt/lists/*
|
| 9 |
+
|
| 10 |
+
RUN pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121
|
| 11 |
+
|
| 12 |
+
RUN pip install transformers==4.42.3 \
|
| 13 |
+
peft==0.11.1 \
|
| 14 |
+
accelerate==0.30.1 \
|
| 15 |
+
bitsandbytes==0.43.1 \
|
| 16 |
+
trl==0.8.6 \
|
| 17 |
+
datasets==2.20.0 \
|
| 18 |
+
sentencepiece \
|
| 19 |
+
tensorboard
|
| 20 |
+
|
| 21 |
+
WORKDIR /app
|
| 22 |
+
COPY . /app
|
| 23 |
+
|
| 24 |
+
# CMD ["python3", "train_phi2.py"]
|
data/log_dataset.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
data_analyser.py
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
docker-compose.yml
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version: '3.8'
|
| 2 |
+
|
| 3 |
+
services:
|
| 4 |
+
tiny_llama_tuning:
|
| 5 |
+
build: .
|
| 6 |
+
runtime: nvidia
|
| 7 |
+
deploy:
|
| 8 |
+
resources:
|
| 9 |
+
reservations:
|
| 10 |
+
devices:
|
| 11 |
+
- driver: nvidia
|
| 12 |
+
count: all
|
| 13 |
+
capabilities: [gpu]
|
| 14 |
+
volumes:
|
| 15 |
+
- ./data:/app/data
|
| 16 |
+
- ./model_output:/app/model_output
|
| 17 |
+
- ./merged_tinyllama_logger:/app/merged_tinyllama_logger
|
| 18 |
+
|
| 19 |
+
command: python3 training_phi2.py
|
merged_tinyllama_logger/config.json
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_name_or_path": "TinyLlama/TinyLlama-1.1B-Chat-v1.0",
|
| 3 |
+
"architectures": [
|
| 4 |
+
"LlamaForCausalLM"
|
| 5 |
+
],
|
| 6 |
+
"attention_bias": false,
|
| 7 |
+
"attention_dropout": 0.0,
|
| 8 |
+
"bos_token_id": 1,
|
| 9 |
+
"eos_token_id": 2,
|
| 10 |
+
"hidden_act": "silu",
|
| 11 |
+
"hidden_size": 2048,
|
| 12 |
+
"initializer_range": 0.02,
|
| 13 |
+
"intermediate_size": 5632,
|
| 14 |
+
"max_position_embeddings": 2048,
|
| 15 |
+
"mlp_bias": false,
|
| 16 |
+
"model_type": "llama",
|
| 17 |
+
"num_attention_heads": 32,
|
| 18 |
+
"num_hidden_layers": 22,
|
| 19 |
+
"num_key_value_heads": 4,
|
| 20 |
+
"pretraining_tp": 1,
|
| 21 |
+
"rms_norm_eps": 1e-05,
|
| 22 |
+
"rope_scaling": null,
|
| 23 |
+
"rope_theta": 10000.0,
|
| 24 |
+
"tie_word_embeddings": false,
|
| 25 |
+
"torch_dtype": "float16",
|
| 26 |
+
"transformers_version": "4.42.3",
|
| 27 |
+
"use_cache": true,
|
| 28 |
+
"vocab_size": 32000
|
| 29 |
+
}
|
merged_tinyllama_logger/generation_config.json
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bos_token_id": 1,
|
| 3 |
+
"eos_token_id": 2,
|
| 4 |
+
"max_length": 2048,
|
| 5 |
+
"pad_token_id": 0,
|
| 6 |
+
"transformers_version": "4.42.3"
|
| 7 |
+
}
|
merged_tinyllama_logger/special_tokens_map.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bos_token": {
|
| 3 |
+
"content": "<s>",
|
| 4 |
+
"lstrip": false,
|
| 5 |
+
"normalized": false,
|
| 6 |
+
"rstrip": false,
|
| 7 |
+
"single_word": false
|
| 8 |
+
},
|
| 9 |
+
"eos_token": {
|
| 10 |
+
"content": "</s>",
|
| 11 |
+
"lstrip": false,
|
| 12 |
+
"normalized": false,
|
| 13 |
+
"rstrip": false,
|
| 14 |
+
"single_word": false
|
| 15 |
+
},
|
| 16 |
+
"pad_token": {
|
| 17 |
+
"content": "</s>",
|
| 18 |
+
"lstrip": false,
|
| 19 |
+
"normalized": false,
|
| 20 |
+
"rstrip": false,
|
| 21 |
+
"single_word": false
|
| 22 |
+
},
|
| 23 |
+
"unk_token": {
|
| 24 |
+
"content": "<unk>",
|
| 25 |
+
"lstrip": false,
|
| 26 |
+
"normalized": false,
|
| 27 |
+
"rstrip": false,
|
| 28 |
+
"single_word": false
|
| 29 |
+
}
|
| 30 |
+
}
|
merged_tinyllama_logger/tokenizer.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
merged_tinyllama_logger/tokenizer_config.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"add_bos_token": true,
|
| 3 |
+
"add_eos_token": false,
|
| 4 |
+
"add_prefix_space": null,
|
| 5 |
+
"added_tokens_decoder": {
|
| 6 |
+
"0": {
|
| 7 |
+
"content": "<unk>",
|
| 8 |
+
"lstrip": false,
|
| 9 |
+
"normalized": false,
|
| 10 |
+
"rstrip": false,
|
| 11 |
+
"single_word": false,
|
| 12 |
+
"special": true
|
| 13 |
+
},
|
| 14 |
+
"1": {
|
| 15 |
+
"content": "<s>",
|
| 16 |
+
"lstrip": false,
|
| 17 |
+
"normalized": false,
|
| 18 |
+
"rstrip": false,
|
| 19 |
+
"single_word": false,
|
| 20 |
+
"special": true
|
| 21 |
+
},
|
| 22 |
+
"2": {
|
| 23 |
+
"content": "</s>",
|
| 24 |
+
"lstrip": false,
|
| 25 |
+
"normalized": false,
|
| 26 |
+
"rstrip": false,
|
| 27 |
+
"single_word": false,
|
| 28 |
+
"special": true
|
| 29 |
+
}
|
| 30 |
+
},
|
| 31 |
+
"bos_token": "<s>",
|
| 32 |
+
"chat_template": "{% for message in messages %}\n{% if message['role'] == 'user' %}\n{{ '<|user|>\n' + message['content'] + eos_token }}\n{% elif message['role'] == 'system' %}\n{{ '<|system|>\n' + message['content'] + eos_token }}\n{% elif message['role'] == 'assistant' %}\n{{ '<|assistant|>\n' + message['content'] + eos_token }}\n{% endif %}\n{% if loop.last and add_generation_prompt %}\n{{ '<|assistant|>' }}\n{% endif %}\n{% endfor %}",
|
| 33 |
+
"clean_up_tokenization_spaces": false,
|
| 34 |
+
"eos_token": "</s>",
|
| 35 |
+
"legacy": false,
|
| 36 |
+
"model_max_length": 2048,
|
| 37 |
+
"pad_token": "</s>",
|
| 38 |
+
"padding_side": "left",
|
| 39 |
+
"sp_model_kwargs": {},
|
| 40 |
+
"tokenizer_class": "LlamaTokenizer",
|
| 41 |
+
"unk_token": "<unk>",
|
| 42 |
+
"use_default_system_prompt": false
|
| 43 |
+
}
|
merging_model.py
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import torch
|
| 2 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 3 |
+
from peft import PeftModel
|
| 4 |
+
import os
|
| 5 |
+
|
| 6 |
+
BASE_MODEL_NAME = "TinyLlama/TinyLlama-1.1B-Chat-v1.0"
|
| 7 |
+
|
| 8 |
+
ADAPTER_CHECKPOINT_PATH = "./model_output/phi2_finetuned_logs/checkpoint-575"
|
| 9 |
+
|
| 10 |
+
# D:\phi2_tuning\model_output\phi2_finetuned_logs\checkpoint-500
|
| 11 |
+
|
| 12 |
+
MERGED_MODEL_PATH = "./updated_logger"
|
| 13 |
+
|
| 14 |
+
print(f"loading base model from: {BASE_MODEL_NAME}")
|
| 15 |
+
|
| 16 |
+
try:
|
| 17 |
+
base_model = AutoModelForCausalLM.from_pretrained(
|
| 18 |
+
BASE_MODEL_NAME,
|
| 19 |
+
low_cpu_mem_usage=True,
|
| 20 |
+
return_dict=True,
|
| 21 |
+
torch_dtype = torch.float16,
|
| 22 |
+
trust_remote_code=True,
|
| 23 |
+
device_map="auto"
|
| 24 |
+
)
|
| 25 |
+
except Exception as e:
|
| 26 |
+
print(f"error loading model: {e}")
|
| 27 |
+
exit()
|
| 28 |
+
|
| 29 |
+
tokenizer = AutoTokenizer.from_pretrained(
|
| 30 |
+
BASE_MODEL_NAME,
|
| 31 |
+
trust_remote_code=True
|
| 32 |
+
)
|
| 33 |
+
if tokenizer.pad_token is None:
|
| 34 |
+
tokenizer.pad_token = tokenizer.eos_token
|
| 35 |
+
tokenizer.padding_side = "left"
|
| 36 |
+
|
| 37 |
+
try:
|
| 38 |
+
model = PeftModel.from_pretrained(base_model, ADAPTER_CHECKPOINT_PATH)
|
| 39 |
+
except Exception as e:
|
| 40 |
+
print(f"error loading the adapter checkpoint")
|
| 41 |
+
print("ensure the adapter checkpoint is correct and retry again")
|
| 42 |
+
|
| 43 |
+
merged_model = model.merge_and_unload()
|
| 44 |
+
print("adapters merged successfully!!")
|
| 45 |
+
|
| 46 |
+
print("saving the merged model...")
|
| 47 |
+
|
| 48 |
+
os.makedirs(MERGED_MODEL_PATH, exist_ok=True)
|
| 49 |
+
merged_model.save_pretrained(MERGED_MODEL_PATH)
|
| 50 |
+
tokenizer.save_pretrained(MERGED_MODEL_PATH)
|
| 51 |
+
|
| 52 |
+
print(f"model merged and saved to {MERGED_MODEL_PATH}")
|
model_output/incremental_1_logs/README.md
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
base_model: ./merged_tinyllama_logger
|
| 3 |
+
library_name: peft
|
| 4 |
+
---
|
| 5 |
+
|
| 6 |
+
# Model Card for Model ID
|
| 7 |
+
|
| 8 |
+
<!-- Provide a quick summary of what the model is/does. -->
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
## Model Details
|
| 13 |
+
|
| 14 |
+
### Model Description
|
| 15 |
+
|
| 16 |
+
<!-- Provide a longer summary of what this model is. -->
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
- **Developed by:** [More Information Needed]
|
| 21 |
+
- **Funded by [optional]:** [More Information Needed]
|
| 22 |
+
- **Shared by [optional]:** [More Information Needed]
|
| 23 |
+
- **Model type:** [More Information Needed]
|
| 24 |
+
- **Language(s) (NLP):** [More Information Needed]
|
| 25 |
+
- **License:** [More Information Needed]
|
| 26 |
+
- **Finetuned from model [optional]:** [More Information Needed]
|
| 27 |
+
|
| 28 |
+
### Model Sources [optional]
|
| 29 |
+
|
| 30 |
+
<!-- Provide the basic links for the model. -->
|
| 31 |
+
|
| 32 |
+
- **Repository:** [More Information Needed]
|
| 33 |
+
- **Paper [optional]:** [More Information Needed]
|
| 34 |
+
- **Demo [optional]:** [More Information Needed]
|
| 35 |
+
|
| 36 |
+
## Uses
|
| 37 |
+
|
| 38 |
+
<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
|
| 39 |
+
|
| 40 |
+
### Direct Use
|
| 41 |
+
|
| 42 |
+
<!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
|
| 43 |
+
|
| 44 |
+
[More Information Needed]
|
| 45 |
+
|
| 46 |
+
### Downstream Use [optional]
|
| 47 |
+
|
| 48 |
+
<!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
|
| 49 |
+
|
| 50 |
+
[More Information Needed]
|
| 51 |
+
|
| 52 |
+
### Out-of-Scope Use
|
| 53 |
+
|
| 54 |
+
<!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
|
| 55 |
+
|
| 56 |
+
[More Information Needed]
|
| 57 |
+
|
| 58 |
+
## Bias, Risks, and Limitations
|
| 59 |
+
|
| 60 |
+
<!-- This section is meant to convey both technical and sociotechnical limitations. -->
|
| 61 |
+
|
| 62 |
+
[More Information Needed]
|
| 63 |
+
|
| 64 |
+
### Recommendations
|
| 65 |
+
|
| 66 |
+
<!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
|
| 67 |
+
|
| 68 |
+
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
|
| 69 |
+
|
| 70 |
+
## How to Get Started with the Model
|
| 71 |
+
|
| 72 |
+
Use the code below to get started with the model.
|
| 73 |
+
|
| 74 |
+
[More Information Needed]
|
| 75 |
+
|
| 76 |
+
## Training Details
|
| 77 |
+
|
| 78 |
+
### Training Data
|
| 79 |
+
|
| 80 |
+
<!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
|
| 81 |
+
|
| 82 |
+
[More Information Needed]
|
| 83 |
+
|
| 84 |
+
### Training Procedure
|
| 85 |
+
|
| 86 |
+
<!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
|
| 87 |
+
|
| 88 |
+
#### Preprocessing [optional]
|
| 89 |
+
|
| 90 |
+
[More Information Needed]
|
| 91 |
+
|
| 92 |
+
|
| 93 |
+
#### Training Hyperparameters
|
| 94 |
+
|
| 95 |
+
- **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
|
| 96 |
+
|
| 97 |
+
#### Speeds, Sizes, Times [optional]
|
| 98 |
+
|
| 99 |
+
<!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
|
| 100 |
+
|
| 101 |
+
[More Information Needed]
|
| 102 |
+
|
| 103 |
+
## Evaluation
|
| 104 |
+
|
| 105 |
+
<!-- This section describes the evaluation protocols and provides the results. -->
|
| 106 |
+
|
| 107 |
+
### Testing Data, Factors & Metrics
|
| 108 |
+
|
| 109 |
+
#### Testing Data
|
| 110 |
+
|
| 111 |
+
<!-- This should link to a Dataset Card if possible. -->
|
| 112 |
+
|
| 113 |
+
[More Information Needed]
|
| 114 |
+
|
| 115 |
+
#### Factors
|
| 116 |
+
|
| 117 |
+
<!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
|
| 118 |
+
|
| 119 |
+
[More Information Needed]
|
| 120 |
+
|
| 121 |
+
#### Metrics
|
| 122 |
+
|
| 123 |
+
<!-- These are the evaluation metrics being used, ideally with a description of why. -->
|
| 124 |
+
|
| 125 |
+
[More Information Needed]
|
| 126 |
+
|
| 127 |
+
### Results
|
| 128 |
+
|
| 129 |
+
[More Information Needed]
|
| 130 |
+
|
| 131 |
+
#### Summary
|
| 132 |
+
|
| 133 |
+
|
| 134 |
+
|
| 135 |
+
## Model Examination [optional]
|
| 136 |
+
|
| 137 |
+
<!-- Relevant interpretability work for the model goes here -->
|
| 138 |
+
|
| 139 |
+
[More Information Needed]
|
| 140 |
+
|
| 141 |
+
## Environmental Impact
|
| 142 |
+
|
| 143 |
+
<!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
|
| 144 |
+
|
| 145 |
+
Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
|
| 146 |
+
|
| 147 |
+
- **Hardware Type:** [More Information Needed]
|
| 148 |
+
- **Hours used:** [More Information Needed]
|
| 149 |
+
- **Cloud Provider:** [More Information Needed]
|
| 150 |
+
- **Compute Region:** [More Information Needed]
|
| 151 |
+
- **Carbon Emitted:** [More Information Needed]
|
| 152 |
+
|
| 153 |
+
## Technical Specifications [optional]
|
| 154 |
+
|
| 155 |
+
### Model Architecture and Objective
|
| 156 |
+
|
| 157 |
+
[More Information Needed]
|
| 158 |
+
|
| 159 |
+
### Compute Infrastructure
|
| 160 |
+
|
| 161 |
+
[More Information Needed]
|
| 162 |
+
|
| 163 |
+
#### Hardware
|
| 164 |
+
|
| 165 |
+
[More Information Needed]
|
| 166 |
+
|
| 167 |
+
#### Software
|
| 168 |
+
|
| 169 |
+
[More Information Needed]
|
| 170 |
+
|
| 171 |
+
## Citation [optional]
|
| 172 |
+
|
| 173 |
+
<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
|
| 174 |
+
|
| 175 |
+
**BibTeX:**
|
| 176 |
+
|
| 177 |
+
[More Information Needed]
|
| 178 |
+
|
| 179 |
+
**APA:**
|
| 180 |
+
|
| 181 |
+
[More Information Needed]
|
| 182 |
+
|
| 183 |
+
## Glossary [optional]
|
| 184 |
+
|
| 185 |
+
<!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
|
| 186 |
+
|
| 187 |
+
[More Information Needed]
|
| 188 |
+
|
| 189 |
+
## More Information [optional]
|
| 190 |
+
|
| 191 |
+
[More Information Needed]
|
| 192 |
+
|
| 193 |
+
## Model Card Authors [optional]
|
| 194 |
+
|
| 195 |
+
[More Information Needed]
|
| 196 |
+
|
| 197 |
+
## Model Card Contact
|
| 198 |
+
|
| 199 |
+
[More Information Needed]
|
| 200 |
+
### Framework versions
|
| 201 |
+
|
| 202 |
+
- PEFT 0.11.1
|
model_output/incremental_1_logs/adapter_config.json
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"alpha_pattern": {},
|
| 3 |
+
"auto_mapping": null,
|
| 4 |
+
"base_model_name_or_path": "./merged_tinyllama_logger",
|
| 5 |
+
"bias": "none",
|
| 6 |
+
"fan_in_fan_out": false,
|
| 7 |
+
"inference_mode": true,
|
| 8 |
+
"init_lora_weights": true,
|
| 9 |
+
"layer_replication": null,
|
| 10 |
+
"layers_pattern": null,
|
| 11 |
+
"layers_to_transform": null,
|
| 12 |
+
"loftq_config": {},
|
| 13 |
+
"lora_alpha": 124,
|
| 14 |
+
"lora_dropout": 0.15,
|
| 15 |
+
"megatron_config": null,
|
| 16 |
+
"megatron_core": "megatron.core",
|
| 17 |
+
"modules_to_save": null,
|
| 18 |
+
"peft_type": "LORA",
|
| 19 |
+
"r": 32,
|
| 20 |
+
"rank_pattern": {},
|
| 21 |
+
"revision": null,
|
| 22 |
+
"target_modules": [
|
| 23 |
+
"q_proj",
|
| 24 |
+
"v_proj"
|
| 25 |
+
],
|
| 26 |
+
"task_type": "CAUSAL_LM",
|
| 27 |
+
"use_dora": false,
|
| 28 |
+
"use_rslora": false
|
| 29 |
+
}
|
model_output/incremental_1_logs/checkpoint-575/README.md
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
## Model Details
|
| 13 |
+
|
| 14 |
+
### Model Description
|
| 15 |
+
|
| 16 |
+
<!-- Provide a longer summary of what this model is. -->
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
- **Developed by:** [More Information Needed]
|
| 21 |
+
- **Funded by [optional]:** [More Information Needed]
|
| 22 |
+
- **Shared by [optional]:** [More Information Needed]
|
| 23 |
+
- **Model type:** [More Information Needed]
|
| 24 |
+
- **Language(s) (NLP):** [More Information Needed]
|
| 25 |
+
- **License:** [More Information Needed]
|
| 26 |
+
- **Finetuned from model [optional]:** [More Information Needed]
|
| 27 |
+
|
| 28 |
+
### Model Sources [optional]
|
| 29 |
+
|
| 30 |
+
<!-- Provide the basic links for the model. -->
|
| 31 |
+
|
| 32 |
+
- **Repository:** [More Information Needed]
|
| 33 |
+
- **Paper [optional]:** [More Information Needed]
|
| 34 |
+
- **Demo [optional]:** [More Information Needed]
|
| 35 |
+
|
| 36 |
+
## Uses
|
| 37 |
+
|
| 38 |
+
<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
|
| 39 |
+
|
| 40 |
+
### Direct Use
|
| 41 |
+
|
| 42 |
+
<!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
|
| 43 |
+
|
| 44 |
+
[More Information Needed]
|
| 45 |
+
|
| 46 |
+
### Downstream Use [optional]
|
| 47 |
+
|
| 48 |
+
<!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
|
| 49 |
+
|
| 50 |
+
[More Information Needed]
|
| 51 |
+
|
| 52 |
+
### Out-of-Scope Use
|
| 53 |
+
|
| 54 |
+
<!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
|
| 55 |
+
|
| 56 |
+
[More Information Needed]
|
| 57 |
+
|
| 58 |
+
## Bias, Risks, and Limitations
|
| 59 |
+
|
| 60 |
+
<!-- This section is meant to convey both technical and sociotechnical limitations. -->
|
| 61 |
+
|
| 62 |
+
[More Information Needed]
|
| 63 |
+
|
| 64 |
+
### Recommendations
|
| 65 |
+
|
| 66 |
+
<!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
|
| 67 |
+
|
| 68 |
+
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
|
| 69 |
+
|
| 70 |
+
## How to Get Started with the Model
|
| 71 |
+
|
| 72 |
+
Use the code below to get started with the model.
|
| 73 |
+
|
| 74 |
+
[More Information Needed]
|
| 75 |
+
|
| 76 |
+
## Training Details
|
| 77 |
+
|
| 78 |
+
### Training Data
|
| 79 |
+
|
| 80 |
+
<!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
|
| 81 |
+
|
| 82 |
+
[More Information Needed]
|
| 83 |
+
|
| 84 |
+
### Training Procedure
|
| 85 |
+
|
| 86 |
+
<!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
|
| 87 |
+
|
| 88 |
+
#### Preprocessing [optional]
|
| 89 |
+
|
| 90 |
+
[More Information Needed]
|
| 91 |
+
|
| 92 |
+
|
| 93 |
+
#### Training Hyperparameters
|
| 94 |
+
|
| 95 |
+
- **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
|
| 96 |
+
|
| 97 |
+
#### Speeds, Sizes, Times [optional]
|
| 98 |
+
|
| 99 |
+
<!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
|
| 100 |
+
|
| 101 |
+
[More Information Needed]
|
| 102 |
+
|
| 103 |
+
## Evaluation
|
| 104 |
+
|
| 105 |
+
<!-- This section describes the evaluation protocols and provides the results. -->
|
| 106 |
+
|
| 107 |
+
### Testing Data, Factors & Metrics
|
| 108 |
+
|
| 109 |
+
#### Testing Data
|
| 110 |
+
|
| 111 |
+
<!-- This should link to a Dataset Card if possible. -->
|
| 112 |
+
|
| 113 |
+
[More Information Needed]
|
| 114 |
+
|
| 115 |
+
#### Factors
|
| 116 |
+
|
| 117 |
+
<!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
|
| 118 |
+
|
| 119 |
+
[More Information Needed]
|
| 120 |
+
|
| 121 |
+
#### Metrics
|
| 122 |
+
|
| 123 |
+
<!-- These are the evaluation metrics being used, ideally with a description of why. -->
|
| 124 |
+
|
| 125 |
+
[More Information Needed]
|
| 126 |
+
|
| 127 |
+
### Results
|
| 128 |
+
|
| 129 |
+
[More Information Needed]
|
| 130 |
+
|
| 131 |
+
#### Summary
|
| 132 |
+
|
| 133 |
+
|
| 134 |
+
|
| 135 |
+
## Model Examination [optional]
|
| 136 |
+
|
| 137 |
+
<!-- Relevant interpretability work for the model goes here -->
|
| 138 |
+
|
| 139 |
+
[More Information Needed]
|
| 140 |
+
|
| 141 |
+
## Environmental Impact
|
| 142 |
+
|
| 143 |
+
<!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
|
| 144 |
+
|
| 145 |
+
Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
|
| 146 |
+
|
| 147 |
+
- **Hardware Type:** [More Information Needed]
|
| 148 |
+
- **Hours used:** [More Information Needed]
|
| 149 |
+
- **Cloud Provider:** [More Information Needed]
|
| 150 |
+
- **Compute Region:** [More Information Needed]
|
| 151 |
+
- **Carbon Emitted:** [More Information Needed]
|
| 152 |
+
|
| 153 |
+
## Technical Specifications [optional]
|
| 154 |
+
|
| 155 |
+
### Model Architecture and Objective
|
| 156 |
+
|
| 157 |
+
[More Information Needed]
|
| 158 |
+
|
| 159 |
+
### Compute Infrastructure
|
| 160 |
+
|
| 161 |
+
[More Information Needed]
|
| 162 |
+
|
| 163 |
+
#### Hardware
|
| 164 |
+
|
| 165 |
+
[More Information Needed]
|
| 166 |
+
|
| 167 |
+
#### Software
|
| 168 |
+
|
| 169 |
+
[More Information Needed]
|
| 170 |
+
|
| 171 |
+
## Citation [optional]
|
| 172 |
+
|
| 173 |
+
<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
|
| 174 |
+
|
| 175 |
+
**BibTeX:**
|
| 176 |
+
|
| 177 |
+
[More Information Needed]
|
| 178 |
+
|
| 179 |
+
**APA:**
|
| 180 |
+
|
| 181 |
+
[More Information Needed]
|
| 182 |
+
|
| 183 |
+
## Glossary [optional]
|
| 184 |
+
|
| 185 |
+
<!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
|
| 186 |
+
|
| 187 |
+
[More Information Needed]
|
| 188 |
+
|
| 189 |
+
## More Information [optional]
|
| 190 |
+
|
| 191 |
+
[More Information Needed]
|
| 192 |
+
|
| 193 |
+
## Model Card Authors [optional]
|
| 194 |
+
|
| 195 |
+
[More Information Needed]
|
| 196 |
+
|
| 197 |
+
## Model Card Contact
|
| 198 |
+
|
| 199 |
+
[More Information Needed]
|
| 200 |
+
### Framework versions
|
| 201 |
+
|
| 202 |
+
- PEFT 0.11.1
|
model_output/incremental_1_logs/checkpoint-575/adapter_config.json
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"alpha_pattern": {},
|
| 3 |
+
"auto_mapping": null,
|
| 4 |
+
"base_model_name_or_path": "./merged_tinyllama_logger",
|
| 5 |
+
"bias": "none",
|
| 6 |
+
"fan_in_fan_out": false,
|
| 7 |
+
"inference_mode": true,
|
| 8 |
+
"init_lora_weights": true,
|
| 9 |
+
"layer_replication": null,
|
| 10 |
+
"layers_pattern": null,
|
| 11 |
+
"layers_to_transform": null,
|
| 12 |
+
"loftq_config": {},
|
| 13 |
+
"lora_alpha": 124,
|
| 14 |
+
"lora_dropout": 0.15,
|
| 15 |
+
"megatron_config": null,
|
| 16 |
+
"megatron_core": "megatron.core",
|
| 17 |
+
"modules_to_save": null,
|
| 18 |
+
"peft_type": "LORA",
|
| 19 |
+
"r": 32,
|
| 20 |
+
"rank_pattern": {},
|
| 21 |
+
"revision": null,
|
| 22 |
+
"target_modules": [
|
| 23 |
+
"q_proj",
|
| 24 |
+
"v_proj"
|
| 25 |
+
],
|
| 26 |
+
"task_type": "CAUSAL_LM",
|
| 27 |
+
"use_dora": false,
|
| 28 |
+
"use_rslora": false
|
| 29 |
+
}
|
model_output/incremental_1_logs/checkpoint-575/special_tokens_map.json
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bos_token": {
|
| 3 |
+
"content": "<s>",
|
| 4 |
+
"lstrip": false,
|
| 5 |
+
"normalized": false,
|
| 6 |
+
"rstrip": false,
|
| 7 |
+
"single_word": false
|
| 8 |
+
},
|
| 9 |
+
"eos_token": {
|
| 10 |
+
"content": "</s>",
|
| 11 |
+
"lstrip": false,
|
| 12 |
+
"normalized": false,
|
| 13 |
+
"rstrip": false,
|
| 14 |
+
"single_word": false
|
| 15 |
+
},
|
| 16 |
+
"pad_token": "</s>",
|
| 17 |
+
"unk_token": {
|
| 18 |
+
"content": "<unk>",
|
| 19 |
+
"lstrip": false,
|
| 20 |
+
"normalized": false,
|
| 21 |
+
"rstrip": false,
|
| 22 |
+
"single_word": false
|
| 23 |
+
}
|
| 24 |
+
}
|
model_output/incremental_1_logs/checkpoint-575/tokenizer.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
model_output/incremental_1_logs/checkpoint-575/tokenizer_config.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"add_bos_token": true,
|
| 3 |
+
"add_eos_token": false,
|
| 4 |
+
"add_prefix_space": null,
|
| 5 |
+
"added_tokens_decoder": {
|
| 6 |
+
"0": {
|
| 7 |
+
"content": "<unk>",
|
| 8 |
+
"lstrip": false,
|
| 9 |
+
"normalized": false,
|
| 10 |
+
"rstrip": false,
|
| 11 |
+
"single_word": false,
|
| 12 |
+
"special": true
|
| 13 |
+
},
|
| 14 |
+
"1": {
|
| 15 |
+
"content": "<s>",
|
| 16 |
+
"lstrip": false,
|
| 17 |
+
"normalized": false,
|
| 18 |
+
"rstrip": false,
|
| 19 |
+
"single_word": false,
|
| 20 |
+
"special": true
|
| 21 |
+
},
|
| 22 |
+
"2": {
|
| 23 |
+
"content": "</s>",
|
| 24 |
+
"lstrip": false,
|
| 25 |
+
"normalized": false,
|
| 26 |
+
"rstrip": false,
|
| 27 |
+
"single_word": false,
|
| 28 |
+
"special": true
|
| 29 |
+
}
|
| 30 |
+
},
|
| 31 |
+
"bos_token": "<s>",
|
| 32 |
+
"chat_template": "{% for message in messages %}\n{% if message['role'] == 'user' %}\n{{ '<|user|>\n' + message['content'] + eos_token }}\n{% elif message['role'] == 'system' %}\n{{ '<|system|>\n' + message['content'] + eos_token }}\n{% elif message['role'] == 'assistant' %}\n{{ '<|assistant|>\n' + message['content'] + eos_token }}\n{% endif %}\n{% if loop.last and add_generation_prompt %}\n{{ '<|assistant|>' }}\n{% endif %}\n{% endfor %}",
|
| 33 |
+
"clean_up_tokenization_spaces": false,
|
| 34 |
+
"eos_token": "</s>",
|
| 35 |
+
"legacy": false,
|
| 36 |
+
"model_max_length": 2048,
|
| 37 |
+
"pad_token": "</s>",
|
| 38 |
+
"padding_side": "right",
|
| 39 |
+
"sp_model_kwargs": {},
|
| 40 |
+
"tokenizer_class": "LlamaTokenizer",
|
| 41 |
+
"unk_token": "<unk>",
|
| 42 |
+
"use_default_system_prompt": false
|
| 43 |
+
}
|
model_output/incremental_1_logs/checkpoint-575/trainer_state.json
ADDED
|
@@ -0,0 +1,625 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"best_metric": 0.277375727891922,
|
| 3 |
+
"best_model_checkpoint": "/app/model_output/incremental_1_logs/checkpoint-575",
|
| 4 |
+
"epoch": 3.893355903512484,
|
| 5 |
+
"eval_steps": 25,
|
| 6 |
+
"global_step": 575,
|
| 7 |
+
"is_hyper_param_search": false,
|
| 8 |
+
"is_local_process_zero": true,
|
| 9 |
+
"is_world_process_zero": true,
|
| 10 |
+
"log_history": [
|
| 11 |
+
{
|
| 12 |
+
"epoch": 0.06771053745239103,
|
| 13 |
+
"grad_norm": 0.12689563632011414,
|
| 14 |
+
"learning_rate": 5.555555555555556e-05,
|
| 15 |
+
"loss": 0.3059,
|
| 16 |
+
"step": 10
|
| 17 |
+
},
|
| 18 |
+
{
|
| 19 |
+
"epoch": 0.13542107490478206,
|
| 20 |
+
"grad_norm": 0.20696839690208435,
|
| 21 |
+
"learning_rate": 9.999696229471716e-05,
|
| 22 |
+
"loss": 0.2664,
|
| 23 |
+
"step": 20
|
| 24 |
+
},
|
| 25 |
+
{
|
| 26 |
+
"epoch": 0.16927634363097757,
|
| 27 |
+
"eval_loss": 0.2852177023887634,
|
| 28 |
+
"eval_runtime": 88.5933,
|
| 29 |
+
"eval_samples_per_second": 11.852,
|
| 30 |
+
"eval_steps_per_second": 1.49,
|
| 31 |
+
"step": 25
|
| 32 |
+
},
|
| 33 |
+
{
|
| 34 |
+
"epoch": 0.20313161235717309,
|
| 35 |
+
"grad_norm": 0.15301378071308136,
|
| 36 |
+
"learning_rate": 9.989068136093873e-05,
|
| 37 |
+
"loss": 0.2856,
|
| 38 |
+
"step": 30
|
| 39 |
+
},
|
| 40 |
+
{
|
| 41 |
+
"epoch": 0.2708421498095641,
|
| 42 |
+
"grad_norm": 0.11013192683458328,
|
| 43 |
+
"learning_rate": 9.963288406760582e-05,
|
| 44 |
+
"loss": 0.3573,
|
| 45 |
+
"step": 40
|
| 46 |
+
},
|
| 47 |
+
{
|
| 48 |
+
"epoch": 0.33855268726195514,
|
| 49 |
+
"grad_norm": 0.11521229147911072,
|
| 50 |
+
"learning_rate": 9.922435333662536e-05,
|
| 51 |
+
"loss": 0.219,
|
| 52 |
+
"step": 50
|
| 53 |
+
},
|
| 54 |
+
{
|
| 55 |
+
"epoch": 0.33855268726195514,
|
| 56 |
+
"eval_loss": 0.286544531583786,
|
| 57 |
+
"eval_runtime": 83.9745,
|
| 58 |
+
"eval_samples_per_second": 12.504,
|
| 59 |
+
"eval_steps_per_second": 1.572,
|
| 60 |
+
"step": 50
|
| 61 |
+
},
|
| 62 |
+
{
|
| 63 |
+
"epoch": 0.40626322471434617,
|
| 64 |
+
"grad_norm": 0.11518555134534836,
|
| 65 |
+
"learning_rate": 9.86663298624003e-05,
|
| 66 |
+
"loss": 0.2929,
|
| 67 |
+
"step": 60
|
| 68 |
+
},
|
| 69 |
+
{
|
| 70 |
+
"epoch": 0.4739737621667372,
|
| 71 |
+
"grad_norm": 0.15488335490226746,
|
| 72 |
+
"learning_rate": 9.796050834388149e-05,
|
| 73 |
+
"loss": 0.3014,
|
| 74 |
+
"step": 70
|
| 75 |
+
},
|
| 76 |
+
{
|
| 77 |
+
"epoch": 0.5078290308929327,
|
| 78 |
+
"eval_loss": 0.2851661443710327,
|
| 79 |
+
"eval_runtime": 86.2574,
|
| 80 |
+
"eval_samples_per_second": 12.173,
|
| 81 |
+
"eval_steps_per_second": 1.53,
|
| 82 |
+
"step": 75
|
| 83 |
+
},
|
| 84 |
+
{
|
| 85 |
+
"epoch": 0.5416842996191282,
|
| 86 |
+
"grad_norm": 0.0932643935084343,
|
| 87 |
+
"learning_rate": 9.710903233782272e-05,
|
| 88 |
+
"loss": 0.2921,
|
| 89 |
+
"step": 80
|
| 90 |
+
},
|
| 91 |
+
{
|
| 92 |
+
"epoch": 0.6093948370715192,
|
| 93 |
+
"grad_norm": 0.12357372790575027,
|
| 94 |
+
"learning_rate": 9.611448774886924e-05,
|
| 95 |
+
"loss": 0.2477,
|
| 96 |
+
"step": 90
|
| 97 |
+
},
|
| 98 |
+
{
|
| 99 |
+
"epoch": 0.6771053745239103,
|
| 100 |
+
"grad_norm": 0.11050555109977722,
|
| 101 |
+
"learning_rate": 9.497989497625035e-05,
|
| 102 |
+
"loss": 0.2921,
|
| 103 |
+
"step": 100
|
| 104 |
+
},
|
| 105 |
+
{
|
| 106 |
+
"epoch": 0.6771053745239103,
|
| 107 |
+
"eval_loss": 0.28187423944473267,
|
| 108 |
+
"eval_runtime": 82.6427,
|
| 109 |
+
"eval_samples_per_second": 12.705,
|
| 110 |
+
"eval_steps_per_second": 1.597,
|
| 111 |
+
"step": 100
|
| 112 |
+
},
|
| 113 |
+
{
|
| 114 |
+
"epoch": 0.7448159119763013,
|
| 115 |
+
"grad_norm": 0.12379597127437592,
|
| 116 |
+
"learning_rate": 9.370869974092629e-05,
|
| 117 |
+
"loss": 0.3503,
|
| 118 |
+
"step": 110
|
| 119 |
+
},
|
| 120 |
+
{
|
| 121 |
+
"epoch": 0.8125264494286923,
|
| 122 |
+
"grad_norm": 0.09044498205184937,
|
| 123 |
+
"learning_rate": 9.230476262104677e-05,
|
| 124 |
+
"loss": 0.2187,
|
| 125 |
+
"step": 120
|
| 126 |
+
},
|
| 127 |
+
{
|
| 128 |
+
"epoch": 0.8463817181548878,
|
| 129 |
+
"eval_loss": 0.28196918964385986,
|
| 130 |
+
"eval_runtime": 81.0323,
|
| 131 |
+
"eval_samples_per_second": 12.958,
|
| 132 |
+
"eval_steps_per_second": 1.629,
|
| 133 |
+
"step": 125
|
| 134 |
+
},
|
| 135 |
+
{
|
| 136 |
+
"epoch": 0.8802369868810833,
|
| 137 |
+
"grad_norm": 0.08871851861476898,
|
| 138 |
+
"learning_rate": 9.077234732750224e-05,
|
| 139 |
+
"loss": 0.2651,
|
| 140 |
+
"step": 130
|
| 141 |
+
},
|
| 142 |
+
{
|
| 143 |
+
"epoch": 0.9479475243334744,
|
| 144 |
+
"grad_norm": 0.15373575687408447,
|
| 145 |
+
"learning_rate": 8.911610775517382e-05,
|
| 146 |
+
"loss": 0.2926,
|
| 147 |
+
"step": 140
|
| 148 |
+
},
|
| 149 |
+
{
|
| 150 |
+
"epoch": 1.0156580617858655,
|
| 151 |
+
"grad_norm": 0.1201297715306282,
|
| 152 |
+
"learning_rate": 8.73410738492077e-05,
|
| 153 |
+
"loss": 0.3611,
|
| 154 |
+
"step": 150
|
| 155 |
+
},
|
| 156 |
+
{
|
| 157 |
+
"epoch": 1.0156580617858655,
|
| 158 |
+
"eval_loss": 0.2829289138317108,
|
| 159 |
+
"eval_runtime": 69.3268,
|
| 160 |
+
"eval_samples_per_second": 15.146,
|
| 161 |
+
"eval_steps_per_second": 1.904,
|
| 162 |
+
"step": 150
|
| 163 |
+
},
|
| 164 |
+
{
|
| 165 |
+
"epoch": 1.0833685992382565,
|
| 166 |
+
"grad_norm": 0.0962260514497757,
|
| 167 |
+
"learning_rate": 8.545263632923687e-05,
|
| 168 |
+
"loss": 0.212,
|
| 169 |
+
"step": 160
|
| 170 |
+
},
|
| 171 |
+
{
|
| 172 |
+
"epoch": 1.1510791366906474,
|
| 173 |
+
"grad_norm": 0.11213065683841705,
|
| 174 |
+
"learning_rate": 8.345653031794292e-05,
|
| 175 |
+
"loss": 0.2705,
|
| 176 |
+
"step": 170
|
| 177 |
+
},
|
| 178 |
+
{
|
| 179 |
+
"epoch": 1.184934405416843,
|
| 180 |
+
"eval_loss": 0.28028643131256104,
|
| 181 |
+
"eval_runtime": 68.9818,
|
| 182 |
+
"eval_samples_per_second": 15.221,
|
| 183 |
+
"eval_steps_per_second": 1.914,
|
| 184 |
+
"step": 175
|
| 185 |
+
},
|
| 186 |
+
{
|
| 187 |
+
"epoch": 1.2187896741430384,
|
| 188 |
+
"grad_norm": 0.17710012197494507,
|
| 189 |
+
"learning_rate": 8.135881792367686e-05,
|
| 190 |
+
"loss": 0.2932,
|
| 191 |
+
"step": 180
|
| 192 |
+
},
|
| 193 |
+
{
|
| 194 |
+
"epoch": 1.2865002115954296,
|
| 195 |
+
"grad_norm": 0.08371994644403458,
|
| 196 |
+
"learning_rate": 7.916586983003533e-05,
|
| 197 |
+
"loss": 0.3095,
|
| 198 |
+
"step": 190
|
| 199 |
+
},
|
| 200 |
+
{
|
| 201 |
+
"epoch": 1.3542107490478206,
|
| 202 |
+
"grad_norm": 0.11087023466825485,
|
| 203 |
+
"learning_rate": 7.688434594830392e-05,
|
| 204 |
+
"loss": 0.2339,
|
| 205 |
+
"step": 200
|
| 206 |
+
},
|
| 207 |
+
{
|
| 208 |
+
"epoch": 1.3542107490478206,
|
| 209 |
+
"eval_loss": 0.280811071395874,
|
| 210 |
+
"eval_runtime": 69.3415,
|
| 211 |
+
"eval_samples_per_second": 15.142,
|
| 212 |
+
"eval_steps_per_second": 1.904,
|
| 213 |
+
"step": 200
|
| 214 |
+
},
|
| 215 |
+
{
|
| 216 |
+
"epoch": 1.4219212865002115,
|
| 217 |
+
"grad_norm": 0.08745381981134415,
|
| 218 |
+
"learning_rate": 7.452117519152542e-05,
|
| 219 |
+
"loss": 0.2833,
|
| 220 |
+
"step": 210
|
| 221 |
+
},
|
| 222 |
+
{
|
| 223 |
+
"epoch": 1.4896318239526027,
|
| 224 |
+
"grad_norm": 0.2609899342060089,
|
| 225 |
+
"learning_rate": 7.20835344316187e-05,
|
| 226 |
+
"loss": 0.325,
|
| 227 |
+
"step": 220
|
| 228 |
+
},
|
| 229 |
+
{
|
| 230 |
+
"epoch": 1.5234870926787982,
|
| 231 |
+
"eval_loss": 0.28064557909965515,
|
| 232 |
+
"eval_runtime": 66.8259,
|
| 233 |
+
"eval_samples_per_second": 15.712,
|
| 234 |
+
"eval_steps_per_second": 1.975,
|
| 235 |
+
"step": 225
|
| 236 |
+
},
|
| 237 |
+
{
|
| 238 |
+
"epoch": 1.5573423614049937,
|
| 239 |
+
"grad_norm": 0.09044867753982544,
|
| 240 |
+
"learning_rate": 6.957882670345458e-05,
|
| 241 |
+
"loss": 0.2485,
|
| 242 |
+
"step": 230
|
| 243 |
+
},
|
| 244 |
+
{
|
| 245 |
+
"epoch": 1.6250528988573847,
|
| 246 |
+
"grad_norm": 0.10336604714393616,
|
| 247 |
+
"learning_rate": 6.701465872208216e-05,
|
| 248 |
+
"loss": 0.2615,
|
| 249 |
+
"step": 240
|
| 250 |
+
},
|
| 251 |
+
{
|
| 252 |
+
"epoch": 1.6927634363097757,
|
| 253 |
+
"grad_norm": 0.11195653676986694,
|
| 254 |
+
"learning_rate": 6.439881778138531e-05,
|
| 255 |
+
"loss": 0.2872,
|
| 256 |
+
"step": 250
|
| 257 |
+
},
|
| 258 |
+
{
|
| 259 |
+
"epoch": 1.6927634363097757,
|
| 260 |
+
"eval_loss": 0.2789854109287262,
|
| 261 |
+
"eval_runtime": 71.8328,
|
| 262 |
+
"eval_samples_per_second": 14.617,
|
| 263 |
+
"eval_steps_per_second": 1.838,
|
| 264 |
+
"step": 250
|
| 265 |
+
},
|
| 266 |
+
{
|
| 267 |
+
"epoch": 1.7604739737621666,
|
| 268 |
+
"grad_norm": 0.08948034793138504,
|
| 269 |
+
"learning_rate": 6.173924810432705e-05,
|
| 270 |
+
"loss": 0.3233,
|
| 271 |
+
"step": 260
|
| 272 |
+
},
|
| 273 |
+
{
|
| 274 |
+
"epoch": 1.8281845112145576,
|
| 275 |
+
"grad_norm": 0.10628338903188705,
|
| 276 |
+
"learning_rate": 5.90440267166055e-05,
|
| 277 |
+
"loss": 0.2191,
|
| 278 |
+
"step": 270
|
| 279 |
+
},
|
| 280 |
+
{
|
| 281 |
+
"epoch": 1.8620397799407533,
|
| 282 |
+
"eval_loss": 0.27870360016822815,
|
| 283 |
+
"eval_runtime": 69.7018,
|
| 284 |
+
"eval_samples_per_second": 15.064,
|
| 285 |
+
"eval_steps_per_second": 1.894,
|
| 286 |
+
"step": 275
|
| 287 |
+
},
|
| 288 |
+
{
|
| 289 |
+
"epoch": 1.8958950486669488,
|
| 290 |
+
"grad_norm": 0.08356555551290512,
|
| 291 |
+
"learning_rate": 5.6321338916992315e-05,
|
| 292 |
+
"loss": 0.2827,
|
| 293 |
+
"step": 280
|
| 294 |
+
},
|
| 295 |
+
{
|
| 296 |
+
"epoch": 1.9636055861193398,
|
| 297 |
+
"grad_norm": 0.16241195797920227,
|
| 298 |
+
"learning_rate": 5.357945341884936e-05,
|
| 299 |
+
"loss": 0.3,
|
| 300 |
+
"step": 290
|
| 301 |
+
},
|
| 302 |
+
{
|
| 303 |
+
"epoch": 2.031316123571731,
|
| 304 |
+
"grad_norm": 0.09376996755599976,
|
| 305 |
+
"learning_rate": 5.0826697238317935e-05,
|
| 306 |
+
"loss": 0.3259,
|
| 307 |
+
"step": 300
|
| 308 |
+
},
|
| 309 |
+
{
|
| 310 |
+
"epoch": 2.031316123571731,
|
| 311 |
+
"eval_loss": 0.2795935571193695,
|
| 312 |
+
"eval_runtime": 66.8471,
|
| 313 |
+
"eval_samples_per_second": 15.707,
|
| 314 |
+
"eval_steps_per_second": 1.975,
|
| 315 |
+
"step": 300
|
| 316 |
+
},
|
| 317 |
+
{
|
| 318 |
+
"epoch": 2.099026661024122,
|
| 319 |
+
"grad_norm": 0.12176941335201263,
|
| 320 |
+
"learning_rate": 4.8071430405444474e-05,
|
| 321 |
+
"loss": 0.2162,
|
| 322 |
+
"step": 310
|
| 323 |
+
},
|
| 324 |
+
{
|
| 325 |
+
"epoch": 2.166737198476513,
|
| 326 |
+
"grad_norm": 0.10181087255477905,
|
| 327 |
+
"learning_rate": 4.5322020575044114e-05,
|
| 328 |
+
"loss": 0.2799,
|
| 329 |
+
"step": 320
|
| 330 |
+
},
|
| 331 |
+
{
|
| 332 |
+
"epoch": 2.2005924672027084,
|
| 333 |
+
"eval_loss": 0.2783721089363098,
|
| 334 |
+
"eval_runtime": 66.1795,
|
| 335 |
+
"eval_samples_per_second": 15.866,
|
| 336 |
+
"eval_steps_per_second": 1.995,
|
| 337 |
+
"step": 325
|
| 338 |
+
},
|
| 339 |
+
{
|
| 340 |
+
"epoch": 2.234447735928904,
|
| 341 |
+
"grad_norm": 0.16512344777584076,
|
| 342 |
+
"learning_rate": 4.2586817614407895e-05,
|
| 343 |
+
"loss": 0.3018,
|
| 344 |
+
"step": 330
|
| 345 |
+
},
|
| 346 |
+
{
|
| 347 |
+
"epoch": 2.302158273381295,
|
| 348 |
+
"grad_norm": 0.08763137459754944,
|
| 349 |
+
"learning_rate": 3.9874128245030404e-05,
|
| 350 |
+
"loss": 0.2788,
|
| 351 |
+
"step": 340
|
| 352 |
+
},
|
| 353 |
+
{
|
| 354 |
+
"epoch": 2.369868810833686,
|
| 355 |
+
"grad_norm": 0.17856952548027039,
|
| 356 |
+
"learning_rate": 3.719219081536942e-05,
|
| 357 |
+
"loss": 0.2435,
|
| 358 |
+
"step": 350
|
| 359 |
+
},
|
| 360 |
+
{
|
| 361 |
+
"epoch": 2.369868810833686,
|
| 362 |
+
"eval_loss": 0.27819639444351196,
|
| 363 |
+
"eval_runtime": 67.9684,
|
| 364 |
+
"eval_samples_per_second": 15.448,
|
| 365 |
+
"eval_steps_per_second": 1.942,
|
| 366 |
+
"step": 350
|
| 367 |
+
},
|
| 368 |
+
{
|
| 369 |
+
"epoch": 2.437579348286077,
|
| 370 |
+
"grad_norm": 0.10516191273927689,
|
| 371 |
+
"learning_rate": 3.4549150281252636e-05,
|
| 372 |
+
"loss": 0.2824,
|
| 373 |
+
"step": 360
|
| 374 |
+
},
|
| 375 |
+
{
|
| 376 |
+
"epoch": 2.505289885738468,
|
| 377 |
+
"grad_norm": 0.11505354195833206,
|
| 378 |
+
"learning_rate": 3.1953033469914276e-05,
|
| 379 |
+
"loss": 0.3472,
|
| 380 |
+
"step": 370
|
| 381 |
+
},
|
| 382 |
+
{
|
| 383 |
+
"epoch": 2.5391451544646637,
|
| 384 |
+
"eval_loss": 0.27820467948913574,
|
| 385 |
+
"eval_runtime": 71.3828,
|
| 386 |
+
"eval_samples_per_second": 14.709,
|
| 387 |
+
"eval_steps_per_second": 1.849,
|
| 388 |
+
"step": 375
|
| 389 |
+
},
|
| 390 |
+
{
|
| 391 |
+
"epoch": 2.573000423190859,
|
| 392 |
+
"grad_norm": 0.09948902577161789,
|
| 393 |
+
"learning_rate": 2.9411724702784758e-05,
|
| 394 |
+
"loss": 0.2087,
|
| 395 |
+
"step": 380
|
| 396 |
+
},
|
| 397 |
+
{
|
| 398 |
+
"epoch": 2.64071096064325,
|
| 399 |
+
"grad_norm": 0.10510896891355515,
|
| 400 |
+
"learning_rate": 2.693294185106562e-05,
|
| 401 |
+
"loss": 0.2713,
|
| 402 |
+
"step": 390
|
| 403 |
+
},
|
| 404 |
+
{
|
| 405 |
+
"epoch": 2.708421498095641,
|
| 406 |
+
"grad_norm": 0.1592397391796112,
|
| 407 |
+
"learning_rate": 2.4524212896808263e-05,
|
| 408 |
+
"loss": 0.2925,
|
| 409 |
+
"step": 400
|
| 410 |
+
},
|
| 411 |
+
{
|
| 412 |
+
"epoch": 2.708421498095641,
|
| 413 |
+
"eval_loss": 0.27774715423583984,
|
| 414 |
+
"eval_runtime": 71.1939,
|
| 415 |
+
"eval_samples_per_second": 14.748,
|
| 416 |
+
"eval_steps_per_second": 1.854,
|
| 417 |
+
"step": 400
|
| 418 |
+
},
|
| 419 |
+
{
|
| 420 |
+
"epoch": 2.776132035548032,
|
| 421 |
+
"grad_norm": 0.0951530858874321,
|
| 422 |
+
"learning_rate": 2.219285307067997e-05,
|
| 423 |
+
"loss": 0.2949,
|
| 424 |
+
"step": 410
|
| 425 |
+
},
|
| 426 |
+
{
|
| 427 |
+
"epoch": 2.843842573000423,
|
| 428 |
+
"grad_norm": 0.11100845783948898,
|
| 429 |
+
"learning_rate": 1.9945942635848748e-05,
|
| 430 |
+
"loss": 0.2293,
|
| 431 |
+
"step": 420
|
| 432 |
+
},
|
| 433 |
+
{
|
| 434 |
+
"epoch": 2.8776978417266186,
|
| 435 |
+
"eval_loss": 0.27757009863853455,
|
| 436 |
+
"eval_runtime": 68.4609,
|
| 437 |
+
"eval_samples_per_second": 15.337,
|
| 438 |
+
"eval_steps_per_second": 1.928,
|
| 439 |
+
"step": 425
|
| 440 |
+
},
|
| 441 |
+
{
|
| 442 |
+
"epoch": 2.911553110452814,
|
| 443 |
+
"grad_norm": 0.10450287908315659,
|
| 444 |
+
"learning_rate": 1.7790305385456795e-05,
|
| 445 |
+
"loss": 0.286,
|
| 446 |
+
"step": 430
|
| 447 |
+
},
|
| 448 |
+
{
|
| 449 |
+
"epoch": 2.9792636479052055,
|
| 450 |
+
"grad_norm": 0.22524423897266388,
|
| 451 |
+
"learning_rate": 1.5732487918985018e-05,
|
| 452 |
+
"loss": 0.3127,
|
| 453 |
+
"step": 440
|
| 454 |
+
},
|
| 455 |
+
{
|
| 456 |
+
"epoch": 3.0469741853575965,
|
| 457 |
+
"grad_norm": 0.09041011333465576,
|
| 458 |
+
"learning_rate": 1.3778739760445552e-05,
|
| 459 |
+
"loss": 0.2899,
|
| 460 |
+
"step": 450
|
| 461 |
+
},
|
| 462 |
+
{
|
| 463 |
+
"epoch": 3.0469741853575965,
|
| 464 |
+
"eval_loss": 0.2776949107646942,
|
| 465 |
+
"eval_runtime": 71.1823,
|
| 466 |
+
"eval_samples_per_second": 14.751,
|
| 467 |
+
"eval_steps_per_second": 1.854,
|
| 468 |
+
"step": 450
|
| 469 |
+
},
|
| 470 |
+
{
|
| 471 |
+
"epoch": 3.1146847228099874,
|
| 472 |
+
"grad_norm": 0.09738585352897644,
|
| 473 |
+
"learning_rate": 1.1934994378782772e-05,
|
| 474 |
+
"loss": 0.2271,
|
| 475 |
+
"step": 460
|
| 476 |
+
},
|
| 477 |
+
{
|
| 478 |
+
"epoch": 3.1823952602623784,
|
| 479 |
+
"grad_norm": 0.09352873265743256,
|
| 480 |
+
"learning_rate": 1.0206851168123077e-05,
|
| 481 |
+
"loss": 0.2823,
|
| 482 |
+
"step": 470
|
| 483 |
+
},
|
| 484 |
+
{
|
| 485 |
+
"epoch": 3.216250528988574,
|
| 486 |
+
"eval_loss": 0.2774777412414551,
|
| 487 |
+
"eval_runtime": 69.6841,
|
| 488 |
+
"eval_samples_per_second": 15.068,
|
| 489 |
+
"eval_steps_per_second": 1.894,
|
| 490 |
+
"step": 475
|
| 491 |
+
},
|
| 492 |
+
{
|
| 493 |
+
"epoch": 3.2501057977147694,
|
| 494 |
+
"grad_norm": 0.32003673911094666,
|
| 495 |
+
"learning_rate": 8.599558442598998e-06,
|
| 496 |
+
"loss": 0.344,
|
| 497 |
+
"step": 480
|
| 498 |
+
},
|
| 499 |
+
{
|
| 500 |
+
"epoch": 3.3178163351671603,
|
| 501 |
+
"grad_norm": 0.09081516414880753,
|
| 502 |
+
"learning_rate": 7.1179974973916486e-06,
|
| 503 |
+
"loss": 0.214,
|
| 504 |
+
"step": 490
|
| 505 |
+
},
|
| 506 |
+
{
|
| 507 |
+
"epoch": 3.3855268726195513,
|
| 508 |
+
"grad_norm": 0.11058734357357025,
|
| 509 |
+
"learning_rate": 5.766667784397706e-06,
|
| 510 |
+
"loss": 0.2584,
|
| 511 |
+
"step": 500
|
| 512 |
+
},
|
| 513 |
+
{
|
| 514 |
+
"epoch": 3.3855268726195513,
|
| 515 |
+
"eval_loss": 0.27743011713027954,
|
| 516 |
+
"eval_runtime": 70.1397,
|
| 517 |
+
"eval_samples_per_second": 14.97,
|
| 518 |
+
"eval_steps_per_second": 1.882,
|
| 519 |
+
"step": 500
|
| 520 |
+
},
|
| 521 |
+
{
|
| 522 |
+
"epoch": 3.4532374100719423,
|
| 523 |
+
"grad_norm": 0.11014135181903839,
|
| 524 |
+
"learning_rate": 4.549673247541875e-06,
|
| 525 |
+
"loss": 0.2854,
|
| 526 |
+
"step": 510
|
| 527 |
+
},
|
| 528 |
+
{
|
| 529 |
+
"epoch": 3.5209479475243333,
|
| 530 |
+
"grad_norm": 0.09463568776845932,
|
| 531 |
+
"learning_rate": 3.470709859234084e-06,
|
| 532 |
+
"loss": 0.316,
|
| 533 |
+
"step": 520
|
| 534 |
+
},
|
| 535 |
+
{
|
| 536 |
+
"epoch": 3.554803216250529,
|
| 537 |
+
"eval_loss": 0.2773997485637665,
|
| 538 |
+
"eval_runtime": 68.4347,
|
| 539 |
+
"eval_samples_per_second": 15.343,
|
| 540 |
+
"eval_steps_per_second": 1.929,
|
| 541 |
+
"step": 525
|
| 542 |
+
},
|
| 543 |
+
{
|
| 544 |
+
"epoch": 3.5886584849767242,
|
| 545 |
+
"grad_norm": 0.09929580241441727,
|
| 546 |
+
"learning_rate": 2.533054395822704e-06,
|
| 547 |
+
"loss": 0.2195,
|
| 548 |
+
"step": 530
|
| 549 |
+
},
|
| 550 |
+
{
|
| 551 |
+
"epoch": 3.6563690224291157,
|
| 552 |
+
"grad_norm": 0.0915316790342331,
|
| 553 |
+
"learning_rate": 1.7395544861325718e-06,
|
| 554 |
+
"loss": 0.2809,
|
| 555 |
+
"step": 540
|
| 556 |
+
},
|
| 557 |
+
{
|
| 558 |
+
"epoch": 3.7240795598815066,
|
| 559 |
+
"grad_norm": 0.17164337635040283,
|
| 560 |
+
"learning_rate": 1.0926199633097157e-06,
|
| 561 |
+
"loss": 0.3022,
|
| 562 |
+
"step": 550
|
| 563 |
+
},
|
| 564 |
+
{
|
| 565 |
+
"epoch": 3.7240795598815066,
|
| 566 |
+
"eval_loss": 0.27738305926322937,
|
| 567 |
+
"eval_runtime": 68.6988,
|
| 568 |
+
"eval_samples_per_second": 15.284,
|
| 569 |
+
"eval_steps_per_second": 1.921,
|
| 570 |
+
"step": 550
|
| 571 |
+
},
|
| 572 |
+
{
|
| 573 |
+
"epoch": 3.7917900973338976,
|
| 574 |
+
"grad_norm": 0.09638968855142593,
|
| 575 |
+
"learning_rate": 5.9421554623742e-07,
|
| 576 |
+
"loss": 0.2669,
|
| 577 |
+
"step": 560
|
| 578 |
+
},
|
| 579 |
+
{
|
| 580 |
+
"epoch": 3.8595006347862886,
|
| 581 |
+
"grad_norm": 0.18140298128128052,
|
| 582 |
+
"learning_rate": 2.458548727494292e-07,
|
| 583 |
+
"loss": 0.2454,
|
| 584 |
+
"step": 570
|
| 585 |
+
},
|
| 586 |
+
{
|
| 587 |
+
"epoch": 3.893355903512484,
|
| 588 |
+
"eval_loss": 0.277375727891922,
|
| 589 |
+
"eval_runtime": 72.7395,
|
| 590 |
+
"eval_samples_per_second": 14.435,
|
| 591 |
+
"eval_steps_per_second": 1.815,
|
| 592 |
+
"step": 575
|
| 593 |
+
}
|
| 594 |
+
],
|
| 595 |
+
"logging_steps": 10,
|
| 596 |
+
"max_steps": 588,
|
| 597 |
+
"num_input_tokens_seen": 0,
|
| 598 |
+
"num_train_epochs": 4,
|
| 599 |
+
"save_steps": 25,
|
| 600 |
+
"stateful_callbacks": {
|
| 601 |
+
"EarlyStoppingCallback": {
|
| 602 |
+
"args": {
|
| 603 |
+
"early_stopping_patience": 7,
|
| 604 |
+
"early_stopping_threshold": 0.0
|
| 605 |
+
},
|
| 606 |
+
"attributes": {
|
| 607 |
+
"early_stopping_patience_counter": 0
|
| 608 |
+
}
|
| 609 |
+
},
|
| 610 |
+
"TrainerControl": {
|
| 611 |
+
"args": {
|
| 612 |
+
"should_epoch_stop": false,
|
| 613 |
+
"should_evaluate": false,
|
| 614 |
+
"should_log": false,
|
| 615 |
+
"should_save": true,
|
| 616 |
+
"should_training_stop": false
|
| 617 |
+
},
|
| 618 |
+
"attributes": {}
|
| 619 |
+
}
|
| 620 |
+
},
|
| 621 |
+
"total_flos": 3.485296471781376e+16,
|
| 622 |
+
"train_batch_size": 4,
|
| 623 |
+
"trial_name": null,
|
| 624 |
+
"trial_params": null
|
| 625 |
+
}
|
model_output/incremental_1_logs/special_tokens_map.json
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bos_token": {
|
| 3 |
+
"content": "<s>",
|
| 4 |
+
"lstrip": false,
|
| 5 |
+
"normalized": false,
|
| 6 |
+
"rstrip": false,
|
| 7 |
+
"single_word": false
|
| 8 |
+
},
|
| 9 |
+
"eos_token": {
|
| 10 |
+
"content": "</s>",
|
| 11 |
+
"lstrip": false,
|
| 12 |
+
"normalized": false,
|
| 13 |
+
"rstrip": false,
|
| 14 |
+
"single_word": false
|
| 15 |
+
},
|
| 16 |
+
"pad_token": "</s>",
|
| 17 |
+
"unk_token": {
|
| 18 |
+
"content": "<unk>",
|
| 19 |
+
"lstrip": false,
|
| 20 |
+
"normalized": false,
|
| 21 |
+
"rstrip": false,
|
| 22 |
+
"single_word": false
|
| 23 |
+
}
|
| 24 |
+
}
|
model_output/incremental_1_logs/tokenizer.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
model_output/incremental_1_logs/tokenizer_config.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"add_bos_token": true,
|
| 3 |
+
"add_eos_token": false,
|
| 4 |
+
"add_prefix_space": null,
|
| 5 |
+
"added_tokens_decoder": {
|
| 6 |
+
"0": {
|
| 7 |
+
"content": "<unk>",
|
| 8 |
+
"lstrip": false,
|
| 9 |
+
"normalized": false,
|
| 10 |
+
"rstrip": false,
|
| 11 |
+
"single_word": false,
|
| 12 |
+
"special": true
|
| 13 |
+
},
|
| 14 |
+
"1": {
|
| 15 |
+
"content": "<s>",
|
| 16 |
+
"lstrip": false,
|
| 17 |
+
"normalized": false,
|
| 18 |
+
"rstrip": false,
|
| 19 |
+
"single_word": false,
|
| 20 |
+
"special": true
|
| 21 |
+
},
|
| 22 |
+
"2": {
|
| 23 |
+
"content": "</s>",
|
| 24 |
+
"lstrip": false,
|
| 25 |
+
"normalized": false,
|
| 26 |
+
"rstrip": false,
|
| 27 |
+
"single_word": false,
|
| 28 |
+
"special": true
|
| 29 |
+
}
|
| 30 |
+
},
|
| 31 |
+
"bos_token": "<s>",
|
| 32 |
+
"chat_template": "{% for message in messages %}\n{% if message['role'] == 'user' %}\n{{ '<|user|>\n' + message['content'] + eos_token }}\n{% elif message['role'] == 'system' %}\n{{ '<|system|>\n' + message['content'] + eos_token }}\n{% elif message['role'] == 'assistant' %}\n{{ '<|assistant|>\n' + message['content'] + eos_token }}\n{% endif %}\n{% if loop.last and add_generation_prompt %}\n{{ '<|assistant|>' }}\n{% endif %}\n{% endfor %}",
|
| 33 |
+
"clean_up_tokenization_spaces": false,
|
| 34 |
+
"eos_token": "</s>",
|
| 35 |
+
"legacy": false,
|
| 36 |
+
"model_max_length": 2048,
|
| 37 |
+
"pad_token": "</s>",
|
| 38 |
+
"padding_side": "right",
|
| 39 |
+
"sp_model_kwargs": {},
|
| 40 |
+
"tokenizer_class": "LlamaTokenizer",
|
| 41 |
+
"unk_token": "<unk>",
|
| 42 |
+
"use_default_system_prompt": false
|
| 43 |
+
}
|
model_output/phi2_finetuned_logs/README.md
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
base_model: TinyLlama/TinyLlama-1.1B-Chat-v1.0
|
| 3 |
+
library_name: peft
|
| 4 |
+
---
|
| 5 |
+
|
| 6 |
+
# Model Card for Model ID
|
| 7 |
+
|
| 8 |
+
<!-- Provide a quick summary of what the model is/does. -->
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
## Model Details
|
| 13 |
+
|
| 14 |
+
### Model Description
|
| 15 |
+
|
| 16 |
+
<!-- Provide a longer summary of what this model is. -->
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
- **Developed by:** [More Information Needed]
|
| 21 |
+
- **Funded by [optional]:** [More Information Needed]
|
| 22 |
+
- **Shared by [optional]:** [More Information Needed]
|
| 23 |
+
- **Model type:** [More Information Needed]
|
| 24 |
+
- **Language(s) (NLP):** [More Information Needed]
|
| 25 |
+
- **License:** [More Information Needed]
|
| 26 |
+
- **Finetuned from model [optional]:** [More Information Needed]
|
| 27 |
+
|
| 28 |
+
### Model Sources [optional]
|
| 29 |
+
|
| 30 |
+
<!-- Provide the basic links for the model. -->
|
| 31 |
+
|
| 32 |
+
- **Repository:** [More Information Needed]
|
| 33 |
+
- **Paper [optional]:** [More Information Needed]
|
| 34 |
+
- **Demo [optional]:** [More Information Needed]
|
| 35 |
+
|
| 36 |
+
## Uses
|
| 37 |
+
|
| 38 |
+
<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
|
| 39 |
+
|
| 40 |
+
### Direct Use
|
| 41 |
+
|
| 42 |
+
<!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
|
| 43 |
+
|
| 44 |
+
[More Information Needed]
|
| 45 |
+
|
| 46 |
+
### Downstream Use [optional]
|
| 47 |
+
|
| 48 |
+
<!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
|
| 49 |
+
|
| 50 |
+
[More Information Needed]
|
| 51 |
+
|
| 52 |
+
### Out-of-Scope Use
|
| 53 |
+
|
| 54 |
+
<!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
|
| 55 |
+
|
| 56 |
+
[More Information Needed]
|
| 57 |
+
|
| 58 |
+
## Bias, Risks, and Limitations
|
| 59 |
+
|
| 60 |
+
<!-- This section is meant to convey both technical and sociotechnical limitations. -->
|
| 61 |
+
|
| 62 |
+
[More Information Needed]
|
| 63 |
+
|
| 64 |
+
### Recommendations
|
| 65 |
+
|
| 66 |
+
<!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
|
| 67 |
+
|
| 68 |
+
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
|
| 69 |
+
|
| 70 |
+
## How to Get Started with the Model
|
| 71 |
+
|
| 72 |
+
Use the code below to get started with the model.
|
| 73 |
+
|
| 74 |
+
[More Information Needed]
|
| 75 |
+
|
| 76 |
+
## Training Details
|
| 77 |
+
|
| 78 |
+
### Training Data
|
| 79 |
+
|
| 80 |
+
<!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
|
| 81 |
+
|
| 82 |
+
[More Information Needed]
|
| 83 |
+
|
| 84 |
+
### Training Procedure
|
| 85 |
+
|
| 86 |
+
<!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
|
| 87 |
+
|
| 88 |
+
#### Preprocessing [optional]
|
| 89 |
+
|
| 90 |
+
[More Information Needed]
|
| 91 |
+
|
| 92 |
+
|
| 93 |
+
#### Training Hyperparameters
|
| 94 |
+
|
| 95 |
+
- **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
|
| 96 |
+
|
| 97 |
+
#### Speeds, Sizes, Times [optional]
|
| 98 |
+
|
| 99 |
+
<!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
|
| 100 |
+
|
| 101 |
+
[More Information Needed]
|
| 102 |
+
|
| 103 |
+
## Evaluation
|
| 104 |
+
|
| 105 |
+
<!-- This section describes the evaluation protocols and provides the results. -->
|
| 106 |
+
|
| 107 |
+
### Testing Data, Factors & Metrics
|
| 108 |
+
|
| 109 |
+
#### Testing Data
|
| 110 |
+
|
| 111 |
+
<!-- This should link to a Dataset Card if possible. -->
|
| 112 |
+
|
| 113 |
+
[More Information Needed]
|
| 114 |
+
|
| 115 |
+
#### Factors
|
| 116 |
+
|
| 117 |
+
<!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
|
| 118 |
+
|
| 119 |
+
[More Information Needed]
|
| 120 |
+
|
| 121 |
+
#### Metrics
|
| 122 |
+
|
| 123 |
+
<!-- These are the evaluation metrics being used, ideally with a description of why. -->
|
| 124 |
+
|
| 125 |
+
[More Information Needed]
|
| 126 |
+
|
| 127 |
+
### Results
|
| 128 |
+
|
| 129 |
+
[More Information Needed]
|
| 130 |
+
|
| 131 |
+
#### Summary
|
| 132 |
+
|
| 133 |
+
|
| 134 |
+
|
| 135 |
+
## Model Examination [optional]
|
| 136 |
+
|
| 137 |
+
<!-- Relevant interpretability work for the model goes here -->
|
| 138 |
+
|
| 139 |
+
[More Information Needed]
|
| 140 |
+
|
| 141 |
+
## Environmental Impact
|
| 142 |
+
|
| 143 |
+
<!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
|
| 144 |
+
|
| 145 |
+
Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
|
| 146 |
+
|
| 147 |
+
- **Hardware Type:** [More Information Needed]
|
| 148 |
+
- **Hours used:** [More Information Needed]
|
| 149 |
+
- **Cloud Provider:** [More Information Needed]
|
| 150 |
+
- **Compute Region:** [More Information Needed]
|
| 151 |
+
- **Carbon Emitted:** [More Information Needed]
|
| 152 |
+
|
| 153 |
+
## Technical Specifications [optional]
|
| 154 |
+
|
| 155 |
+
### Model Architecture and Objective
|
| 156 |
+
|
| 157 |
+
[More Information Needed]
|
| 158 |
+
|
| 159 |
+
### Compute Infrastructure
|
| 160 |
+
|
| 161 |
+
[More Information Needed]
|
| 162 |
+
|
| 163 |
+
#### Hardware
|
| 164 |
+
|
| 165 |
+
[More Information Needed]
|
| 166 |
+
|
| 167 |
+
#### Software
|
| 168 |
+
|
| 169 |
+
[More Information Needed]
|
| 170 |
+
|
| 171 |
+
## Citation [optional]
|
| 172 |
+
|
| 173 |
+
<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
|
| 174 |
+
|
| 175 |
+
**BibTeX:**
|
| 176 |
+
|
| 177 |
+
[More Information Needed]
|
| 178 |
+
|
| 179 |
+
**APA:**
|
| 180 |
+
|
| 181 |
+
[More Information Needed]
|
| 182 |
+
|
| 183 |
+
## Glossary [optional]
|
| 184 |
+
|
| 185 |
+
<!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
|
| 186 |
+
|
| 187 |
+
[More Information Needed]
|
| 188 |
+
|
| 189 |
+
## More Information [optional]
|
| 190 |
+
|
| 191 |
+
[More Information Needed]
|
| 192 |
+
|
| 193 |
+
## Model Card Authors [optional]
|
| 194 |
+
|
| 195 |
+
[More Information Needed]
|
| 196 |
+
|
| 197 |
+
## Model Card Contact
|
| 198 |
+
|
| 199 |
+
[More Information Needed]
|
| 200 |
+
### Framework versions
|
| 201 |
+
|
| 202 |
+
- PEFT 0.11.1
|
model_output/phi2_finetuned_logs/adapter_config.json
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"alpha_pattern": {},
|
| 3 |
+
"auto_mapping": null,
|
| 4 |
+
"base_model_name_or_path": "TinyLlama/TinyLlama-1.1B-Chat-v1.0",
|
| 5 |
+
"bias": "none",
|
| 6 |
+
"fan_in_fan_out": false,
|
| 7 |
+
"inference_mode": true,
|
| 8 |
+
"init_lora_weights": true,
|
| 9 |
+
"layer_replication": null,
|
| 10 |
+
"layers_pattern": null,
|
| 11 |
+
"layers_to_transform": null,
|
| 12 |
+
"loftq_config": {},
|
| 13 |
+
"lora_alpha": 124,
|
| 14 |
+
"lora_dropout": 0.15,
|
| 15 |
+
"megatron_config": null,
|
| 16 |
+
"megatron_core": "megatron.core",
|
| 17 |
+
"modules_to_save": null,
|
| 18 |
+
"peft_type": "LORA",
|
| 19 |
+
"r": 32,
|
| 20 |
+
"rank_pattern": {},
|
| 21 |
+
"revision": null,
|
| 22 |
+
"target_modules": [
|
| 23 |
+
"v_proj",
|
| 24 |
+
"q_proj"
|
| 25 |
+
],
|
| 26 |
+
"task_type": "CAUSAL_LM",
|
| 27 |
+
"use_dora": false,
|
| 28 |
+
"use_rslora": false
|
| 29 |
+
}
|
model_output/phi2_finetuned_logs/special_tokens_map.json
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bos_token": {
|
| 3 |
+
"content": "<s>",
|
| 4 |
+
"lstrip": false,
|
| 5 |
+
"normalized": false,
|
| 6 |
+
"rstrip": false,
|
| 7 |
+
"single_word": false
|
| 8 |
+
},
|
| 9 |
+
"eos_token": {
|
| 10 |
+
"content": "</s>",
|
| 11 |
+
"lstrip": false,
|
| 12 |
+
"normalized": false,
|
| 13 |
+
"rstrip": false,
|
| 14 |
+
"single_word": false
|
| 15 |
+
},
|
| 16 |
+
"pad_token": "</s>",
|
| 17 |
+
"unk_token": {
|
| 18 |
+
"content": "<unk>",
|
| 19 |
+
"lstrip": false,
|
| 20 |
+
"normalized": false,
|
| 21 |
+
"rstrip": false,
|
| 22 |
+
"single_word": false
|
| 23 |
+
}
|
| 24 |
+
}
|
model_output/phi2_finetuned_logs/tokenizer.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
model_output/phi2_finetuned_logs/tokenizer_config.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"add_bos_token": true,
|
| 3 |
+
"add_eos_token": false,
|
| 4 |
+
"add_prefix_space": null,
|
| 5 |
+
"added_tokens_decoder": {
|
| 6 |
+
"0": {
|
| 7 |
+
"content": "<unk>",
|
| 8 |
+
"lstrip": false,
|
| 9 |
+
"normalized": false,
|
| 10 |
+
"rstrip": false,
|
| 11 |
+
"single_word": false,
|
| 12 |
+
"special": true
|
| 13 |
+
},
|
| 14 |
+
"1": {
|
| 15 |
+
"content": "<s>",
|
| 16 |
+
"lstrip": false,
|
| 17 |
+
"normalized": false,
|
| 18 |
+
"rstrip": false,
|
| 19 |
+
"single_word": false,
|
| 20 |
+
"special": true
|
| 21 |
+
},
|
| 22 |
+
"2": {
|
| 23 |
+
"content": "</s>",
|
| 24 |
+
"lstrip": false,
|
| 25 |
+
"normalized": false,
|
| 26 |
+
"rstrip": false,
|
| 27 |
+
"single_word": false,
|
| 28 |
+
"special": true
|
| 29 |
+
}
|
| 30 |
+
},
|
| 31 |
+
"bos_token": "<s>",
|
| 32 |
+
"chat_template": "{% for message in messages %}\n{% if message['role'] == 'user' %}\n{{ '<|user|>\n' + message['content'] + eos_token }}\n{% elif message['role'] == 'system' %}\n{{ '<|system|>\n' + message['content'] + eos_token }}\n{% elif message['role'] == 'assistant' %}\n{{ '<|assistant|>\n' + message['content'] + eos_token }}\n{% endif %}\n{% if loop.last and add_generation_prompt %}\n{{ '<|assistant|>' }}\n{% endif %}\n{% endfor %}",
|
| 33 |
+
"clean_up_tokenization_spaces": false,
|
| 34 |
+
"eos_token": "</s>",
|
| 35 |
+
"legacy": false,
|
| 36 |
+
"model_max_length": 2048,
|
| 37 |
+
"pad_token": "</s>",
|
| 38 |
+
"padding_side": "right",
|
| 39 |
+
"sp_model_kwargs": {},
|
| 40 |
+
"tokenizer_class": "LlamaTokenizer",
|
| 41 |
+
"unk_token": "<unk>",
|
| 42 |
+
"use_default_system_prompt": false
|
| 43 |
+
}
|
phivenv/Lib/site-packages/certifi-2025.8.3.dist-info/INSTALLER
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
pip
|
phivenv/Lib/site-packages/certifi-2025.8.3.dist-info/METADATA
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Metadata-Version: 2.4
|
| 2 |
+
Name: certifi
|
| 3 |
+
Version: 2025.8.3
|
| 4 |
+
Summary: Python package for providing Mozilla's CA Bundle.
|
| 5 |
+
Home-page: https://github.com/certifi/python-certifi
|
| 6 |
+
Author: Kenneth Reitz
|
| 7 |
+
Author-email: me@kennethreitz.com
|
| 8 |
+
License: MPL-2.0
|
| 9 |
+
Project-URL: Source, https://github.com/certifi/python-certifi
|
| 10 |
+
Classifier: Development Status :: 5 - Production/Stable
|
| 11 |
+
Classifier: Intended Audience :: Developers
|
| 12 |
+
Classifier: License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)
|
| 13 |
+
Classifier: Natural Language :: English
|
| 14 |
+
Classifier: Programming Language :: Python
|
| 15 |
+
Classifier: Programming Language :: Python :: 3
|
| 16 |
+
Classifier: Programming Language :: Python :: 3 :: Only
|
| 17 |
+
Classifier: Programming Language :: Python :: 3.7
|
| 18 |
+
Classifier: Programming Language :: Python :: 3.8
|
| 19 |
+
Classifier: Programming Language :: Python :: 3.9
|
| 20 |
+
Classifier: Programming Language :: Python :: 3.10
|
| 21 |
+
Classifier: Programming Language :: Python :: 3.11
|
| 22 |
+
Classifier: Programming Language :: Python :: 3.12
|
| 23 |
+
Classifier: Programming Language :: Python :: 3.13
|
| 24 |
+
Requires-Python: >=3.7
|
| 25 |
+
License-File: LICENSE
|
| 26 |
+
Dynamic: author
|
| 27 |
+
Dynamic: author-email
|
| 28 |
+
Dynamic: classifier
|
| 29 |
+
Dynamic: description
|
| 30 |
+
Dynamic: home-page
|
| 31 |
+
Dynamic: license
|
| 32 |
+
Dynamic: license-file
|
| 33 |
+
Dynamic: project-url
|
| 34 |
+
Dynamic: requires-python
|
| 35 |
+
Dynamic: summary
|
| 36 |
+
|
| 37 |
+
Certifi: Python SSL Certificates
|
| 38 |
+
================================
|
| 39 |
+
|
| 40 |
+
Certifi provides Mozilla's carefully curated collection of Root Certificates for
|
| 41 |
+
validating the trustworthiness of SSL certificates while verifying the identity
|
| 42 |
+
of TLS hosts. It has been extracted from the `Requests`_ project.
|
| 43 |
+
|
| 44 |
+
Installation
|
| 45 |
+
------------
|
| 46 |
+
|
| 47 |
+
``certifi`` is available on PyPI. Simply install it with ``pip``::
|
| 48 |
+
|
| 49 |
+
$ pip install certifi
|
| 50 |
+
|
| 51 |
+
Usage
|
| 52 |
+
-----
|
| 53 |
+
|
| 54 |
+
To reference the installed certificate authority (CA) bundle, you can use the
|
| 55 |
+
built-in function::
|
| 56 |
+
|
| 57 |
+
>>> import certifi
|
| 58 |
+
|
| 59 |
+
>>> certifi.where()
|
| 60 |
+
'/usr/local/lib/python3.7/site-packages/certifi/cacert.pem'
|
| 61 |
+
|
| 62 |
+
Or from the command line::
|
| 63 |
+
|
| 64 |
+
$ python -m certifi
|
| 65 |
+
/usr/local/lib/python3.7/site-packages/certifi/cacert.pem
|
| 66 |
+
|
| 67 |
+
Enjoy!
|
| 68 |
+
|
| 69 |
+
.. _`Requests`: https://requests.readthedocs.io/en/master/
|
| 70 |
+
|
| 71 |
+
Addition/Removal of Certificates
|
| 72 |
+
--------------------------------
|
| 73 |
+
|
| 74 |
+
Certifi does not support any addition/removal or other modification of the
|
| 75 |
+
CA trust store content. This project is intended to provide a reliable and
|
| 76 |
+
highly portable root of trust to python deployments. Look to upstream projects
|
| 77 |
+
for methods to use alternate trust.
|
phivenv/Lib/site-packages/certifi-2025.8.3.dist-info/RECORD
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
certifi-2025.8.3.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
|
| 2 |
+
certifi-2025.8.3.dist-info/METADATA,sha256=z4sG3fosbP3nviub_TUpSb71z0bPmsp3Xa6ZIatGUe4,2422
|
| 3 |
+
certifi-2025.8.3.dist-info/RECORD,,
|
| 4 |
+
certifi-2025.8.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
| 5 |
+
certifi-2025.8.3.dist-info/licenses/LICENSE,sha256=6TcW2mucDVpKHfYP5pWzcPBpVgPSH2-D8FPkLPwQyvc,989
|
| 6 |
+
certifi-2025.8.3.dist-info/top_level.txt,sha256=KMu4vUCfsjLrkPbSNdgdekS-pVJzBAJFO__nI8NF6-U,8
|
| 7 |
+
certifi/__init__.py,sha256=0a5ro4KTYep37Oo0Z8TycCPXaDlOEtvuj2pNWZ_1t8Y,94
|
| 8 |
+
certifi/__main__.py,sha256=xBBoj905TUWBLRGANOcf7oi6e-3dMP4cEoG9OyMs11g,243
|
| 9 |
+
certifi/__pycache__/__init__.cpython-39.pyc,,
|
| 10 |
+
certifi/__pycache__/__main__.cpython-39.pyc,,
|
| 11 |
+
certifi/__pycache__/core.cpython-39.pyc,,
|
| 12 |
+
certifi/cacert.pem,sha256=kQLmo2RKBxumzb1KU2mPKRxKZLGEUKCLwEZUi221zIs,287634
|
| 13 |
+
certifi/core.py,sha256=XFXycndG5pf37ayeF8N32HUuDafsyhkVMbO4BAPWHa0,3394
|
| 14 |
+
certifi/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
phivenv/Lib/site-packages/certifi-2025.8.3.dist-info/WHEEL
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Wheel-Version: 1.0
|
| 2 |
+
Generator: setuptools (80.9.0)
|
| 3 |
+
Root-Is-Purelib: true
|
| 4 |
+
Tag: py3-none-any
|
| 5 |
+
|
phivenv/Lib/site-packages/certifi-2025.8.3.dist-info/licenses/LICENSE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
This package contains a modified version of ca-bundle.crt:
|
| 2 |
+
|
| 3 |
+
ca-bundle.crt -- Bundle of CA Root Certificates
|
| 4 |
+
|
| 5 |
+
This is a bundle of X.509 certificates of public Certificate Authorities
|
| 6 |
+
(CA). These were automatically extracted from Mozilla's root certificates
|
| 7 |
+
file (certdata.txt). This file can be found in the mozilla source tree:
|
| 8 |
+
https://hg.mozilla.org/mozilla-central/file/tip/security/nss/lib/ckfw/builtins/certdata.txt
|
| 9 |
+
It contains the certificates in PEM format and therefore
|
| 10 |
+
can be directly used with curl / libcurl / php_curl, or with
|
| 11 |
+
an Apache+mod_ssl webserver for SSL client authentication.
|
| 12 |
+
Just configure this file as the SSLCACertificateFile.#
|
| 13 |
+
|
| 14 |
+
***** BEGIN LICENSE BLOCK *****
|
| 15 |
+
This Source Code Form is subject to the terms of the Mozilla Public License,
|
| 16 |
+
v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain
|
| 17 |
+
one at http://mozilla.org/MPL/2.0/.
|
| 18 |
+
|
| 19 |
+
***** END LICENSE BLOCK *****
|
| 20 |
+
@(#) $RCSfile: certdata.txt,v $ $Revision: 1.80 $ $Date: 2011/11/03 15:11:58 $
|
phivenv/Lib/site-packages/certifi-2025.8.3.dist-info/top_level.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
certifi
|
phivenv/Lib/site-packages/certifi/__init__.py
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from .core import contents, where
|
| 2 |
+
|
| 3 |
+
__all__ = ["contents", "where"]
|
| 4 |
+
__version__ = "2025.08.03"
|
phivenv/Lib/site-packages/certifi/__main__.py
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import argparse
|
| 2 |
+
|
| 3 |
+
from certifi import contents, where
|
| 4 |
+
|
| 5 |
+
parser = argparse.ArgumentParser()
|
| 6 |
+
parser.add_argument("-c", "--contents", action="store_true")
|
| 7 |
+
args = parser.parse_args()
|
| 8 |
+
|
| 9 |
+
if args.contents:
|
| 10 |
+
print(contents())
|
| 11 |
+
else:
|
| 12 |
+
print(where())
|
phivenv/Lib/site-packages/certifi/__pycache__/__init__.cpython-39.pyc
ADDED
|
Binary file (264 Bytes). View file
|
|
|
phivenv/Lib/site-packages/certifi/__pycache__/__main__.cpython-39.pyc
ADDED
|
Binary file (400 Bytes). View file
|
|
|
phivenv/Lib/site-packages/certifi/__pycache__/core.cpython-39.pyc
ADDED
|
Binary file (1.37 kB). View file
|
|
|
phivenv/Lib/site-packages/certifi/cacert.pem
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
phivenv/Lib/site-packages/certifi/core.py
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
certifi.py
|
| 3 |
+
~~~~~~~~~~
|
| 4 |
+
|
| 5 |
+
This module returns the installation location of cacert.pem or its contents.
|
| 6 |
+
"""
|
| 7 |
+
import sys
|
| 8 |
+
import atexit
|
| 9 |
+
|
| 10 |
+
def exit_cacert_ctx() -> None:
|
| 11 |
+
_CACERT_CTX.__exit__(None, None, None) # type: ignore[union-attr]
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
if sys.version_info >= (3, 11):
|
| 15 |
+
|
| 16 |
+
from importlib.resources import as_file, files
|
| 17 |
+
|
| 18 |
+
_CACERT_CTX = None
|
| 19 |
+
_CACERT_PATH = None
|
| 20 |
+
|
| 21 |
+
def where() -> str:
|
| 22 |
+
# This is slightly terrible, but we want to delay extracting the file
|
| 23 |
+
# in cases where we're inside of a zipimport situation until someone
|
| 24 |
+
# actually calls where(), but we don't want to re-extract the file
|
| 25 |
+
# on every call of where(), so we'll do it once then store it in a
|
| 26 |
+
# global variable.
|
| 27 |
+
global _CACERT_CTX
|
| 28 |
+
global _CACERT_PATH
|
| 29 |
+
if _CACERT_PATH is None:
|
| 30 |
+
# This is slightly janky, the importlib.resources API wants you to
|
| 31 |
+
# manage the cleanup of this file, so it doesn't actually return a
|
| 32 |
+
# path, it returns a context manager that will give you the path
|
| 33 |
+
# when you enter it and will do any cleanup when you leave it. In
|
| 34 |
+
# the common case of not needing a temporary file, it will just
|
| 35 |
+
# return the file system location and the __exit__() is a no-op.
|
| 36 |
+
#
|
| 37 |
+
# We also have to hold onto the actual context manager, because
|
| 38 |
+
# it will do the cleanup whenever it gets garbage collected, so
|
| 39 |
+
# we will also store that at the global level as well.
|
| 40 |
+
_CACERT_CTX = as_file(files("certifi").joinpath("cacert.pem"))
|
| 41 |
+
_CACERT_PATH = str(_CACERT_CTX.__enter__())
|
| 42 |
+
atexit.register(exit_cacert_ctx)
|
| 43 |
+
|
| 44 |
+
return _CACERT_PATH
|
| 45 |
+
|
| 46 |
+
def contents() -> str:
|
| 47 |
+
return files("certifi").joinpath("cacert.pem").read_text(encoding="ascii")
|
| 48 |
+
|
| 49 |
+
else:
|
| 50 |
+
|
| 51 |
+
from importlib.resources import path as get_path, read_text
|
| 52 |
+
|
| 53 |
+
_CACERT_CTX = None
|
| 54 |
+
_CACERT_PATH = None
|
| 55 |
+
|
| 56 |
+
def where() -> str:
|
| 57 |
+
# This is slightly terrible, but we want to delay extracting the
|
| 58 |
+
# file in cases where we're inside of a zipimport situation until
|
| 59 |
+
# someone actually calls where(), but we don't want to re-extract
|
| 60 |
+
# the file on every call of where(), so we'll do it once then store
|
| 61 |
+
# it in a global variable.
|
| 62 |
+
global _CACERT_CTX
|
| 63 |
+
global _CACERT_PATH
|
| 64 |
+
if _CACERT_PATH is None:
|
| 65 |
+
# This is slightly janky, the importlib.resources API wants you
|
| 66 |
+
# to manage the cleanup of this file, so it doesn't actually
|
| 67 |
+
# return a path, it returns a context manager that will give
|
| 68 |
+
# you the path when you enter it and will do any cleanup when
|
| 69 |
+
# you leave it. In the common case of not needing a temporary
|
| 70 |
+
# file, it will just return the file system location and the
|
| 71 |
+
# __exit__() is a no-op.
|
| 72 |
+
#
|
| 73 |
+
# We also have to hold onto the actual context manager, because
|
| 74 |
+
# it will do the cleanup whenever it gets garbage collected, so
|
| 75 |
+
# we will also store that at the global level as well.
|
| 76 |
+
_CACERT_CTX = get_path("certifi", "cacert.pem")
|
| 77 |
+
_CACERT_PATH = str(_CACERT_CTX.__enter__())
|
| 78 |
+
atexit.register(exit_cacert_ctx)
|
| 79 |
+
|
| 80 |
+
return _CACERT_PATH
|
| 81 |
+
|
| 82 |
+
def contents() -> str:
|
| 83 |
+
return read_text("certifi", "cacert.p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
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
import logging
|
| 4 |
+
from os import PathLike
|
| 5 |
+
from typing import BinaryIO
|
| 6 |
+
|
| 7 |
+
from .cd import (
|
| 8 |
+
coherence_ratio,
|
| 9 |
+
encoding_languages,
|
| 10 |
+
mb_encoding_languages,
|
| 11 |
+
merge_coherence_ratios,
|
| 12 |
+
)
|
| 13 |
+
from .constant import IANA_SUPPORTED, TOO_BIG_SEQUENCE, TOO_SMALL_SEQUENCE, TRACE
|
| 14 |
+
from .md import mess_ratio
|
| 15 |
+
from .models import CharsetMatch, CharsetMatches
|
| 16 |
+
from .utils import (
|
| 17 |
+
any_specified_encoding,
|
| 18 |
+
cut_sequence_chunks,
|
| 19 |
+
iana_name,
|
| 20 |
+
identify_sig_or_bom,
|
| 21 |
+
is_cp_similar,
|
| 22 |
+
is_multi_byte_encoding,
|
| 23 |
+
should_strip_sig_or_bom,
|
| 24 |
+
)
|
| 25 |
+
|
| 26 |
+
logger = logging.getLogger("charset_normalizer")
|
| 27 |
+
explain_handler = logging.StreamHandler()
|
| 28 |
+
explain_handler.setFormatter(
|
| 29 |
+
logging.Formatter("%(asctime)s | %(levelname)s | %(message)s")
|
| 30 |
+
)
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
def from_bytes(
|
| 34 |
+
sequences: bytes | bytearray,
|
| 35 |
+
steps: int = 5,
|
| 36 |
+
chunk_size: int = 512,
|
| 37 |
+
threshold: float = 0.2,
|
| 38 |
+
cp_isolation: list[str] | None = None,
|
| 39 |
+
cp_exclusion: list[str] | None = None,
|
| 40 |
+
preemptive_behaviour: bool = True,
|
| 41 |
+
explain: bool = False,
|
| 42 |
+
language_threshold: float = 0.1,
|
| 43 |
+
enable_fallback: bool = True,
|
| 44 |
+
) -> CharsetMatches:
|
| 45 |
+
"""
|
| 46 |
+
Given a raw bytes sequence, return the best possibles charset usable to render str objects.
|
| 47 |
+
If there is no results, it is a strong indicator that the source is binary/not text.
|
| 48 |
+
By default, the process will extract 5 blocks of 512o each to assess the mess and coherence of a given sequence.
|
| 49 |
+
And will give up a particular code page after 20% of measured mess. Those criteria are customizable at will.
|
| 50 |
+
|
| 51 |
+
The preemptive behavior DOES NOT replace the traditional detection workflow, it prioritize a particular code page
|
| 52 |
+
but never take it for granted. Can improve the performance.
|
| 53 |
+
|
| 54 |
+
You may want to focus your attention to some code page or/and not others, use cp_isolation and cp_exclusion for that
|
| 55 |
+
purpose.
|
| 56 |
+
|
| 57 |
+
This function will strip the SIG in the payload/sequence every time except on UTF-16, UTF-32.
|
| 58 |
+
By default the library does not setup any handler other than the NullHandler, if you choose to set the 'explain'
|
| 59 |
+
toggle to True it will alter the logger configuration to add a StreamHandler that is suitable for debugging.
|
| 60 |
+
Custom logging format and handler can be set manually.
|
| 61 |
+
"""
|
| 62 |
+
|
| 63 |
+
if not isinstance(sequences, (bytearray, bytes)):
|
| 64 |
+
raise TypeError(
|
| 65 |
+
"Expected object of type bytes or bytearray, got: {}".format(
|
| 66 |
+
type(sequences)
|
| 67 |
+
)
|
| 68 |
+
)
|
| 69 |
+
|
| 70 |
+
if explain:
|
| 71 |
+
previous_logger_level: int = logger.level
|
| 72 |
+
logger.addHandler(explain_handler)
|
| 73 |
+
logger.setLevel(TRACE)
|
| 74 |
+
|
| 75 |
+
length: int = len(sequences)
|
| 76 |
+
|
| 77 |
+
if length == 0:
|
| 78 |
+
logger.debug("Encoding detection on empty bytes, assuming utf_8 intention.")
|
| 79 |
+
if explain: # Defensive: ensure exit path clean handler
|
| 80 |
+
logger.removeHandler(explain_handler)
|
| 81 |
+
logger.setLevel(previous_logger_level or logging.WARNING)
|
| 82 |
+
return CharsetMatches([CharsetMatch(sequences, "utf_8", 0.0, False, [], "")])
|
| 83 |
+
|
| 84 |
+
if cp_isolation is not None:
|
| 85 |
+
logger.log(
|
| 86 |
+
TRACE,
|
| 87 |
+
"cp_isolation is set. use this flag for debugging purpose. "
|
| 88 |
+
"limited list of encoding allowed : %s.",
|
| 89 |
+
", ".join(cp_isolation),
|
| 90 |
+
)
|
| 91 |
+
cp_isolation = [iana_name(cp, False) for cp in cp_isolation]
|
| 92 |
+
else:
|
| 93 |
+
cp_isolation = []
|
| 94 |
+
|
| 95 |
+
if cp_exclusion is not None:
|
| 96 |
+
logger.log(
|
| 97 |
+
TRACE,
|
| 98 |
+
"cp_exclusion is set. use this flag for debugging purpose. "
|
| 99 |
+
"limited list of encoding excluded : %s.",
|
| 100 |
+
", ".join(cp_exclusion),
|
| 101 |
+
)
|
| 102 |
+
cp_exclusion = [iana_name(cp, False) for cp in cp_exclusion]
|
| 103 |
+
else:
|
| 104 |
+
cp_exclusion = []
|
| 105 |
+
|
| 106 |
+
if length <= (chunk_size * steps):
|
| 107 |
+
logger.log(
|
| 108 |
+
TRACE,
|
| 109 |
+
"override steps (%i) and chunk_size (%i) as content does not fit (%i byte(s) given) parameters.",
|
| 110 |
+
steps,
|
| 111 |
+
chunk_size,
|
| 112 |
+
length,
|
| 113 |
+
)
|
| 114 |
+
steps = 1
|
| 115 |
+
chunk_size = length
|
| 116 |
+
|
| 117 |
+
if steps > 1 and length / steps < chunk_size:
|
| 118 |
+
chunk_size = int(length / steps)
|
| 119 |
+
|
| 120 |
+
is_too_small_sequence: bool = len(sequences) < TOO_SMALL_SEQUENCE
|
| 121 |
+
is_too_large_sequence: bool = len(sequences) >= TOO_BIG_SEQUENCE
|
| 122 |
+
|
| 123 |
+
if is_too_small_sequence:
|
| 124 |
+
logger.log(
|
| 125 |
+
TRACE,
|
| 126 |
+
"Trying to detect encoding from a tiny portion of ({}) byte(s).".format(
|
| 127 |
+
length
|
| 128 |
+
),
|
| 129 |
+
)
|
| 130 |
+
elif is_too_large_sequence:
|
| 131 |
+
logger.log(
|
| 132 |
+
TRACE,
|
| 133 |
+
"Using lazy str decoding because the payload is quite large, ({}) byte(s).".format(
|
| 134 |
+
length
|
| 135 |
+
),
|
| 136 |
+
)
|
| 137 |
+
|
| 138 |
+
prioritized_encodings: list[str] = []
|
| 139 |
+
|
| 140 |
+
specified_encoding: str | None = (
|
| 141 |
+
any_specified_encoding(sequences) if preemptive_behaviour else None
|
| 142 |
+
)
|
| 143 |
+
|
| 144 |
+
if specified_encoding is not None:
|
| 145 |
+
prioritized_encodings.append(specified_encoding)
|
| 146 |
+
logger.log(
|
| 147 |
+
TRACE,
|
| 148 |
+
"Detected declarative mark in sequence. Priority +1 given for %s.",
|
| 149 |
+
specified_encoding,
|
| 150 |
+
)
|
| 151 |
+
|
| 152 |
+
tested: set[str] = set()
|
| 153 |
+
tested_but_hard_failure: list[str] = []
|
| 154 |
+
tested_but_soft_failure: list[str] = []
|
| 155 |
+
|
| 156 |
+
fallback_ascii: CharsetMatch | None = None
|
| 157 |
+
fallback_u8: CharsetMatch | None = None
|
| 158 |
+
fallback_specified: CharsetMatch | None = None
|
| 159 |
+
|
| 160 |
+
results: CharsetMatches = CharsetMatches()
|
| 161 |
+
|
| 162 |
+
early_stop_results: CharsetMatches = CharsetMatches()
|
| 163 |
+
|
| 164 |
+
sig_encoding, sig_payload = identify_sig_or_bom(sequences)
|
| 165 |
+
|
| 166 |
+
if sig_encoding is not None:
|
| 167 |
+
prioritized_encodings.append(sig_encoding)
|
| 168 |
+
logger.log(
|
| 169 |
+
TRACE,
|
| 170 |
+
"Detected a SIG or BOM mark on first %i byte(s). Priority +1 given for %s.",
|
| 171 |
+
len(sig_payload),
|
| 172 |
+
sig_encoding,
|
| 173 |
+
)
|
| 174 |
+
|
| 175 |
+
prioritized_encodings.append("ascii")
|
| 176 |
+
|
| 177 |
+
if "utf_8" not in prioritized_encodings:
|
| 178 |
+
prioritized_encodings.append("utf_8")
|
| 179 |
+
|
| 180 |
+
for encoding_iana in prioritized_encodings + IANA_SUPPORTED:
|
| 181 |
+
if cp_isolation and encoding_iana not in cp_isolation:
|
| 182 |
+
continue
|
| 183 |
+
|
| 184 |
+
if cp_exclusion and encoding_iana in cp_exclusion:
|
| 185 |
+
continue
|
| 186 |
+
|
| 187 |
+
if encoding_iana in tested:
|
| 188 |
+
continue
|
| 189 |
+
|
| 190 |
+
tested.add(encoding_iana)
|
| 191 |
+
|
| 192 |
+
decoded_payload: str | None = None
|
| 193 |
+
bom_or_sig_available: bool = sig_encoding == encoding_iana
|
| 194 |
+
strip_sig_or_bom: bool = bom_or_sig_available and should_strip_sig_or_bom(
|
| 195 |
+
encoding_iana
|
| 196 |
+
)
|
| 197 |
+
|
| 198 |
+
if encoding_iana in {"utf_16", "utf_32"} and not bom_or_sig_available:
|
| 199 |
+
logger.log(
|
| 200 |
+
TRACE,
|
| 201 |
+
"Encoding %s won't be tested as-is because it require a BOM. Will try some sub-encoder LE/BE.",
|
| 202 |
+
encoding_iana,
|
| 203 |
+
)
|
| 204 |
+
continue
|
| 205 |
+
if encoding_iana in {"utf_7"} and not bom_or_sig_available:
|
| 206 |
+
logger.log(
|
| 207 |
+
TRACE,
|
| 208 |
+
"Encoding %s won't be tested as-is because detection is unreliable without BOM/SIG.",
|
| 209 |
+
encoding_iana,
|
| 210 |
+
)
|
| 211 |
+
continue
|
| 212 |
+
|
| 213 |
+
try:
|
| 214 |
+
is_multi_byte_decoder: bool = is_multi_byte_encoding(encoding_iana)
|
| 215 |
+
except (ModuleNotFoundError, ImportError):
|
| 216 |
+
logger.log(
|
| 217 |
+
TRACE,
|
| 218 |
+
"Encoding %s does not provide an IncrementalDecoder",
|
| 219 |
+
encoding_iana,
|
| 220 |
+
)
|
| 221 |
+
continue
|
| 222 |
+
|
| 223 |
+
try:
|
| 224 |
+
if is_too_large_sequence and is_multi_byte_decoder is False:
|
| 225 |
+
str(
|
| 226 |
+
(
|
| 227 |
+
sequences[: int(50e4)]
|
| 228 |
+
if strip_sig_or_bom is False
|
| 229 |
+
else sequences[len(sig_payload) : int(50e4)]
|
| 230 |
+
),
|
| 231 |
+
encoding=encoding_iana,
|
| 232 |
+
)
|
| 233 |
+
else:
|
| 234 |
+
decoded_payload = str(
|
| 235 |
+
(
|
| 236 |
+
sequences
|
| 237 |
+
if strip_sig_or_bom is False
|
| 238 |
+
else sequences[len(sig_payload) :]
|
| 239 |
+
),
|
| 240 |
+
encoding=encoding_iana,
|
| 241 |
+
)
|
| 242 |
+
except (UnicodeDecodeError, LookupError) as e:
|
| 243 |
+
if not isinstance(e, LookupError):
|
| 244 |
+
logger.log(
|
| 245 |
+
TRACE,
|
| 246 |
+
"Code page %s does not fit given bytes sequence at ALL. %s",
|
| 247 |
+
encoding_iana,
|
| 248 |
+
str(e),
|
| 249 |
+
)
|
| 250 |
+
tested_but_hard_failure.append(encoding_iana)
|
| 251 |
+
continue
|
| 252 |
+
|
| 253 |
+
similar_soft_failure_test: bool = False
|
| 254 |
+
|
| 255 |
+
for encoding_soft_failed in tested_but_soft_failure:
|
| 256 |
+
if is_cp_similar(encoding_iana, encoding_soft_failed):
|
| 257 |
+
similar_soft_failure_test = True
|
| 258 |
+
break
|
| 259 |
+
|
| 260 |
+
if similar_soft_failure_test:
|
| 261 |
+
logger.log(
|
| 262 |
+
TRACE,
|
| 263 |
+
"%s is deemed too similar to code page %s and was consider unsuited already. Continuing!",
|
| 264 |
+
encoding_iana,
|
| 265 |
+
encoding_soft_failed,
|
| 266 |
+
)
|
| 267 |
+
continue
|
| 268 |
+
|
| 269 |
+
r_ = range(
|
| 270 |
+
0 if not bom_or_sig_available else len(sig_payload),
|
| 271 |
+
length,
|
| 272 |
+
int(length / steps),
|
| 273 |
+
)
|
| 274 |
+
|
| 275 |
+
multi_byte_bonus: bool = (
|
| 276 |
+
is_multi_byte_decoder
|
| 277 |
+
and decoded_payload is not None
|
| 278 |
+
and len(decoded_payload) < length
|
| 279 |
+
)
|
| 280 |
+
|
| 281 |
+
if multi_byte_bonus:
|
| 282 |
+
logger.log(
|
| 283 |
+
TRACE,
|
| 284 |
+
"Code page %s is a multi byte encoding table and it appear that at least one character "
|
| 285 |
+
"was encoded using n-bytes.",
|
| 286 |
+
encoding_iana,
|
| 287 |
+
)
|
| 288 |
+
|
| 289 |
+
max_chunk_gave_up: int = int(len(r_) / 4)
|
| 290 |
+
|
| 291 |
+
max_chunk_gave_up = max(max_chunk_gave_up, 2)
|
| 292 |
+
early_stop_count: int = 0
|
| 293 |
+
lazy_str_hard_failure = False
|
| 294 |
+
|
| 295 |
+
md_chunks: list[str] = []
|
| 296 |
+
md_ratios = []
|
| 297 |
+
|
| 298 |
+
try:
|
| 299 |
+
for chunk in cut_sequence_chunks(
|
| 300 |
+
sequences,
|
| 301 |
+
encoding_iana,
|
| 302 |
+
r_,
|
| 303 |
+
chunk_size,
|
| 304 |
+
bom_or_sig_available,
|
| 305 |
+
strip_sig_or_bom,
|
| 306 |
+
sig_payload,
|
| 307 |
+
is_multi_byte_decoder,
|
| 308 |
+
decoded_payload,
|
| 309 |
+
):
|
| 310 |
+
md_chunks.append(chunk)
|
| 311 |
+
|
| 312 |
+
md_ratios.append(
|
| 313 |
+
mess_ratio(
|
| 314 |
+
chunk,
|
| 315 |
+
threshold,
|
| 316 |
+
explain is True and 1 <= len(cp_isolation) <= 2,
|
| 317 |
+
)
|
| 318 |
+
)
|
| 319 |
+
|
| 320 |
+
if md_ratios[-1] >= threshold:
|
| 321 |
+
early_stop_count += 1
|
| 322 |
+
|
| 323 |
+
if (early_stop_count >= max_chunk_gave_up) or (
|
| 324 |
+
bom_or_sig_available and strip_sig_or_bom is False
|
| 325 |
+
):
|
| 326 |
+
break
|
| 327 |
+
except (
|
| 328 |
+
UnicodeDecodeError
|
| 329 |
+
) as e: # Lazy str loading may have missed something there
|
| 330 |
+
logger.log(
|
| 331 |
+
TRACE,
|
| 332 |
+
"LazyStr Loading: After MD chunk decode, code page %s does not fit given bytes sequence at ALL. %s",
|
| 333 |
+
encoding_iana,
|
| 334 |
+
str(e),
|
| 335 |
+
)
|
| 336 |
+
early_stop_count = max_chunk_gave_up
|
| 337 |
+
lazy_str_hard_failure = True
|
| 338 |
+
|
| 339 |
+
# We might want to check the sequence again with the whole content
|
| 340 |
+
# Only if initial MD tests passes
|
| 341 |
+
if (
|
| 342 |
+
not lazy_str_hard_failure
|
| 343 |
+
and is_too_large_sequence
|
| 344 |
+
and not is_multi_byte_decoder
|
| 345 |
+
):
|
| 346 |
+
try:
|
| 347 |
+
sequences[int(50e3) :].decode(encoding_iana, errors="strict")
|
| 348 |
+
except UnicodeDecodeError as e:
|
| 349 |
+
logger.log(
|
| 350 |
+
TRACE,
|
| 351 |
+
"LazyStr Loading: After final lookup, code page %s does not fit given bytes sequence at ALL. %s",
|
| 352 |
+
encoding_iana,
|
| 353 |
+
str(e),
|
| 354 |
+
)
|
| 355 |
+
tested_but_hard_failure.append(encoding_iana)
|
| 356 |
+
continue
|
| 357 |
+
|
| 358 |
+
mean_mess_ratio: float = sum(md_ratios) / len(md_ratios) if md_ratios else 0.0
|
| 359 |
+
if mean_mess_ratio >= threshold or early_stop_count >= max_chunk_gave_up:
|
| 360 |
+
tested_but_soft_failure.append(encoding_iana)
|
| 361 |
+
logger.log(
|
| 362 |
+
TRACE,
|
| 363 |
+
"%s was excluded because of initial chaos probing. Gave up %i time(s). "
|
| 364 |
+
"Computed mean chaos is %f %%.",
|
| 365 |
+
encoding_iana,
|
| 366 |
+
early_stop_count,
|
| 367 |
+
round(mean_mess_ratio * 100, ndigits=3),
|
| 368 |
+
)
|
| 369 |
+
# Preparing those fallbacks in case we got nothing.
|
| 370 |
+
if (
|
| 371 |
+
enable_fallback
|
| 372 |
+
and encoding_iana
|
| 373 |
+
in ["ascii", "utf_8", specified_encoding, "utf_16", "utf_32"]
|
| 374 |
+
and not lazy_str_hard_failure
|
| 375 |
+
):
|
| 376 |
+
fallback_entry = CharsetMatch(
|
| 377 |
+
sequences,
|
| 378 |
+
encoding_iana,
|
| 379 |
+
threshold,
|
| 380 |
+
bom_or_sig_available,
|
| 381 |
+
[],
|
| 382 |
+
decoded_payload,
|
| 383 |
+
preemptive_declaration=specified_encoding,
|
| 384 |
+
)
|
| 385 |
+
if encoding_iana == specified_encoding:
|
| 386 |
+
fallback_specified = fallback_entry
|
| 387 |
+
elif encoding_iana == "ascii":
|
| 388 |
+
fallback_ascii = fallback_entry
|
| 389 |
+
else:
|
| 390 |
+
fallback_u8 = fallback_entry
|
| 391 |
+
continue
|
| 392 |
+
|
| 393 |
+
logger.log(
|
| 394 |
+
TRACE,
|
| 395 |
+
"%s passed initial chaos probing. Mean measured chaos is %f %%",
|
| 396 |
+
encoding_iana,
|
| 397 |
+
round(mean_mess_ratio * 100, ndigits=3),
|
| 398 |
+
)
|
| 399 |
+
|
| 400 |
+
if not is_multi_byte_decoder:
|
| 401 |
+
target_languages: list[str] = encoding_languages(encoding_iana)
|
| 402 |
+
else:
|
| 403 |
+
target_languages = mb_encoding_languages(encoding_iana)
|
| 404 |
+
|
| 405 |
+
if target_languages:
|
| 406 |
+
logger.log(
|
| 407 |
+
TRACE,
|
| 408 |
+
"{} should target any language(s) of {}".format(
|
| 409 |
+
encoding_iana, str(target_languages)
|
| 410 |
+
),
|
| 411 |
+
)
|
| 412 |
+
|
| 413 |
+
cd_ratios = []
|
| 414 |
+
|
| 415 |
+
# We shall skip the CD when its about ASCII
|
| 416 |
+
# Most of the time its not relevant to run "language-detection" on it.
|
| 417 |
+
if encoding_iana != "ascii":
|
| 418 |
+
for chunk in md_chunks:
|
| 419 |
+
chunk_languages = coherence_ratio(
|
| 420 |
+
chunk,
|
| 421 |
+
language_threshold,
|
| 422 |
+
",".join(target_languages) if target_languages else None,
|
| 423 |
+
)
|
| 424 |
+
|
| 425 |
+
cd_ratios.append(chunk_languages)
|
| 426 |
+
|
| 427 |
+
cd_ratios_merged = merge_coherence_ratios(cd_ratios)
|
| 428 |
+
|
| 429 |
+
if cd_ratios_merged:
|
| 430 |
+
logger.log(
|
| 431 |
+
TRACE,
|
| 432 |
+
"We detected language {} using {}".format(
|
| 433 |
+
cd_ratios_merged, encoding_iana
|
| 434 |
+
),
|
| 435 |
+
)
|
| 436 |
+
|
| 437 |
+
current_match = CharsetMatch(
|
| 438 |
+
sequences,
|
| 439 |
+
encoding_iana,
|
| 440 |
+
mean_mess_ratio,
|
| 441 |
+
bom_or_sig_available,
|
| 442 |
+
cd_ratios_merged,
|
| 443 |
+
(
|
| 444 |
+
decoded_payload
|
| 445 |
+
if (
|
| 446 |
+
is_too_large_sequence is False
|
| 447 |
+
or encoding_iana in [specified_encoding, "ascii", "utf_8"]
|
| 448 |
+
)
|
| 449 |
+
else None
|
| 450 |
+
),
|
| 451 |
+
preemptive_declaration=specified_encoding,
|
| 452 |
+
)
|
| 453 |
+
|
| 454 |
+
results.append(current_match)
|
| 455 |
+
|
| 456 |
+
if (
|
| 457 |
+
encoding_iana in [specified_encoding, "ascii", "utf_8"]
|
| 458 |
+
and mean_mess_ratio < 0.1
|
| 459 |
+
):
|
| 460 |
+
# If md says nothing to worry about, then... stop immediately!
|
| 461 |
+
if mean_mess_ratio == 0.0:
|
| 462 |
+
logger.debug(
|
| 463 |
+
"Encoding detection: %s is most likely the one.",
|
| 464 |
+
current_match.encoding,
|
| 465 |
+
)
|
| 466 |
+
if explain: # Defensive: ensure exit path clean handler
|
| 467 |
+
logger.removeHandler(explain_handler)
|
| 468 |
+
logger.setLevel(previous_logger_level)
|
| 469 |
+
return CharsetMatches([current_match])
|
| 470 |
+
|
| 471 |
+
early_stop_results.append(current_match)
|
| 472 |
+
|
| 473 |
+
if (
|
| 474 |
+
len(early_stop_results)
|
| 475 |
+
and (specified_encoding is None or specified_encoding in tested)
|
| 476 |
+
and "ascii" in tested
|
| 477 |
+
and "utf_8" in tested
|
| 478 |
+
):
|
| 479 |
+
probable_result: CharsetMatch = early_stop_results.best() # type: ignore[assignment]
|
| 480 |
+
logger.debug(
|
| 481 |
+
"Encoding detection: %s is most likely the one.",
|
| 482 |
+
probable_result.encoding,
|
| 483 |
+
)
|
| 484 |
+
if explain: # Defensive: ensure exit path clean handler
|
| 485 |
+
logger.removeHandler(explain_handler)
|
| 486 |
+
logger.setLevel(previous_logger_level)
|
| 487 |
+
|
| 488 |
+
return CharsetMatches([probable_result])
|
| 489 |
+
|
| 490 |
+
if encoding_iana == sig_encoding:
|
| 491 |
+
logger.debug(
|
| 492 |
+
"Encoding detection: %s is most likely the one as we detected a BOM or SIG within "
|
| 493 |
+
"the beginning of the sequence.",
|
| 494 |
+
encoding_iana,
|
| 495 |
+
)
|
| 496 |
+
if explain: # Defensive: ensure exit path clean handler
|
| 497 |
+
logger.removeHandler(explain_handler)
|
| 498 |
+
logger.setLevel(previous_logger_level)
|
| 499 |
+
return CharsetMatches([results[encoding_iana]])
|
| 500 |
+
|
| 501 |
+
if len(results) == 0:
|
| 502 |
+
if fallback_u8 or fallback_ascii or fallback_specified:
|
| 503 |
+
logger.log(
|
| 504 |
+
TRACE,
|
| 505 |
+
"Nothing got out of the detection process. Using ASCII/UTF-8/Specified fallback.",
|
| 506 |
+
)
|
| 507 |
+
|
| 508 |
+
if fallback_specified:
|
| 509 |
+
logger.debug(
|
| 510 |
+
"Encoding detection: %s will be used as a fallback match",
|
| 511 |
+
fallback_specified.encoding,
|
| 512 |
+
)
|
| 513 |
+
results.append(fallback_specified)
|
| 514 |
+
elif (
|
| 515 |
+
(fallback_u8 and fallback_ascii is None)
|
| 516 |
+
or (
|
| 517 |
+
fallback_u8
|
| 518 |
+
and fallback_ascii
|
| 519 |
+
and fallback_u8.fingerprint != fallback_ascii.fingerprint
|
| 520 |
+
)
|
| 521 |
+
or (fallback_u8 is not None)
|
| 522 |
+
):
|
| 523 |
+
logger.debug("Encoding detection: utf_8 will be used as a fallback match")
|
| 524 |
+
results.append(fallback_u8)
|
| 525 |
+
elif fallback_ascii:
|
| 526 |
+
logger.debug("Encoding detection: ascii will be used as a fallback match")
|
| 527 |
+
results.append(fallback_ascii)
|
| 528 |
+
|
| 529 |
+
if results:
|
| 530 |
+
logger.debug(
|
| 531 |
+
"Encoding detection: Found %s as plausible (best-candidate) for content. With %i alternatives.",
|
| 532 |
+
results.best().encoding, # type: ignore
|
| 533 |
+
len(results) - 1,
|
| 534 |
+
)
|
| 535 |
+
else:
|
| 536 |
+
logger.debug("Encoding detection: Unable to determine any suitable charset.")
|
| 537 |
+
|
| 538 |
+
if explain:
|
| 539 |
+
logger.removeHandler(explain_handler)
|
| 540 |
+
logger.setLevel(previous_logger_level)
|
| 541 |
+
|
| 542 |
+
return results
|
| 543 |
+
|
| 544 |
+
|
| 545 |
+
def from_fp(
|
| 546 |
+
fp: BinaryIO,
|
| 547 |
+
steps: int = 5,
|
| 548 |
+
chunk_size: int = 512,
|
| 549 |
+
threshold: float = 0.20,
|
| 550 |
+
cp_isolation: list[str] | None = None,
|
| 551 |
+
cp_exclusion: list[str] | None = None,
|
| 552 |
+
preemptive_behaviour: bool = True,
|
| 553 |
+
explain: bool = False,
|
| 554 |
+
language_threshold: float = 0.1,
|
| 555 |
+
enable_fallback: bool = True,
|
| 556 |
+
) -> CharsetMatches:
|
| 557 |
+
"""
|
| 558 |
+
Same thing than the function from_bytes but using a file pointer that is already ready.
|
| 559 |
+
Will not close the file pointer.
|
| 560 |
+
"""
|
| 561 |
+
return from_bytes(
|
| 562 |
+
fp.read(),
|
| 563 |
+
steps,
|
| 564 |
+
chunk_size,
|
| 565 |
+
threshold,
|
| 566 |
+
cp_isolation,
|
| 567 |
+
cp_exclusion,
|
| 568 |
+
preemptive_behaviour,
|
| 569 |
+
explain,
|
| 570 |
+
language_threshold,
|
| 571 |
+
enable_fallback,
|
| 572 |
+
)
|
| 573 |
+
|
| 574 |
+
|
| 575 |
+
def from_path(
|
| 576 |
+
path: str | bytes | PathLike, # type: ignore[type-arg]
|
| 577 |
+
steps: int = 5,
|
| 578 |
+
chunk_size: int = 512,
|
| 579 |
+
threshold: float = 0.20,
|
| 580 |
+
cp_isolation: list[str] | None = None,
|
| 581 |
+
cp_exclusion: list[str] | None = None,
|
| 582 |
+
preemptive_behaviour: bool = True,
|
| 583 |
+
explain: bool = False,
|
| 584 |
+
language_threshold: float = 0.1,
|
| 585 |
+
enable_fallback: bool = True,
|
| 586 |
+
) -> CharsetMatches:
|
| 587 |
+
"""
|
| 588 |
+
Same thing than the function from_bytes but with one extra step. Opening and reading given file path in binary mode.
|
| 589 |
+
Can raise IOError.
|
| 590 |
+
"""
|
| 591 |
+
with open(path, "rb") as fp:
|
| 592 |
+
return from_fp(
|
| 593 |
+
fp,
|
| 594 |
+
steps,
|
| 595 |
+
chunk_size,
|
| 596 |
+
threshold,
|
| 597 |
+
cp_isolation,
|
| 598 |
+
cp_exclusion,
|
| 599 |
+
preemptive_behaviour,
|
| 600 |
+
explain,
|
| 601 |
+
language_threshold,
|
| 602 |
+
enable_fallback,
|
| 603 |
+
)
|
| 604 |
+
|
| 605 |
+
|
| 606 |
+
def is_binary(
|
| 607 |
+
fp_or_path_or_payload: PathLike | str | BinaryIO | bytes, # type: ignore[type-arg]
|
| 608 |
+
steps: int = 5,
|
| 609 |
+
chunk_size: int = 512,
|
| 610 |
+
threshold: float = 0.20,
|
| 611 |
+
cp_isolation: list[str] | None = None,
|
| 612 |
+
cp_exclusion: list[str] | None = None,
|
| 613 |
+
preemptive_behaviour: bool = True,
|
| 614 |
+
explain: bool = False,
|
| 615 |
+
language_threshold: float = 0.1,
|
| 616 |
+
enable_fallback: bool = False,
|
| 617 |
+
) -> bool:
|
| 618 |
+
"""
|
| 619 |
+
Detect if the given input (file, bytes, or path) points to a binary file. aka. not a string.
|
| 620 |
+
Based on the same main heuristic algorithms and default kwargs at the sole exception that fallbacks match
|
| 621 |
+
are disabled to be stricter around ASCII-compatible but unlikely to be a string.
|
| 622 |
+
"""
|
| 623 |
+
if isinstance(fp_or_path_or_payload, (str, PathLike)):
|
| 624 |
+
guesses = from_path(
|
| 625 |
+
fp_or_path_or_payload,
|
| 626 |
+
steps=steps,
|
| 627 |
+
chunk_size=chunk_size,
|
| 628 |
+
threshold=threshold,
|
| 629 |
+
cp_isolation=cp_isolation,
|
| 630 |
+
cp_exclusion=cp_exclusion,
|
| 631 |
+
preemptive_behaviour=preemptive_behaviour,
|
| 632 |
+
explain=explain,
|
| 633 |
+
language_threshold=language_threshold,
|
| 634 |
+
enable_fallback=enable_fallback,
|
| 635 |
+
)
|
| 636 |
+
elif isinstance(
|
| 637 |
+
fp_or_path_or_payload,
|
| 638 |
+
(
|
| 639 |
+
bytes,
|
| 640 |
+
bytearray,
|
| 641 |
+
),
|
| 642 |
+
):
|
| 643 |
+
guesses = from_bytes(
|
| 644 |
+
fp_or_path_or_payload,
|
| 645 |
+
steps=steps,
|
| 646 |
+
chunk_size=chunk_size,
|
| 647 |
+
threshold=threshold,
|
| 648 |
+
cp_isolation=cp_isolation,
|
| 649 |
+
cp_exclusion=cp_exclusion,
|
| 650 |
+
preemptive_behaviour=preemptive_behaviour,
|
| 651 |
+
explain=explain,
|
| 652 |
+
language_threshold=language_threshold,
|
| 653 |
+
enable_fallback=enable_fallback,
|
| 654 |
+
)
|
| 655 |
+
else:
|
| 656 |
+
guesses = from_fp(
|
| 657 |
+
fp_or_path_or_payload,
|
| 658 |
+
steps=steps,
|
| 659 |
+
chunk_size=chunk_size,
|
| 660 |
+
threshold=threshold,
|
| 661 |
+
cp_isolation=cp_isolation,
|
| 662 |
+
cp_exclusion=cp_exclusion,
|
| 663 |
+
preemptive_behaviour=preemptive_behaviour,
|
| 664 |
+
explain=explain,
|
| 665 |
+
language_threshold=language_threshold,
|
| 666 |
+
enable_fallback=enable_fallback,
|
| 667 |
+
)
|
| 668 |
+
|
| 669 |
+
return not guesses
|
phivenv/Lib/site-packages/isympy.py
ADDED
|
@@ -0,0 +1,342 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Python shell for SymPy.
|
| 3 |
+
|
| 4 |
+
This is just a normal Python shell (IPython shell if you have the
|
| 5 |
+
IPython package installed), that executes the following commands for
|
| 6 |
+
the user:
|
| 7 |
+
|
| 8 |
+
>>> from __future__ import division
|
| 9 |
+
>>> from sympy import *
|
| 10 |
+
>>> x, y, z, t = symbols('x y z t')
|
| 11 |
+
>>> k, m, n = symbols('k m n', integer=True)
|
| 12 |
+
>>> f, g, h = symbols('f g h', cls=Function)
|
| 13 |
+
>>> init_printing()
|
| 14 |
+
|
| 15 |
+
So starting 'isympy' is equivalent to starting Python (or IPython) and
|
| 16 |
+
executing the above commands by hand. It is intended for easy and quick
|
| 17 |
+
experimentation with SymPy. isympy is a good way to use SymPy as an
|
| 18 |
+
interactive calculator. If you have IPython and Matplotlib installed, then
|
| 19 |
+
interactive plotting is enabled by default.
|
| 20 |
+
|
| 21 |
+
COMMAND LINE OPTIONS
|
| 22 |
+
--------------------
|
| 23 |
+
|
| 24 |
+
-c CONSOLE, --console=CONSOLE
|
| 25 |
+
|
| 26 |
+
Use the specified shell (Python or IPython) shell as the console
|
| 27 |
+
backend instead of the default one (IPython if present, Python
|
| 28 |
+
otherwise), e.g.:
|
| 29 |
+
|
| 30 |
+
$isympy -c python
|
| 31 |
+
|
| 32 |
+
CONSOLE must be one of 'ipython' or 'python'
|
| 33 |
+
|
| 34 |
+
-p PRETTY, --pretty PRETTY
|
| 35 |
+
|
| 36 |
+
Setup pretty-printing in SymPy. When pretty-printing is enabled,
|
| 37 |
+
expressions can be printed with Unicode or ASCII. The default is
|
| 38 |
+
to use pretty-printing (with Unicode if the terminal supports it).
|
| 39 |
+
When this option is 'no', expressions will not be pretty-printed
|
| 40 |
+
and ASCII will be used:
|
| 41 |
+
|
| 42 |
+
$isympy -p no
|
| 43 |
+
|
| 44 |
+
PRETTY must be one of 'unicode', 'ascii', or 'no'
|
| 45 |
+
|
| 46 |
+
-t TYPES, --types=TYPES
|
| 47 |
+
|
| 48 |
+
Setup the ground types for the polys. By default, gmpy ground types
|
| 49 |
+
are used if gmpy2 or gmpy is installed, otherwise it falls back to python
|
| 50 |
+
ground types, which are a little bit slower. You can manually
|
| 51 |
+
choose python ground types even if gmpy is installed (e.g., for
|
| 52 |
+
testing purposes):
|
| 53 |
+
|
| 54 |
+
$isympy -t python
|
| 55 |
+
|
| 56 |
+
TYPES must be one of 'gmpy', 'gmpy1' or 'python'
|
| 57 |
+
|
| 58 |
+
Note that the ground type gmpy1 is primarily intended for testing; it
|
| 59 |
+
forces the use of gmpy version 1 even if gmpy2 is available.
|
| 60 |
+
|
| 61 |
+
This is the same as setting the environment variable
|
| 62 |
+
SYMPY_GROUND_TYPES to the given ground type (e.g.,
|
| 63 |
+
SYMPY_GROUND_TYPES='gmpy')
|
| 64 |
+
|
| 65 |
+
The ground types can be determined interactively from the variable
|
| 66 |
+
sympy.polys.domains.GROUND_TYPES.
|
| 67 |
+
|
| 68 |
+
-o ORDER, --order ORDER
|
| 69 |
+
|
| 70 |
+
Setup the ordering of terms for printing. The default is lex, which
|
| 71 |
+
orders terms lexicographically (e.g., x**2 + x + 1). You can choose
|
| 72 |
+
other orderings, such as rev-lex, which will use reverse
|
| 73 |
+
lexicographic ordering (e.g., 1 + x + x**2):
|
| 74 |
+
|
| 75 |
+
$isympy -o rev-lex
|
| 76 |
+
|
| 77 |
+
ORDER must be one of 'lex', 'rev-lex', 'grlex', 'rev-grlex',
|
| 78 |
+
'grevlex', 'rev-grevlex', 'old', or 'none'.
|
| 79 |
+
|
| 80 |
+
Note that for very large expressions, ORDER='none' may speed up
|
| 81 |
+
printing considerably but the terms will have no canonical order.
|
| 82 |
+
|
| 83 |
+
-q, --quiet
|
| 84 |
+
|
| 85 |
+
Print only Python's and SymPy's versions to stdout at startup.
|
| 86 |
+
|
| 87 |
+
-d, --doctest
|
| 88 |
+
|
| 89 |
+
Use the same format that should be used for doctests. This is
|
| 90 |
+
equivalent to -c python -p no.
|
| 91 |
+
|
| 92 |
+
-C, --no-cache
|
| 93 |
+
|
| 94 |
+
Disable the caching mechanism. Disabling the cache may slow certain
|
| 95 |
+
operations down considerably. This is useful for testing the cache,
|
| 96 |
+
or for benchmarking, as the cache can result in deceptive timings.
|
| 97 |
+
|
| 98 |
+
This is equivalent to setting the environment variable
|
| 99 |
+
SYMPY_USE_CACHE to 'no'.
|
| 100 |
+
|
| 101 |
+
-a, --auto-symbols (requires at least IPython 0.11)
|
| 102 |
+
|
| 103 |
+
Automatically create missing symbols. Normally, typing a name of a
|
| 104 |
+
Symbol that has not been instantiated first would raise NameError,
|
| 105 |
+
but with this option enabled, any undefined name will be
|
| 106 |
+
automatically created as a Symbol.
|
| 107 |
+
|
| 108 |
+
Note that this is intended only for interactive, calculator style
|
| 109 |
+
usage. In a script that uses SymPy, Symbols should be instantiated
|
| 110 |
+
at the top, so that it's clear what they are.
|
| 111 |
+
|
| 112 |
+
This will not override any names that are already defined, which
|
| 113 |
+
includes the single character letters represented by the mnemonic
|
| 114 |
+
QCOSINE (see the "Gotchas and Pitfalls" document in the
|
| 115 |
+
documentation). You can delete existing names by executing "del
|
| 116 |
+
name". If a name is defined, typing "'name' in dir()" will return True.
|
| 117 |
+
|
| 118 |
+
The Symbols that are created using this have default assumptions.
|
| 119 |
+
If you want to place assumptions on symbols, you should create them
|
| 120 |
+
using symbols() or var().
|
| 121 |
+
|
| 122 |
+
Finally, this only works in the top level namespace. So, for
|
| 123 |
+
example, if you define a function in isympy with an undefined
|
| 124 |
+
Symbol, it will not work.
|
| 125 |
+
|
| 126 |
+
See also the -i and -I options.
|
| 127 |
+
|
| 128 |
+
-i, --int-to-Integer (requires at least IPython 0.11)
|
| 129 |
+
|
| 130 |
+
Automatically wrap int literals with Integer. This makes it so that
|
| 131 |
+
things like 1/2 will come out as Rational(1, 2), rather than 0.5. This
|
| 132 |
+
works by preprocessing the source and wrapping all int literals with
|
| 133 |
+
Integer. Note that this will not change the behavior of int literals
|
| 134 |
+
assigned to variables, and it also won't change the behavior of functions
|
| 135 |
+
that return int literals.
|
| 136 |
+
|
| 137 |
+
If you want an int, you can wrap the literal in int(), e.g. int(3)/int(2)
|
| 138 |
+
gives 1.5 (with division imported from __future__).
|
| 139 |
+
|
| 140 |
+
-I, --interactive (requires at least IPython 0.11)
|
| 141 |
+
|
| 142 |
+
This is equivalent to --auto-symbols --int-to-Integer. Future options
|
| 143 |
+
designed for ease of interactive use may be added to this.
|
| 144 |
+
|
| 145 |
+
-D, --debug
|
| 146 |
+
|
| 147 |
+
Enable debugging output. This is the same as setting the
|
| 148 |
+
environment variable SYMPY_DEBUG to 'True'. The debug status is set
|
| 149 |
+
in the variable SYMPY_DEBUG within isympy.
|
| 150 |
+
|
| 151 |
+
-- IPython options
|
| 152 |
+
|
| 153 |
+
Additionally you can pass command line options directly to the IPython
|
| 154 |
+
interpreter (the standard Python shell is not supported). However you
|
| 155 |
+
need to add the '--' separator between two types of options, e.g the
|
| 156 |
+
startup banner option and the colors option. You need to enter the
|
| 157 |
+
options as required by the version of IPython that you are using, too:
|
| 158 |
+
|
| 159 |
+
in IPython 0.11,
|
| 160 |
+
|
| 161 |
+
$isympy -q -- --colors=NoColor
|
| 162 |
+
|
| 163 |
+
or older versions of IPython,
|
| 164 |
+
|
| 165 |
+
$isympy -q -- -colors NoColor
|
| 166 |
+
|
| 167 |
+
See also isympy --help.
|
| 168 |
+
"""
|
| 169 |
+
|
| 170 |
+
import os
|
| 171 |
+
import sys
|
| 172 |
+
|
| 173 |
+
# DO NOT IMPORT SYMPY HERE! Or the setting of the sympy environment variables
|
| 174 |
+
# by the command line will break.
|
| 175 |
+
|
| 176 |
+
def main() -> None:
|
| 177 |
+
from argparse import ArgumentParser, RawDescriptionHelpFormatter
|
| 178 |
+
|
| 179 |
+
VERSION = None
|
| 180 |
+
if '--version' in sys.argv:
|
| 181 |
+
# We cannot import sympy before this is run, because flags like -C and
|
| 182 |
+
# -t set environment variables that must be set before SymPy is
|
| 183 |
+
# imported. The only thing we need to import it for is to get the
|
| 184 |
+
# version, which only matters with the --version flag.
|
| 185 |
+
import sympy
|
| 186 |
+
VERSION = sympy.__version__
|
| 187 |
+
|
| 188 |
+
usage = 'isympy [options] -- [ipython options]'
|
| 189 |
+
parser = ArgumentParser(
|
| 190 |
+
usage=usage,
|
| 191 |
+
description=__doc__,
|
| 192 |
+
formatter_class=RawDescriptionHelpFormatter,
|
| 193 |
+
)
|
| 194 |
+
|
| 195 |
+
parser.add_argument('--version', action='version', version=VERSION)
|
| 196 |
+
|
| 197 |
+
parser.add_argument(
|
| 198 |
+
'-c', '--console',
|
| 199 |
+
dest='console',
|
| 200 |
+
action='store',
|
| 201 |
+
default=None,
|
| 202 |
+
choices=['ipython', 'python'],
|
| 203 |
+
metavar='CONSOLE',
|
| 204 |
+
help='select type of interactive session: ipython | python; defaults '
|
| 205 |
+
'to ipython if IPython is installed, otherwise python')
|
| 206 |
+
|
| 207 |
+
parser.add_argument(
|
| 208 |
+
'-p', '--pretty',
|
| 209 |
+
dest='pretty',
|
| 210 |
+
action='store',
|
| 211 |
+
default=None,
|
| 212 |
+
metavar='PRETTY',
|
| 213 |
+
choices=['unicode', 'ascii', 'no'],
|
| 214 |
+
help='setup pretty printing: unicode | ascii | no; defaults to '
|
| 215 |
+
'unicode printing if the terminal supports it, otherwise ascii')
|
| 216 |
+
|
| 217 |
+
parser.add_argument(
|
| 218 |
+
'-t', '--types',
|
| 219 |
+
dest='types',
|
| 220 |
+
action='store',
|
| 221 |
+
default=None,
|
| 222 |
+
metavar='TYPES',
|
| 223 |
+
choices=['gmpy', 'gmpy1', 'python'],
|
| 224 |
+
help='setup ground types: gmpy | gmpy1 | python; defaults to gmpy if gmpy2 '
|
| 225 |
+
'or gmpy is installed, otherwise python')
|
| 226 |
+
|
| 227 |
+
parser.add_argument(
|
| 228 |
+
'-o', '--order',
|
| 229 |
+
dest='order',
|
| 230 |
+
action='store',
|
| 231 |
+
default=None,
|
| 232 |
+
metavar='ORDER',
|
| 233 |
+
choices=['lex', 'grlex', 'grevlex', 'rev-lex', 'rev-grlex', 'rev-grevlex', 'old', 'none'],
|
| 234 |
+
help='setup ordering of terms: [rev-]lex | [rev-]grlex | [rev-]grevlex | old | none; defaults to lex')
|
| 235 |
+
|
| 236 |
+
parser.add_argument(
|
| 237 |
+
'-q', '--quiet',
|
| 238 |
+
dest='quiet',
|
| 239 |
+
action='store_true',
|
| 240 |
+
default=False,
|
| 241 |
+
help='print only version information at startup')
|
| 242 |
+
|
| 243 |
+
parser.add_argument(
|
| 244 |
+
'-d', '--doctest',
|
| 245 |
+
dest='doctest',
|
| 246 |
+
action='store_true',
|
| 247 |
+
default=False,
|
| 248 |
+
help='use the doctest format for output (you can just copy and paste it)')
|
| 249 |
+
|
| 250 |
+
parser.add_argument(
|
| 251 |
+
'-C', '--no-cache',
|
| 252 |
+
dest='cache',
|
| 253 |
+
action='store_false',
|
| 254 |
+
default=True,
|
| 255 |
+
help='disable caching mechanism')
|
| 256 |
+
|
| 257 |
+
parser.add_argument(
|
| 258 |
+
'-a', '--auto-symbols',
|
| 259 |
+
dest='auto_symbols',
|
| 260 |
+
action='store_true',
|
| 261 |
+
default=False,
|
| 262 |
+
help='automatically construct missing symbols')
|
| 263 |
+
|
| 264 |
+
parser.add_argument(
|
| 265 |
+
'-i', '--int-to-Integer',
|
| 266 |
+
dest='auto_int_to_Integer',
|
| 267 |
+
action='store_true',
|
| 268 |
+
default=False,
|
| 269 |
+
help="automatically wrap int literals with Integer")
|
| 270 |
+
|
| 271 |
+
parser.add_argument(
|
| 272 |
+
'-I', '--interactive',
|
| 273 |
+
dest='interactive',
|
| 274 |
+
action='store_true',
|
| 275 |
+
default=False,
|
| 276 |
+
help="equivalent to -a -i")
|
| 277 |
+
|
| 278 |
+
parser.add_argument(
|
| 279 |
+
'-D', '--debug',
|
| 280 |
+
dest='debug',
|
| 281 |
+
action='store_true',
|
| 282 |
+
default=False,
|
| 283 |
+
help='enable debugging output')
|
| 284 |
+
|
| 285 |
+
(options, ipy_args) = parser.parse_known_args()
|
| 286 |
+
if '--' in ipy_args:
|
| 287 |
+
ipy_args.remove('--')
|
| 288 |
+
|
| 289 |
+
if not options.cache:
|
| 290 |
+
os.environ['SYMPY_USE_CACHE'] = 'no'
|
| 291 |
+
|
| 292 |
+
if options.types:
|
| 293 |
+
os.environ['SYMPY_GROUND_TYPES'] = options.types
|
| 294 |
+
|
| 295 |
+
if options.debug:
|
| 296 |
+
os.environ['SYMPY_DEBUG'] = str(options.debug)
|
| 297 |
+
|
| 298 |
+
if options.doctest:
|
| 299 |
+
options.pretty = 'no'
|
| 300 |
+
options.console = 'python'
|
| 301 |
+
|
| 302 |
+
session = options.console
|
| 303 |
+
|
| 304 |
+
if session is not None:
|
| 305 |
+
ipython = session == 'ipython'
|
| 306 |
+
else:
|
| 307 |
+
try:
|
| 308 |
+
import IPython # noqa: F401
|
| 309 |
+
ipython = True
|
| 310 |
+
except ImportError:
|
| 311 |
+
if not options.quiet:
|
| 312 |
+
from sympy.interactive.session import no_ipython
|
| 313 |
+
print(no_ipython)
|
| 314 |
+
ipython = False
|
| 315 |
+
|
| 316 |
+
args = {
|
| 317 |
+
'pretty_print': True,
|
| 318 |
+
'use_unicode': None,
|
| 319 |
+
'use_latex': None,
|
| 320 |
+
'order': None,
|
| 321 |
+
'argv': ipy_args,
|
| 322 |
+
}
|
| 323 |
+
|
| 324 |
+
if options.pretty == 'unicode':
|
| 325 |
+
args['use_unicode'] = True
|
| 326 |
+
elif options.pretty == 'ascii':
|
| 327 |
+
args['use_unicode'] = False
|
| 328 |
+
elif options.pretty == 'no':
|
| 329 |
+
args['pretty_print'] = False
|
| 330 |
+
|
| 331 |
+
if options.order is not None:
|
| 332 |
+
args['order'] = options.order
|
| 333 |
+
|
| 334 |
+
args['quiet'] = options.quiet
|
| 335 |
+
args['auto_symbols'] = options.auto_symbols or options.interactive
|
| 336 |
+
args['auto_int_to_Integer'] = options.auto_int_to_Integer or options.interactive
|
| 337 |
+
|
| 338 |
+
from sympy.interactive import init_session
|
| 339 |
+
init_session(ipython, **args)
|
| 340 |
+
|
| 341 |
+
if __name__ == "__main__":
|
| 342 |
+
main()
|
phivenv/Lib/site-packages/numpy-2.0.2-cp39-cp39-win_amd64.whl
ADDED
|
File without changes
|
phivenv/Lib/site-packages/typing_extensions.py
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
phivenv/pyvenv.cfg
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
home = C:\Users\aravi\AppData\Local\Programs\Python\Python39
|
| 2 |
+
include-system-site-packages = false
|
| 3 |
+
version = 3.9.13
|
requirements.txt
ADDED
|
File without changes
|
testing_merged_model.py
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 3 |
+
import torch
|
| 4 |
+
import traceback
|
| 5 |
+
|
| 6 |
+
MERGED_MODEL_PATH = "./merged_tinyllama_logger"
|
| 7 |
+
|
| 8 |
+
SAMPLE_LOG = """2023-03-06 15:38:41 ERROR [Worker-11] org.hibernate.exception.ConstraintViolationException at at com.example.CacheManager.land(CacheManager.java:359) at at com.example.ShippingService.discover(CacheManager.java:436) at at com.example.HttpClient.work(DatabaseConnector.java:494) at at com.example.ShippingService.window(OrderModule.java:378) at at com.example.CacheManager.almost(DatabaseConnector.java:326) at at com.example.DatabaseConnector.couple(AuthModule.java:13) at at com.example.PaymentModule.wrong(HttpClient.java:244)."""
|
| 9 |
+
|
| 10 |
+
try:
|
| 11 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 12 |
+
MERGED_MODEL_PATH,
|
| 13 |
+
low_cpu_mem_usage= True,
|
| 14 |
+
return_dict = True,
|
| 15 |
+
torch_dtype = torch.float16,
|
| 16 |
+
device_map = "auto"
|
| 17 |
+
)
|
| 18 |
+
print("AutoModelForCausalLM loaded successfully.")
|
| 19 |
+
print("Loading AutoTokenizer...")
|
| 20 |
+
tokenizer = AutoTokenizer.from_pretrained(MERGED_MODEL_PATH)
|
| 21 |
+
print("AutoTokenizer loaded successfully.")
|
| 22 |
+
except Exception as e:
|
| 23 |
+
print("ERROR LOADING MODEL OR TOKENIZER...CHECK PATH")
|
| 24 |
+
traceback.print_exc()
|
| 25 |
+
|
| 26 |
+
if tokenizer is None:
|
| 27 |
+
print("error loading tokenizer")
|
| 28 |
+
exit(1)
|
| 29 |
+
|
| 30 |
+
if tokenizer.pad_token is None:
|
| 31 |
+
tokenizer.pad_token = tokenizer.eos_token
|
| 32 |
+
tokenizer.padding_side = "left"
|
| 33 |
+
|
| 34 |
+
prompt = SAMPLE_LOG + "\n"
|
| 35 |
+
|
| 36 |
+
inputs = tokenizer(prompt, return_tensors="pt", return_attention_mask=True).to(model.device)
|
| 37 |
+
|
| 38 |
+
with torch.no_grad():
|
| 39 |
+
output_tokens = model.generate(
|
| 40 |
+
**inputs,
|
| 41 |
+
max_new_tokens=60,
|
| 42 |
+
temperature=0.3,
|
| 43 |
+
do_sample=True,
|
| 44 |
+
top_p=0.9,
|
| 45 |
+
top_k=30,
|
| 46 |
+
eos_token_id = tokenizer.eos_token_id,
|
| 47 |
+
pad_token_id = tokenizer.pad_token_id,
|
| 48 |
+
num_return_sequences = 1
|
| 49 |
+
)
|
| 50 |
+
|
| 51 |
+
generated_text = tokenizer.decode(output_tokens[0], skip_special_tokens=True)
|
| 52 |
+
print(f"Generated Text: {generated_text}")
|
| 53 |
+
print("END OF GENERATED TEXT")
|
| 54 |
+
#summary_start_index = generated_text.find(SAMPLE_LOG + "\n")
|
| 55 |
+
|
| 56 |
+
# prompt_end_index = generated_text.rfind(
|
| 57 |
+
summary_start_index = len(SAMPLE_LOG) + 1
|
| 58 |
+
summary = ""
|
| 59 |
+
|
| 60 |
+
if "PM" in generated_text:
|
| 61 |
+
summary_end_index = generated_text.rfind("PM") + len("PM")
|
| 62 |
+
elif "AM" in generated_text:
|
| 63 |
+
summary_end_index = generated_text.rfind("AM") + len("AM")
|
| 64 |
+
|
| 65 |
+
if summary_end_index != -1 and summary_end_index > summary_start_index:
|
| 66 |
+
summary = generated_text[len(SAMPLE_LOG)+1:summary_end_index].strip()
|
| 67 |
+
else:
|
| 68 |
+
prompt_end_index = generated_text.find(SAMPLE_LOG + "\n")
|
| 69 |
+
if prompt_end_index != -1:
|
| 70 |
+
summary = generated_text[prompt_end_index + len(SAMPLE_LOG + "\n"):].strip()
|
| 71 |
+
else:
|
| 72 |
+
summary = generated_text.strip()
|
| 73 |
+
|
| 74 |
+
print(summary)
|
training_phi2.py
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import torch
|
| 2 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig, TrainingArguments
|
| 3 |
+
from transformers import EarlyStoppingCallback
|
| 4 |
+
from peft import LoraConfig
|
| 5 |
+
from trl import SFTTrainer
|
| 6 |
+
from datasets import load_dataset
|
| 7 |
+
import os
|
| 8 |
+
|
| 9 |
+
NAME_OF_MODEL = "./merged_tinyllama_logger"
|
| 10 |
+
DATASET_PATH = "/app/data/log_dataset.jsonl"
|
| 11 |
+
OUTPUT_DIR = "/app/model_output/incremental_1_logs"
|
| 12 |
+
|
| 13 |
+
os.makedirs(OUTPUT_DIR, exist_ok=True)
|
| 14 |
+
|
| 15 |
+
#QUANTIZATION CONFIGURATION:
|
| 16 |
+
bnb_config = BitsAndBytesConfig(
|
| 17 |
+
load_in_4bit = True,
|
| 18 |
+
bnb_4bit_quant_type = "nf4",
|
| 19 |
+
bnb_4bit_compute_dtype = torch.float16,
|
| 20 |
+
bnb_4bit_use_double_quant=True
|
| 21 |
+
)
|
| 22 |
+
|
| 23 |
+
lora_config = LoraConfig(
|
| 24 |
+
r=32,
|
| 25 |
+
lora_alpha=124,
|
| 26 |
+
bias="none",
|
| 27 |
+
lora_dropout=0.15,
|
| 28 |
+
task_type="CAUSAL_LM"
|
| 29 |
+
)
|
| 30 |
+
|
| 31 |
+
training_args = TrainingArguments(
|
| 32 |
+
output_dir = OUTPUT_DIR,
|
| 33 |
+
per_device_train_batch_size=4,
|
| 34 |
+
gradient_accumulation_steps=16,
|
| 35 |
+
learning_rate=1e-4,
|
| 36 |
+
weight_decay=0.001,
|
| 37 |
+
bf16=False,
|
| 38 |
+
max_grad_norm=0.3,
|
| 39 |
+
max_steps=-1,
|
| 40 |
+
warmup_ratio=0.03,
|
| 41 |
+
group_by_length=True,
|
| 42 |
+
lr_scheduler_type="cosine",
|
| 43 |
+
num_train_epochs=4,
|
| 44 |
+
logging_steps=10,
|
| 45 |
+
save_steps=25,
|
| 46 |
+
fp16=True,
|
| 47 |
+
optim="paged_adamw_8bit",
|
| 48 |
+
report_to=["tensorboard"],
|
| 49 |
+
eval_strategy="steps",
|
| 50 |
+
eval_steps=25,
|
| 51 |
+
load_best_model_at_end=True,
|
| 52 |
+
metric_for_best_model="eval_loss",
|
| 53 |
+
greater_is_better=False
|
| 54 |
+
)
|
| 55 |
+
|
| 56 |
+
try:
|
| 57 |
+
dataset = load_dataset("json", data_files=DATASET_PATH)
|
| 58 |
+
split_dataset = dataset["train"].train_test_split(test_size=0.1, seed=42)
|
| 59 |
+
train_dataset = split_dataset["train"]
|
| 60 |
+
eval_dataset = split_dataset["test"]
|
| 61 |
+
except Exception as e:
|
| 62 |
+
print(f"error loading dataset from {DATASET_PATH}: {e}")
|
| 63 |
+
exit(1)
|
| 64 |
+
|
| 65 |
+
print("Loading model with Quantization")
|
| 66 |
+
|
| 67 |
+
try:
|
| 68 |
+
model=AutoModelForCausalLM.from_pretrained(
|
| 69 |
+
NAME_OF_MODEL,
|
| 70 |
+
quantization_config = bnb_config,
|
| 71 |
+
device_map="auto",
|
| 72 |
+
trust_remote_code = True,
|
| 73 |
+
torch_dtype = torch.float16
|
| 74 |
+
)
|
| 75 |
+
model.config.pretraining_p=1
|
| 76 |
+
print("Model loaded successfully")
|
| 77 |
+
except Exception as e:
|
| 78 |
+
print("ERROR LOADING MODEL: {e}")
|
| 79 |
+
exit(1)
|
| 80 |
+
|
| 81 |
+
try:
|
| 82 |
+
tokenizer = AutoTokenizer.from_pretrained(NAME_OF_MODEL, trust_remote_code=True)
|
| 83 |
+
tokenizer.pad_token = tokenizer.eos_token
|
| 84 |
+
tokenizer.padding_side = "right"
|
| 85 |
+
except Exception as e:
|
| 86 |
+
print('ERROR LOADING TOKENIZER: {e}')
|
| 87 |
+
exit(1)
|
| 88 |
+
|
| 89 |
+
trainer=SFTTrainer(
|
| 90 |
+
model=model,
|
| 91 |
+
train_dataset= train_dataset,
|
| 92 |
+
eval_dataset=eval_dataset,
|
| 93 |
+
peft_config = lora_config,
|
| 94 |
+
dataset_text_field="text",
|
| 95 |
+
max_seq_length = 512,
|
| 96 |
+
tokenizer = tokenizer,
|
| 97 |
+
args=training_args,
|
| 98 |
+
packing=False,
|
| 99 |
+
callbacks=[EarlyStoppingCallback(early_stopping_patience=7)]
|
| 100 |
+
)
|
| 101 |
+
|
| 102 |
+
print("training started")
|
| 103 |
+
trainer.train()
|
| 104 |
+
print("fine tuning complete")
|
| 105 |
+
|
| 106 |
+
trainer.save_model(OUTPUT_DIR)
|
| 107 |
+
|
upload_to_hub.py
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from huggingface_hub import HfApi
|
| 2 |
+
|
| 3 |
+
# Your repository name on Hugging Face
|
| 4 |
+
repo_id = "cranky-coder08/Phi2-Fine-Tuning"
|
| 5 |
+
|
| 6 |
+
# The local folder to upload (the current directory, represented by ".")
|
| 7 |
+
local_folder_path = "."
|
| 8 |
+
|
| 9 |
+
# Your Hugging Face access token with "write" permissions
|
| 10 |
+
# Replace with your actual token or leave it blank if you are already logged in
|
| 11 |
+
# token = "hf_..."
|
| 12 |
+
|
| 13 |
+
# Initialize the Hugging Face API client
|
| 14 |
+
api = HfApi()
|
| 15 |
+
|
| 16 |
+
# Upload the entire folder
|
| 17 |
+
print(f"Uploading folder '{local_folder_path}' to '{repo_id}'...")
|
| 18 |
+
api.upload_large_folder(
|
| 19 |
+
folder_path=local_folder_path,
|
| 20 |
+
repo_id=repo_id,
|
| 21 |
+
repo_type="model",
|
| 22 |
+
# Optional: Set a commit message
|
| 23 |
+
#commit_message="Initial upload of fine-tuned Phi2 model."
|
| 24 |
+
)
|
| 25 |
+
|
| 26 |
+
print("Upload complete!")
|