初始化项目,由ModelHub XC社区提供模型

Model: Arjun-G-Ravi/chat-GPT2
Source: Original Platform
This commit is contained in:
ModelHub XC
2026-08-03 13:40:19 +08:00
commit a0a289d11f
21 changed files with 301030 additions and 0 deletions

35
.gitattributes vendored Normal file
View File

@@ -0,0 +1,35 @@
*.7z filter=lfs diff=lfs merge=lfs -text
*.arrow filter=lfs diff=lfs merge=lfs -text
*.bin filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.ckpt filter=lfs diff=lfs merge=lfs -text
*.ftz filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.h5 filter=lfs diff=lfs merge=lfs -text
*.joblib filter=lfs diff=lfs merge=lfs -text
*.lfs.* filter=lfs diff=lfs merge=lfs -text
*.mlmodel filter=lfs diff=lfs merge=lfs -text
*.model filter=lfs diff=lfs merge=lfs -text
*.msgpack filter=lfs diff=lfs merge=lfs -text
*.npy filter=lfs diff=lfs merge=lfs -text
*.npz filter=lfs diff=lfs merge=lfs -text
*.onnx filter=lfs diff=lfs merge=lfs -text
*.ot filter=lfs diff=lfs merge=lfs -text
*.parquet filter=lfs diff=lfs merge=lfs -text
*.pb filter=lfs diff=lfs merge=lfs -text
*.pickle filter=lfs diff=lfs merge=lfs -text
*.pkl filter=lfs diff=lfs merge=lfs -text
*.pt filter=lfs diff=lfs merge=lfs -text
*.pth filter=lfs diff=lfs merge=lfs -text
*.rar filter=lfs diff=lfs merge=lfs -text
*.safetensors filter=lfs diff=lfs merge=lfs -text
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
*.tar.* filter=lfs diff=lfs merge=lfs -text
*.tar filter=lfs diff=lfs merge=lfs -text
*.tflite filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.wasm filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text
*tfevents* filter=lfs diff=lfs merge=lfs -text

View File

@@ -0,0 +1,4 @@
{
"<|pad|>": 50258,
"<|startoftext|>": 50257
}

View File

@@ -0,0 +1,39 @@
{
"_name_or_path": "gpt2",
"activation_function": "gelu_new",
"architectures": [
"GPT2LMHeadModel"
],
"attn_pdrop": 0.1,
"bos_token_id": 50256,
"embd_pdrop": 0.1,
"eos_token_id": 50256,
"initializer_range": 0.02,
"layer_norm_epsilon": 1e-05,
"model_type": "gpt2",
"n_ctx": 1024,
"n_embd": 768,
"n_head": 12,
"n_inner": null,
"n_layer": 12,
"n_positions": 1024,
"reorder_and_upcast_attn": false,
"resid_pdrop": 0.1,
"scale_attn_by_inverse_layer_idx": false,
"scale_attn_weights": true,
"summary_activation": null,
"summary_first_dropout": 0.1,
"summary_proj_to_labels": true,
"summary_type": "cls_index",
"summary_use_proj": true,
"task_specific_params": {
"text-generation": {
"do_sample": true,
"max_length": 50
}
},
"torch_dtype": "float32",
"transformers_version": "4.32.0.dev0",
"use_cache": true,
"vocab_size": 50259
}

View File

@@ -0,0 +1,6 @@
{
"_from_model_config": true,
"bos_token_id": 50256,
"eos_token_id": 50256,
"transformers_version": "4.32.0.dev0"
}

50001
GPT2AlpacaNew-chat/merges.txt Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:806506e07527b80401fcd89346c1161253daefada9108e063ef159c2e352fce6
size 497813341

View File

