Text Generation
Transformers
Safetensors
gpt2
trl
orpo
conversational
text-generation-inference
4-bit precision
bitsandbytes
Instructions to use apps90/OrpoGPT2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use apps90/OrpoGPT2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="apps90/OrpoGPT2") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("apps90/OrpoGPT2") model = AutoModelForCausalLM.from_pretrained("apps90/OrpoGPT2") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use apps90/OrpoGPT2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "apps90/OrpoGPT2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "apps90/OrpoGPT2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/apps90/OrpoGPT2
- SGLang
How to use apps90/OrpoGPT2 with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "apps90/OrpoGPT2" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "apps90/OrpoGPT2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "apps90/OrpoGPT2" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "apps90/OrpoGPT2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use apps90/OrpoGPT2 with Docker Model Runner:
docker model run hf.co/apps90/OrpoGPT2
Upload model
Browse files- README.md +3 -1
- config.json +12 -11
- generation_config.json +3 -2
- model.safetensors +2 -2
README.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
| 1 |
---
|
| 2 |
library_name: transformers
|
| 3 |
-
tags:
|
|
|
|
|
|
|
| 4 |
---
|
| 5 |
|
| 6 |
# Model Card for Model ID
|
|
|
|
| 1 |
---
|
| 2 |
library_name: transformers
|
| 3 |
+
tags:
|
| 4 |
+
- trl
|
| 5 |
+
- orpo
|
| 6 |
---
|
| 7 |
|
| 8 |
# Model Card for Model ID
|
config.json
CHANGED
|
@@ -5,9 +5,9 @@
|
|
| 5 |
"GPT2LMHeadModel"
|
| 6 |
],
|
| 7 |
"attn_pdrop": 0.1,
|
| 8 |
-
"bos_token_id":
|
| 9 |
"embd_pdrop": 0.1,
|
| 10 |
-
"eos_token_id":
|
| 11 |
"initializer_range": 0.02,
|
| 12 |
"layer_norm_epsilon": 1e-05,
|
| 13 |
"model_type": "gpt2",
|
|
@@ -17,19 +17,20 @@
|
|
| 17 |
"n_inner": null,
|
| 18 |
"n_layer": 12,
|
| 19 |
"n_positions": 1024,
|
|
|
|
| 20 |
"quantization_config": {
|
| 21 |
-
"_load_in_4bit":
|
| 22 |
-
"_load_in_8bit":
|
| 23 |
-
"bnb_4bit_compute_dtype": "
|
| 24 |
"bnb_4bit_quant_storage": "uint8",
|
| 25 |
-
"bnb_4bit_quant_type": "
|
| 26 |
-
"bnb_4bit_use_double_quant":
|
| 27 |
"llm_int8_enable_fp32_cpu_offload": false,
|
| 28 |
"llm_int8_has_fp16_weight": false,
|
| 29 |
"llm_int8_skip_modules": null,
|
| 30 |
"llm_int8_threshold": 6.0,
|
| 31 |
-
"load_in_4bit":
|
| 32 |
-
"load_in_8bit":
|
| 33 |
"quant_method": "bitsandbytes"
|
| 34 |
},
|
| 35 |
"reorder_and_upcast_attn": false,
|
|
@@ -47,8 +48,8 @@
|
|
| 47 |
"max_length": 50
|
| 48 |
}
|
| 49 |
},
|
| 50 |
-
"torch_dtype": "
|
| 51 |
"transformers_version": "4.41.0",
|
| 52 |
"use_cache": true,
|
| 53 |
-
"vocab_size":
|
| 54 |
}
|
|
|
|
| 5 |
"GPT2LMHeadModel"
|
| 6 |
],
|
| 7 |
"attn_pdrop": 0.1,
|
| 8 |
+
"bos_token_id": 50257,
|
| 9 |
"embd_pdrop": 0.1,
|
| 10 |
+
"eos_token_id": 50258,
|
| 11 |
"initializer_range": 0.02,
|
| 12 |
"layer_norm_epsilon": 1e-05,
|
| 13 |
"model_type": "gpt2",
|
|
|
|
| 17 |
"n_inner": null,
|
| 18 |
"n_layer": 12,
|
| 19 |
"n_positions": 1024,
|
| 20 |
+
"pad_token_id": 50258,
|
| 21 |
"quantization_config": {
|
| 22 |
+
"_load_in_4bit": true,
|
| 23 |
+
"_load_in_8bit": false,
|
| 24 |
+
"bnb_4bit_compute_dtype": "float16",
|
| 25 |
"bnb_4bit_quant_storage": "uint8",
|
| 26 |
+
"bnb_4bit_quant_type": "nf4",
|
| 27 |
+
"bnb_4bit_use_double_quant": true,
|
| 28 |
"llm_int8_enable_fp32_cpu_offload": false,
|
| 29 |
"llm_int8_has_fp16_weight": false,
|
| 30 |
"llm_int8_skip_modules": null,
|
| 31 |
"llm_int8_threshold": 6.0,
|
| 32 |
+
"load_in_4bit": true,
|
| 33 |
+
"load_in_8bit": false,
|
| 34 |
"quant_method": "bitsandbytes"
|
| 35 |
},
|
| 36 |
"reorder_and_upcast_attn": false,
|
|
|
|
| 48 |
"max_length": 50
|
| 49 |
}
|
| 50 |
},
|
| 51 |
+
"torch_dtype": "float32",
|
| 52 |
"transformers_version": "4.41.0",
|
| 53 |
"use_cache": true,
|
| 54 |
+
"vocab_size": 50259
|
| 55 |
}
|
generation_config.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
| 1 |
{
|
| 2 |
"_from_model_config": true,
|
| 3 |
-
"bos_token_id":
|
| 4 |
-
"eos_token_id":
|
|
|
|
| 5 |
"transformers_version": "4.41.0"
|
| 6 |
}
|
|
|
|
| 1 |
{
|
| 2 |
"_from_model_config": true,
|
| 3 |
+
"bos_token_id": 50257,
|
| 4 |
+
"eos_token_id": 50258,
|
| 5 |
+
"pad_token_id": 50258,
|
| 6 |
"transformers_version": "4.41.0"
|
| 7 |
}
|
model.safetensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ad32865291e3569bed247f4a26c7126789296ff4b14bc47e4209e1cd22cb54e4
|
| 3 |
+
size 204307666
|