Instructions to use appledora/recast3.2-G16W8H8 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use appledora/recast3.2-G16W8H8 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="appledora/recast3.2-G16W8H8", trust_remote_code=True)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("appledora/recast3.2-G16W8H8", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use appledora/recast3.2-G16W8H8 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "appledora/recast3.2-G16W8H8" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "appledora/recast3.2-G16W8H8", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/appledora/recast3.2-G16W8H8
- SGLang
How to use appledora/recast3.2-G16W8H8 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 "appledora/recast3.2-G16W8H8" \ --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": "appledora/recast3.2-G16W8H8", "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 "appledora/recast3.2-G16W8H8" \ --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": "appledora/recast3.2-G16W8H8", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use appledora/recast3.2-G16W8H8 with Docker Model Runner:
docker model run hf.co/appledora/recast3.2-G16W8H8
Upload configuration_recast_llama.py with huggingface_hub
Browse files
configuration_recast_llama.py
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from transformers import PretrainedConfig
|
| 2 |
+
|
| 3 |
+
|
| 4 |
+
class RECAST1B_llama(PretrainedConfig):
|
| 5 |
+
model_type = "recast1b_llama"
|
| 6 |
+
attribute_map = {
|
| 7 |
+
"hidden_size": "hidden_size",
|
| 8 |
+
"num_attention_heads": "num_attention_heads",
|
| 9 |
+
}
|
| 10 |
+
|
| 11 |
+
def __init__(
|
| 12 |
+
self,
|
| 13 |
+
vocab_size=128256,
|
| 14 |
+
hidden_size=2048,
|
| 15 |
+
intermediate_size=8192,
|
| 16 |
+
num_hidden_layers=16,
|
| 17 |
+
num_attention_heads=32,
|
| 18 |
+
num_key_value_heads=8,
|
| 19 |
+
hidden_act="silu",
|
| 20 |
+
max_position_embeddings=131072,
|
| 21 |
+
initializer_range=0.02,
|
| 22 |
+
rms_norm_eps=1e-5,
|
| 23 |
+
use_cache=True,
|
| 24 |
+
pad_token_id=None,
|
| 25 |
+
bos_token_id=128000,
|
| 26 |
+
eos_token_id=128001,
|
| 27 |
+
pretraining_tp=1,
|
| 28 |
+
tie_word_embeddings=False,
|
| 29 |
+
rope_theta=500000.0,
|
| 30 |
+
rope_scaling={
|
| 31 |
+
"factor": 32.0,
|
| 32 |
+
"low_freq_factor": 1.0,
|
| 33 |
+
"high_freq_factor": 4.0,
|
| 34 |
+
"original_max_position_embeddings": 8192,
|
| 35 |
+
"rope_type": "llama3",
|
| 36 |
+
},
|
| 37 |
+
attention_bias=False,
|
| 38 |
+
attention_dropout=0.0,
|
| 39 |
+
mlp_bias=False,
|
| 40 |
+
# Template-specific configs
|
| 41 |
+
num_templates=2,
|
| 42 |
+
num_groups=8,
|
| 43 |
+
coef_height=4,
|
| 44 |
+
coef_width = 16,
|
| 45 |
+
num_cf=1,
|
| 46 |
+
torch_dtype="bfloat16",
|
| 47 |
+
**kwargs
|
| 48 |
+
):
|
| 49 |
+
self.vocab_size = vocab_size
|
| 50 |
+
self.max_position_embeddings = max_position_embeddings
|
| 51 |
+
self.hidden_size = hidden_size
|
| 52 |
+
self.intermediate_size = intermediate_size
|
| 53 |
+
self.num_hidden_layers = num_hidden_layers
|
| 54 |
+
self.num_attention_heads = num_attention_heads
|
| 55 |
+
self.num_key_value_heads = num_key_value_heads
|
| 56 |
+
self.hidden_act = hidden_act
|
| 57 |
+
self.initializer_range = initializer_range
|
| 58 |
+
self.rms_norm_eps = rms_norm_eps
|
| 59 |
+
self.pretraining_tp = pretraining_tp
|
| 60 |
+
self.use_cache = use_cache
|
| 61 |
+
self.mlp_bias = mlp_bias
|
| 62 |
+
self.attention_bias = attention_bias
|
| 63 |
+
self.attention_dropout = attention_dropout
|
| 64 |
+
self.rope_theta = rope_theta
|
| 65 |
+
self.rope_scaling = rope_scaling
|
| 66 |
+
self.torch_dtype = torch_dtype
|
| 67 |
+
|
| 68 |
+
# Template-specific configs
|
| 69 |
+
self.num_templates = num_templates
|
| 70 |
+
self.num_groups = num_groups
|
| 71 |
+
self.coef_height = coef_height
|
| 72 |
+
self.coef_width = coef_width
|
| 73 |
+
self.num_cf = num_cf
|
| 74 |
+
|
| 75 |
+
super().__init__(
|
| 76 |
+
pad_token_id=pad_token_id,
|
| 77 |
+
bos_token_id=bos_token_id,
|
| 78 |
+
eos_token_id=eos_token_id,
|
| 79 |
+
tie_word_embeddings=tie_word_embeddings,
|
| 80 |
+
**kwargs
|
| 81 |
+
)
|