@@ -0,0 +1,6 @@
{
"bos_token": "<|startoftext|>",
"eos_token": "<|endoftext|>",
"pad_token": "<|pad|>",
"unk_token": "<|endoftext|>"
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,10 @@
{
"add_prefix_space": false,
"bos_token": "<|startoftext|>",
"clean_up_tokenization_spaces": true,
"eos_token": "<|endoftext|>",
"model_max_length": 1024,
"pad_token": "<|pad|>",
"tokenizer_class": "GPT2Tokenizer",
"unk_token": "<|endoftext|>"
}

File diff suppressed because one or more lines are too long

178
README.md Normal file
View File

@@ -0,0 +1,178 @@
---
license: mit
datasets:
- MuskumPillerum/General-Knowledge
language:
- en
metrics:
- accuracy
library_name: transformers
pipeline_tag: text-generation
widget:
- text: >-
Read the question and give an honest answer. Your answers should not include
any unethical, racist, sexist, dangerous, or illegal content. If the
question is wrong, or does not make sense, accept it instead of giving the
wrong answer.\n Question: Who is the king of the jungle? Answer:
example_title: Knowledge - Animal kingdom
- text: >-
Read the question and give an honest answer. Your answers should not include
any unethical, racist, sexist, dangerous, or illegal content. If the
question is wrong, or does not make sense, accept it instead of giving the
wrong answer.\n Question: Who is Kobe Bryant? Answer:
example_title: Knowledge - Sports
- text: >-
Read the question and give an honest answer. Your answers should not include
any unethical, racist, sexist, dangerous, or illegal content. If the
question is wrong, or does not make sense, accept it instead of giving the
wrong answer.\n Question: What is the meaning of life? Answer:
example_title: Philosophy
- text: >-
Read the question and give an honest answer. Your answers should not include
any unethical, racist, sexist, dangerous, or illegal content. If the
question is wrong, or does not make sense, accept it instead of giving the
wrong answer.\n Question: What role of actuators in robotics? Answer:
example_title: Robotics
inference:
parameters:
temperature: 0.7
top_k: 50
top_p: 0.9
max_length: 200
tags:
- chemistry
- biology
- text-generation-inference
base_model:
- openai-community/gpt2
---
# Model Card for Model ID
This is a fine tuned version of OpenAI's GPT2, made to be good at chatting and question-answering. The model seems to be very good for a 124M parameter model in general knowledge.
Intended purpose of the model: To create a powerful, easy to use and reliable model to be run on a consumer level graphics card (or maybe even a CPU).
This model vastly outperforms GPT2 and many other similar parameter models.
#### For more details, visit: https://github.com/Arjun-G-Ravi/chat-GPT-2
### Model Description
```
license: mit
dataset: MuskumPillerum/General-Knowledge
language: en
library_name: transformers
pipeline_tag: text-generation
base_model: gpt2
Finetuned epochs: 50
Finetune loss: 0.06
```
# Comparision with GPT2
GPT2 is a text generation AI and is not meant for question answering purposes. The following comparison is meant to show how good the fine tuned model is, in comparison to the base model.
1. Who is the king of the jungle?
```
GPT2: Who is the king of the jungle? And where is the king?'
'Babe: It is in the hills, called the forest.'
They both said something I hadn't seen before
They say the king is in his
```
```
chat-GPT2: Read the question and give an honest answer. Your answers should not include any unethical, racist, sexist, dangerous, or illegal content. If the question is wrong, or does not make sense, accept it instead of giving the wrong answer.
Question: Who is the king of the jungle?
Answer: Lion is the king of the jungle.
```
2. What is AI?
```
GPT2: What is AI? Can it be done? How does it function? These are all incredibly important questions, and they've been answered in great detail, but if we want to get to what really matters, we can't just assume the answer in order
```
```
chat-GPT2: Read the question and give an honest answer. Your answers should not include any unethical, racist, sexist, dangerous, or illegal content. If the question is wrong, or does not make sense, accept it instead of giving the wrong answer.
Question: What is AI?
Answer: AI is a branch of computer science that focuses on creating intelligent machines that are capable of performing tasks that would typically require human intelligence, such as visual perception, speech recognition, decision-making, and language translation.\n
```
3. What is the difference between acid and a base?
```
GPT2: What is the difference between an acid and a base?
The simplest distinction among these two structures has been between acids and bases. Acid is the water equivalent to a base — the water that enters a bottle, or the acid stored on it, or the base that is added to the glass.
```
```
chat-GPT2: Read the question and give an honest answer. Your answers should not include any unethical, racist, sexist, dangerous, or illegal content. If the question is wrong, or does not make sense, accept it instead of giving the wrong answer.
Question: What is the difference between an acid and a base?
Answer: An acid is a molecule or ion that donates a proton (H+) in a chemical reaction, while a base is a molecule or ion that accepts a proton (H+) in a chemical reaction. Acids have a pH lower than 7, while bases have a pH higher than 7.\n
```
4. Should physicians be allowed to assist terminally ill patients in ending their lives?
```
GPT2: Should physicians be allowed to assist terminally ill patients in ending their lives?
Physician advocates have been asking for change throughout decades since, arguing that dying can be easily stopped by an end of life support or life support protocol. The problem is that many of them do not get the chance to.
```
```
chat-GPT2: Read the question and give an honest answer. Your answers should not include any unethical, racist, sexist, dangerous, or illegal content. If the question is wrong, or does not make sense, accept it instead of giving the wrong answer.
Question: Should physicians be allowed to assist terminally ill patients in ending their lives?
Answer: My answer to this question would be that assisting terminally ill patients in ending their lives raises ethical concerns around autonomy, respect for human life, and the role of physicians in end-of-life care. It is important to ensure that any assistance in ending a patients life is based on a clear and legitimate medical purpose and is subject to rigorous oversight and accountability. Any decision to assist in ending a patients life should be subject to ethical review and should only be carried out in exceptional circumstances where there is no other option for survival.
```
5. Who is known as the greatest boxer of all time?
```
GPT2:Who is known as the greatest boxer of all time?Who is known as the greatest boxer of all time? Awwwwwwww... That's what's funny.
In his time with the New York Times, Mr. Jones had morefightswithhefightthan
```
```
chat-GPT2: Read the question and give an honest answer. Your answers should not include any unethical, racist, sexist, dangerous, or illegal content. If the question is wrong, or does not make sense, accept it instead of giving the wrong answer.
Question: Who is known as the greatest boxer of all time?
Answer: Muhammad Ali is known as the greatest boxer of all time.
```
## Bias, Risks, and Limitations
This model has all the biases, risks and limitations of base gpt2 model. But the prompt template used in this model makes it safer than the traditional GPT2 model.
## Recommendation
The ideal format for inference is:
```
Read the question and give an honest answer. Your answers should not include any unethical, racist, sexist, dangerous, or illegal content. If the question is wrong, or does not make sense, accept it instead of giving the wrong answer.
Question: <Your question>
Answer:
```
Replace 'Your question' with the question of your choice.
The prompt format was inspired from both Alpaca dataset (tatsu-lab/alpaca) and Llama2's (meta-llama/Llama-2-7b-chat-hf) prompt design.
The parameters I used for inference are:
```
top_k=50
top_p=0.9
temperature = 0.7
```
## References used
1. GPT2
@article{radford2019language,
title={Language Models are Unsupervised Multitask Learners},
author={Radford, Alec and Wu, Jeff and Child, Rewon and Luan, David and Amodei, Dario and Sutskever, Ilya},
year={2019}
}
2. MuskumPillerum/General-Knowledge: https://huggingface.co/datasets/MuskumPillerum/General-Knowledge

4
added_tokens.json Normal file
View File

@@ -0,0 +1,4 @@
{
"<|pad|>": 50258,
"<|startoftext|>": 50257
}

39
config.json Normal file
View File

@@ -0,0 +1,39 @@
{
"_name_or_path": "gpt2",
"activation_function": "gelu_new",
"architectures": [
"GPT2LMHeadModel"
],
"attn_pdrop": 0.1,
"bos_token_id": 50256,
"embd_pdrop": 0.1,
"eos_token_id": 50256,
"initializer_range": 0.02,
"layer_norm_epsilon": 1e-05,
"model_type": "gpt2",
"n_ctx": 1024,
"n_embd": 768,
"n_head": 12,
"n_inner": null,
"n_layer": 12,
"n_positions": 1024,
"reorder_and_upcast_attn": false,
"resid_pdrop": 0.1,
"scale_attn_by_inverse_layer_idx": false,
"scale_attn_weights": true,
"summary_activation": null,
"summary_first_dropout": 0.1,
"summary_proj_to_labels": true,
"summary_type": "cls_index",
"summary_use_proj": true,
"task_specific_params": {
"text-generation": {
"do_sample": true,
"max_length": 50
}
},
"torch_dtype": "float32",
"transformers_version": "4.32.0.dev0",
"use_cache": true,
"vocab_size": 50259
}

6
generation_config.json Normal file
View File

@@ -0,0 +1,6 @@
{
"_from_model_config": true,
"bos_token_id": 50256,
"eos_token_id": 50256,
"transformers_version": "4.32.0.dev0"
}

50001
merges.txt Normal file

File diff suppressed because it is too large Load Diff

3
model.safetensors Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:8a3e0266a0e2992d104f69dbef27bcd532466c6c23630d3b399e3bbd70359680
size 497780352

3
pytorch_model.bin Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:217610d8ef517c22f826685b54def199fa435f54a6ae073e71657cddd617b6df
size 497813341

6
special_tokens_map.json Normal file
View File

@@ -0,0 +1,6 @@
{
"bos_token": "<|startoftext|>",
"eos_token": "<|endoftext|>",
"pad_token": "<|pad|>",
"unk_token": "<|endoftext|>"
}

100337
tokenizer.json Normal file

File diff suppressed because it is too large Load Diff

10
tokenizer_config.json Normal file
View File

@@ -0,0 +1,10 @@
{
"add_prefix_space": false,
"bos_token": "<|startoftext|>",
"clean_up_tokenization_spaces": true,
"eos_token": "<|endoftext|>",
"model_max_length": 1024,
"pad_token": "<|pad|>",
"tokenizer_class": "GPT2Tokenizer",
"unk_token": "<|endoftext|>"
}

1
vocab.json Normal file

File diff suppressed because one or more lines are too long