Instructions to use refactai/Refact-1_6-base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use refactai/Refact-1_6-base with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="refactai/Refact-1_6-base", trust_remote_code=True)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("refactai/Refact-1_6-base", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use refactai/Refact-1_6-base with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "refactai/Refact-1_6-base" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "refactai/Refact-1_6-base", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/refactai/Refact-1_6-base
- SGLang
How to use refactai/Refact-1_6-base 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 "refactai/Refact-1_6-base" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "refactai/Refact-1_6-base", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "refactai/Refact-1_6-base" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "refactai/Refact-1_6-base", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use refactai/Refact-1_6-base with Docker Model Runner:
docker model run hf.co/refactai/Refact-1_6-base
Upload GPTRefactForCausalLM
Browse files- configuration_gpt_refact.py +1 -1
- modeling_gpt_refact.py +3 -2
- pytorch_model.bin +1 -1
configuration_gpt_refact.py
CHANGED
|
@@ -32,7 +32,7 @@ class GPTRefactConfig(PretrainedConfig):
|
|
| 32 |
use_cache=True,
|
| 33 |
bos_token_id=-1,
|
| 34 |
eos_token_id=0,
|
| 35 |
-
max_position_embeddings: int =
|
| 36 |
multi_query: bool = True,
|
| 37 |
attention_softmax_in_fp32=False,
|
| 38 |
scale_attention_softmax_in_fp32=False,
|
|
|
|
| 32 |
use_cache=True,
|
| 33 |
bos_token_id=-1,
|
| 34 |
eos_token_id=0,
|
| 35 |
+
max_position_embeddings: int = 4096,
|
| 36 |
multi_query: bool = True,
|
| 37 |
attention_softmax_in_fp32=False,
|
| 38 |
scale_attention_softmax_in_fp32=False,
|
modeling_gpt_refact.py
CHANGED
|
@@ -346,9 +346,10 @@ class GPTRefactModel(GPTRefactPreTrainedModel):
|
|
| 346 |
|
| 347 |
self.h = nn.ModuleList([GPTRefactBlock(config, layer_idx=i) for i in range(config.num_hidden_layers)])
|
| 348 |
|
| 349 |
-
max_positions = config.max_position_embeddings
|
| 350 |
self.register_buffer(
|
| 351 |
-
"bias", torch.tril(torch.ones((max_positions, max_positions), dtype=torch.bool)),
|
|
|
|
| 352 |
)
|
| 353 |
|
| 354 |
self.gradient_checkpointing = False
|
|
|
|
| 346 |
|
| 347 |
self.h = nn.ModuleList([GPTRefactBlock(config, layer_idx=i) for i in range(config.num_hidden_layers)])
|
| 348 |
|
| 349 |
+
self.max_positions = config.max_position_embeddings
|
| 350 |
self.register_buffer(
|
| 351 |
+
"bias", torch.tril(torch.ones((self.max_positions, self.max_positions), dtype=torch.bool)),
|
| 352 |
+
persistent=False
|
| 353 |
)
|
| 354 |
|
| 355 |
self.gradient_checkpointing = False
|
pytorch_model.bin
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 6343461637
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:81388e4a168bb437a7a09af6c8b6c2943990276ee62c2f449cd2bdff257e8860
|
| 3 |
size 6343461637
|