From 51b0cd2a6ba49117433ec3c84038e455a63e5ba6 Mon Sep 17 00:00:00 2001 From: ModelHub XC Date: Thu, 4 Jun 2026 12:06:12 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=EF=BC=8C=E7=94=B1ModelHub=20XC=E7=A4=BE=E5=8C=BA=E6=8F=90?= =?UTF-8?q?=E4=BE=9B=E6=A8=A1=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Model: togethercomputer/RedPajama-INCITE-Base-3B-v1 Source: Original Platform --- .gitattributes | 50 ++++++++++ README.md | 196 ++++++++++++++++++++++++++++++++++++++++ config.json | 25 +++++ configuration.json | 1 + generation_config.json | 6 ++ pytorch_model.bin | 3 + special_tokens_map.json | 5 + tokenizer.json | 3 + tokenizer_config.json | 9 ++ 9 files changed, 298 insertions(+) create mode 100644 .gitattributes create mode 100644 README.md create mode 100644 config.json create mode 100644 configuration.json create mode 100644 generation_config.json create mode 100644 pytorch_model.bin create mode 100644 special_tokens_map.json create mode 100644 tokenizer.json create mode 100644 tokenizer_config.json diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..5e0f00a --- /dev/null +++ b/.gitattributes @@ -0,0 +1,50 @@ +*.7z filter=lfs diff=lfs merge=lfs -text +*.arrow filter=lfs diff=lfs merge=lfs -text + + +*.bz2 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 + +*.msgpack 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 +*.pt filter=lfs diff=lfs merge=lfs -text +*.pth filter=lfs diff=lfs merge=lfs -text +*.rar filter=lfs diff=lfs merge=lfs -text +saved_model/**/* 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 +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zstandard filter=lfs diff=lfs merge=lfs -text +*.tfevents* filter=lfs diff=lfs merge=lfs -text +*.db* filter=lfs diff=lfs merge=lfs -text +*.ark* filter=lfs diff=lfs merge=lfs -text +**/*ckpt*data* filter=lfs diff=lfs merge=lfs -text +**/*ckpt*.meta filter=lfs diff=lfs merge=lfs -text +**/*ckpt*.index filter=lfs diff=lfs merge=lfs -text +*.safetensors filter=lfs diff=lfs merge=lfs -text +*.ckpt filter=lfs diff=lfs merge=lfs -text +*.gguf* filter=lfs diff=lfs merge=lfs -text +*.ggml filter=lfs diff=lfs merge=lfs -text +*.llamafile* filter=lfs diff=lfs merge=lfs -text +*.pt2 filter=lfs diff=lfs merge=lfs -text +*.mlmodel filter=lfs diff=lfs merge=lfs -text +*.npy filter=lfs diff=lfs merge=lfs -text +*.npz filter=lfs diff=lfs merge=lfs -text +*.pickle filter=lfs diff=lfs merge=lfs -text +*.pkl filter=lfs diff=lfs merge=lfs -text +*.tar filter=lfs diff=lfs merge=lfs -text +*.wasm filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text +*tfevents* filter=lfs diff=lfs merge=lfs -text + +pytorch_model.bin filter=lfs diff=lfs merge=lfs -text +tokenizer.json filter=lfs diff=lfs merge=lfs -text \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..da7fd46 --- /dev/null +++ b/README.md @@ -0,0 +1,196 @@ +--- +license: apache-2.0 +language: +- en +datasets: +- togethercomputer/RedPajama-Data-1T +--- + +# RedPajama-INCITE-Base-3B-v1 + +RedPajama-INCITE-Base-3B-v1 was developed by Together and leaders from the open-source AI community including Ontocord.ai, ETH DS3Lab, AAI CERC, Université de Montréal, MILA - Québec AI Institute, Stanford Center for Research on Foundation Models (CRFM), Stanford Hazy Research research group and LAION. +The training was done on 3,072 V100 GPUs provided as part of the INCITE 2023 project on Scalable Foundation Models for Transferrable Generalist AI, awarded to MILA, LAION, and EleutherAI in fall 2022, with support from the Oak Ridge Leadership Computing Facility (OLCF) and INCITE program. + + - Base Model: [RedPajama-INCITE-Base-3B-v1](https://huggingface.co/togethercomputer/RedPajama-INCITE-Base-3B-v1) + - Instruction-tuned Version: [RedPajama-INCITE-Instruct-3B-v1](https://huggingface.co/togethercomputer/RedPajama-INCITE-Instruct-3B-v1) + - Chat Version: [RedPajama-INCITE-Chat-3B-v1](https://huggingface.co/togethercomputer/RedPajama-INCITE-Chat-3B-v1) + +## Model Details +- **Developed by**: Together Computer. +- **Model type**: Language Model +- **Language(s)**: English +- **License**: Apache 2.0 +- **Model Description**: A 2.8B parameter pretrained language model. + +# Quick Start + +Please note that the model requires `transformers` version >= 4.25.1. + +## GPU Inference + +This requires a GPU with 8GB memory. + +```python +import torch +import transformers +from transformers import AutoTokenizer, AutoModelForCausalLM + +MIN_TRANSFORMERS_VERSION = '4.25.1' + +# check transformers version +assert transformers.__version__ >= MIN_TRANSFORMERS_VERSION, f'Please upgrade transformers to version {MIN_TRANSFORMERS_VERSION} or higher.' + +# init +tokenizer = AutoTokenizer.from_pretrained("togethercomputer/RedPajama-INCITE-Base-3B-v1") +model = AutoModelForCausalLM.from_pretrained("togethercomputer/RedPajama-INCITE-Base-3B-v1", torch_dtype=torch.float16) +model = model.to('cuda:0') + +# infer +prompt = "Alan Turing is" +inputs = tokenizer(prompt, return_tensors='pt').to(model.device) +input_length = inputs.input_ids.shape[1] +outputs = model.generate( + **inputs, max_new_tokens=128, do_sample=True, temperature=0.7, top_p=0.7, top_k=50, return_dict_in_generate=True, +) +token = outputs.sequences[0, input_length:] +output_str = tokenizer.decode(token) +print(output_str) +""" +a name that has been synonymous with the computer age since the 1950s. The British mathematician, logician, and cryptanalyst is widely regarded as the father of modern computing. His contributions to the development of the modern computer and the theory of computation have had a profound impact on the world we live in today. +Turing’s contributions to the development of the modern computer were made in the 1940s and 1950s. He is most famous for his work on the Turing machine, a theoretical model of a computing machine that was able to perform all the mathematical operations of a computer. Turing’s work on the... +""" +``` + +## GPU Inference in Int8 + +To run inference with int8, please ensure you have installed accelerate and bitandbytes. You can install them with the following command: + +```bash +pip install accelerate +pip install bitsandbytes +``` + +Then you can run inference with int8 as follows: + +```python +import torch +import transformers +from transformers import AutoTokenizer, AutoModelForCausalLM + +MIN_TRANSFORMERS_VERSION = '4.25.1' + +# check transformers version +assert transformers.__version__ >= MIN_TRANSFORMERS_VERSION, f'Please upgrade transformers to version {MIN_TRANSFORMERS_VERSION} or higher.' + +# init +tokenizer = AutoTokenizer.from_pretrained("togethercomputer/RedPajama-INCITE-Base-3B-v1") +model = AutoModelForCausalLM.from_pretrained("togethercomputer/RedPajama-INCITE-Base-3B-v1", device_map='auto', torch_dtype=torch.float16, load_in_8bit=True) + +# infer +prompt = "Alan Turing is" +inputs = tokenizer(prompt, return_tensors='pt').to(model.device) +input_length = inputs.input_ids.shape[1] +outputs = model.generate( + **inputs, max_new_tokens=128, do_sample=True, temperature=0.7, top_p=0.7, top_k=50, return_dict_in_generate=True +) +token = outputs.sequences[0, input_length:] +output_str = tokenizer.decode(token) +print(output_str) +""" +the man who cracked the Enigma code during World War II, and who was later convicted of homosexual acts. He was a brilliant mathematician, and a visionary who foresaw the computer age.... +""" +``` + +## CPU Inference + +You can run inference on CPU as follows: + +```python +import torch +import transformers +from transformers import AutoTokenizer, AutoModelForCausalLM + +MIN_TRANSFORMERS_VERSION = '4.25.1' + +# check transformers version +assert transformers.__version__ >= MIN_TRANSFORMERS_VERSION, f'Please upgrade transformers to version {MIN_TRANSFORMERS_VERSION} or higher.' + +# init +tokenizer = AutoTokenizer.from_pretrained("togethercomputer/RedPajama-INCITE-Base-3B-v1") +model = AutoModelForCausalLM.from_pretrained("togethercomputer/RedPajama-INCITE-Base-3B-v1", torch_dtype=torch.bfloat16) +# infer +prompt = "Alan Turing is" +inputs = tokenizer(prompt, return_tensors='pt').to(model.device) +input_length = inputs.input_ids.shape[1] +outputs = model.generate( + **inputs, max_new_tokens=128, do_sample=True, temperature=0.7, top_p=0.7, top_k=50, return_dict_in_generate=True +) +token = outputs.sequences[0, input_length:] +output_str = tokenizer.decode(token) +print(output_str) +""" +a name that is synonymous with the history of computer science. As the man who invented the Turing machine, the mathematical model that defines the limits of what can be computed, Turing is credited with the invention of the modern computer. Turing was also a mathematician and logician, and his work in these fields led to the development of the field of artificial intelligence... +""" +``` + +Please note that since `LayerNormKernelImpl` is not implemented in fp16 for CPU, we use `bfloat16` for CPU inference. + +# Uses + +Excluded uses are described below. + +### Misuse, Malicious Use, and Out-of-Scope Use + +It is the responsibility of the end user to ensure that the model is used in a responsible and ethical manner. + +#### Out-of-Scope Use + +`RedPajama-INCITE-Base-3B-v1` is a language model and may not perform well for other use cases outside of its intended scope. +For example, it may not be suitable for use in safety-critical applications or for making decisions that have a significant impact on individuals or society. +It is important to consider the limitations of the model and to only use it for its intended purpose. + +#### Misuse and Malicious Use + +`RedPajama-INCITE-Base-3B-v1` is designed for language modeling. +Misuse of the model, such as using it to engage in illegal or unethical activities, is strictly prohibited and goes against the principles of the project. + +Using the model to generate content that is cruel to individuals is a misuse of this model. This includes, but is not limited to: + +- Generating fake news, misinformation, or propaganda +- Promoting hate speech, discrimination, or violence against individuals or groups +- Impersonating individuals or organizations without their consent +- Engaging in cyberbullying or harassment +- Defamatory content +- Spamming or scamming +- Sharing confidential or sensitive information without proper authorization +- Violating the terms of use of the model or the data used to train it +- Creating automated bots for malicious purposes such as spreading malware, phishing scams, or spamming + +## Limitations + +`RedPajama-INCITE-Base-3B-v1`, like other language models, has limitations that should be taken into consideration. +For example, the model may not always provide accurate or relevant answers, particularly for questions that are complex, ambiguous, or outside of its training data. +We therefore welcome contributions from individuals and organizations, and encourage collaboration towards creating a more robust and inclusive chatbot. + +## Training + +**Training Data** + +Please refer to [togethercomputer/RedPajama-Data-1T](https://huggingface.co/datasets/togethercomputer/RedPajama-Data-1T) + +**Training Procedure** + +- **Hardware:** 256 nodes of 6xV100 (IBM Power9), on the OLCF Summit cluster +- **Optimizer:** Apex FusedAdam +- **Parallelism:** Pipeline parallel 6, tensor parallel 2 +- **Gradient Accumulations**: 8 (global batch size 4M tokens) +- **Num of Tokens:** 800B Tokens +- **Learning rate:** 0.00016 + +## Benchmark + +Please refer to our [blog post](https://together.xyz) for benchmark results. + +## Community + +Join us on [Together Discord](https://discord.gg/6ZVDU8tTD4) \ No newline at end of file diff --git a/config.json b/config.json new file mode 100644 index 0000000..7cb72eb --- /dev/null +++ b/config.json @@ -0,0 +1,25 @@ +{ + "_name_or_path": "rp_3b_800b", + "architectures": [ + "GPTNeoXForCausalLM" + ], + "bos_token_id": 0, + "eos_token_id": 0, + "hidden_act": "gelu", + "hidden_size": 2560, + "initializer_range": 0.02, + "intermediate_size": 10240, + "layer_norm_eps": 1e-05, + "max_position_embeddings": 2048, + "model_type": "gpt_neox", + "num_attention_heads": 32, + "num_hidden_layers": 32, + "rotary_emb_base": 10000, + "rotary_pct": 1.0, + "tie_word_embeddings": false, + "torch_dtype": "float16", + "transformers_version": "4.28.1", + "use_cache": true, + "use_parallel_residual": false, + "vocab_size": 50432 +} diff --git a/configuration.json b/configuration.json new file mode 100644 index 0000000..bbeeda1 --- /dev/null +++ b/configuration.json @@ -0,0 +1 @@ +{"framework": "pytorch", "task": "text-generation", "allow_remote": true} \ No newline at end of file diff --git a/generation_config.json b/generation_config.json new file mode 100644 index 0000000..344b847 --- /dev/null +++ b/generation_config.json @@ -0,0 +1,6 @@ +{ + "_from_model_config": true, + "bos_token_id": 0, + "eos_token_id": 0, + "transformers_version": "4.28.1" +} diff --git a/pytorch_model.bin b/pytorch_model.bin new file mode 100644 index 0000000..aea35b8 --- /dev/null +++ b/pytorch_model.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:844708c42241de49775b872663ad58422a35b8e5a7d50b1f808408db8c1fb84b +size 5686113497 diff --git a/special_tokens_map.json b/special_tokens_map.json new file mode 100644 index 0000000..0204ed1 --- /dev/null +++ b/special_tokens_map.json @@ -0,0 +1,5 @@ +{ + "bos_token": "<|endoftext|>", + "eos_token": "<|endoftext|>", + "unk_token": "<|endoftext|>" +} diff --git a/tokenizer.json b/tokenizer.json new file mode 100644 index 0000000..79c8a4c --- /dev/null +++ b/tokenizer.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3cf430678137c8491ca82fb7092ee49e44ad38857fffe1e4a4a5ed860139a5b8 +size 2113738 diff --git a/tokenizer_config.json b/tokenizer_config.json new file mode 100644 index 0000000..af28df4 --- /dev/null +++ b/tokenizer_config.json @@ -0,0 +1,9 @@ +{ + "add_prefix_space": false, + "bos_token": "<|endoftext|>", + "clean_up_tokenization_spaces": true, + "eos_token": "<|endoftext|>", + "model_max_length": 2048, + "tokenizer_class": "GPTNeoXTokenizer", + "unk_token": "<|endoftext|>" +}