mirror of
https://github.com/NousResearch/atropos.git
synced 2026-04-19 12:57:58 +00:00
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
parent
b8120e8eae
commit
d4589e1107
3 changed files with 69 additions and 59 deletions
|
|
@ -616,13 +616,13 @@ The JSON file contains everything needed to reconstruct tensor references in ano
|
|||
"model": "Qwen/Qwen2.5-3B-Instruct",
|
||||
"tp_degree": 1,
|
||||
"dp_shard_degree": 1,
|
||||
|
||||
|
||||
"param_names": [
|
||||
"model.embed_tokens.weight",
|
||||
"model.layers.0.self_attn.qkv_proj.weight",
|
||||
...
|
||||
],
|
||||
|
||||
|
||||
"param_mappings": {
|
||||
"model.embed_tokens.weight": {
|
||||
"vllm_name": "model.embed_tokens.weight",
|
||||
|
|
@ -632,23 +632,23 @@ The JSON file contains everything needed to reconstruct tensor references in ano
|
|||
},
|
||||
...
|
||||
},
|
||||
|
||||
|
||||
"ipc_handles": {
|
||||
"model.embed_tokens.weight": {
|
||||
"device_index": 0,
|
||||
"ipc_handle_b64": "AmPA0pN...",
|
||||
"ipc_handle_b64": "AmPA0pN...",
|
||||
"storage_size": 623902720,
|
||||
"storage_offset": 0,
|
||||
"ref_counter_handle_b64": "Y2JY...",
|
||||
"ref_counter_offset": 0,
|
||||
"event_handle_b64": "wRIs...",
|
||||
"event_handle_b64": "wRIs...",
|
||||
"event_sync_required": true,
|
||||
"shape": [152064, 2048],
|
||||
"dtype": "torch.bfloat16"
|
||||
},
|
||||
...
|
||||
},
|
||||
|
||||
|
||||
"shared_weights_enabled": true,
|
||||
"single_copy_enabled": true,
|
||||
"num_params": 255
|
||||
|
|
@ -681,15 +681,15 @@ The JSON file contains everything needed to reconstruct tensor references in ano
|
|||
for name, ipc_info in config["ipc_handles"].items():
|
||||
# Decode IPC handle from base64
|
||||
ipc_handle = base64.b64decode(ipc_info["ipc_handle_b64"])
|
||||
|
||||
|
||||
# Reconstruct storage from IPC handle
|
||||
storage = torch.UntypedStorage._new_shared_cuda(
|
||||
device_index, ipc_handle, storage_size, ...
|
||||
)
|
||||
|
||||
|
||||
# Create tensor from shared storage
|
||||
tensor = torch.tensor(storage).view(shape).to(dtype)
|
||||
|
||||
|
||||
# Replace model parameter with shared tensor
|
||||
model.get_parameter(name).data = tensor
|
||||
```
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue