File size: 24,099 Bytes
721c97d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
{
  "schema": "qfs.upstream-code-audit.v1",
  "upstream": {
    "repository": "moonshotai/Kimi-K2.7-Code",
    "revision": "74797c9c62378b951a1f6fcf5c4631024e9b8bef"
  },
  "executed_during_audit": false,
  "weights_downloaded": false,
  "files": [
    {
      "file": "configuration_deepseek.py",
      "sha256": "c1327c307e2dd11d1bf0adc8bcef69ae51f9617a3a869a9497bb08aec912f931",
      "bytes": 10615,
      "imports": [
        {
          "line": 3,
          "statement": "from transformers.configuration_utils import PretrainedConfig"
        },
        {
          "line": 4,
          "statement": "from transformers.utils import logging"
        }
      ],
      "effect_related_calls": [],
      "top_level_nodes": [
        {
          "line": 6,
          "code": "logger = logging.get_logger(__name__)"
        },
        {
          "line": 8,
          "code": "DEEPSEEK_PRETRAINED_CONFIG_ARCHIVE_MAP = {}"
        }
      ]
    },
    {
      "file": "configuration_kimi_k25.py",
      "sha256": "2bc5487efced291e0e6aa3b24aad1082bade4172aff94ea1b6f0ae20a1d6bb4f",
      "bytes": 5435,
      "imports": [
        {
          "line": 1,
          "statement": "from transformers.configuration_utils import PretrainedConfig"
        },
        {
          "line": 4,
          "statement": "from configuration_deepseek import DeepseekV3Config"
        },
        {
          "line": 6,
          "statement": "from .configuration_deepseek import DeepseekV3Config"
        }
      ],
      "effect_related_calls": [],
      "top_level_nodes": [
        {
          "line": 3,
          "code": "try:\n    from configuration_deepseek import DeepseekV3Config\nexcept ImportError:\n    from .configuration_deepseek import DeepseekV3Config"
        }
      ]
    },
    {
      "file": "kimi_k25_processor.py",
      "sha256": "537d7a708e1654766fc628c99667bdb9364136d3541633d6522ac43cef9bfea0",
      "bytes": 6906,
      "imports": [
        {
          "line": 1,
          "statement": "from transformers.feature_extraction_utils import BatchFeature"
        },
        {
          "line": 2,
          "statement": "from transformers.processing_utils import ProcessorMixin"
        },
        {
          "line": 3,
          "statement": "from transformers.utils import logging"
        }
      ],
      "effect_related_calls": [],
      "top_level_nodes": [
        {
          "line": 5,
          "code": "logger = logging.get_logger(__name__)"
        }
      ]
    },
    {
      "file": "kimi_k25_vision_processing.py",
      "sha256": "498e20753c9aa6b6224ddbcd05b04deb7e987b76595bf5c28ee8583f33ebc375",
      "bytes": 10019,
      "imports": [
        {
          "line": 4,
          "statement": "import json"
        },
        {
          "line": 5,
          "statement": "from typing import Any, Dict, Optional, Union"
        },
        {
          "line": 7,
          "statement": "import numpy as np"
        },
        {
          "line": 8,
          "statement": "import torch"
        },
        {
          "line": 9,
          "statement": "from PIL import Image"
        },
        {
          "line": 10,
          "statement": "from transformers.image_processing_utils import BaseImageProcessor, BatchFeature"
        },
        {
          "line": 12,
          "statement": "from transformers.utils import TensorType"
        },
        {
          "line": 14,
          "statement": "from .media_utils import MediaInput, VideoChunkInput, _to_tensor, ensure_media_type, get_video_meta, image_to_np, navit_patchify, navit_resize_image, navit_resize_video, normalize, real_sample_fps_and_max_num_frames, timestamp_as_str"
        },
        {
          "line": 21,
          "statement": "from mecord import VideoReader"
        }
      ],
      "effect_related_calls": [
        {
          "line": 242,
          "call": "config_dict.copy"
        }
      ],
      "top_level_nodes": [
        {
          "line": 1,
          "code": "'Image processor class for Kimi-K2.5.\\n'"
        },
        {
          "line": 20,
          "code": "try:\n    from mecord import VideoReader\nexcept ImportError:\n    VideoReader = None"
        }
      ]
    },
    {
      "file": "media_utils.py",
      "sha256": "77a6b1fed3580b0562443092928a0240c2989e3950377e93893952123ae48e3d",
      "bytes": 13179,
      "imports": [
        {
          "line": 1,
          "statement": "import base64"
        },
        {
          "line": 2,
          "statement": "import io"
        },
        {
          "line": 3,
          "statement": "import math"
        },
        {
          "line": 4,
          "statement": "import os"
        },
        {
          "line": 5,
          "statement": "from datetime import datetime, timezone"
        },
        {
          "line": 6,
          "statement": "from typing import List, Literal, Optional, TypedDict"
        },
        {
          "line": 8,
          "statement": "import numpy as np"
        },
        {
          "line": 9,
          "statement": "from PIL import Image"
        },
        {
          "line": 10,
          "statement": "from pydantic import BaseModel, Field"
        },
        {
          "line": 13,
          "statement": "from mecord import VideoReader"
        },
        {
          "line": 353,
          "statement": "import torch"
        }
      ],
      "effect_related_calls": [
        {
          "line": 196,
          "call": "Image.open(io.BytesIO(base64.b64decode(raw_base64))).convert"
        },
        {
          "line": 199,
          "call": "Image.open(data).convert"
        },
        {
          "line": 201,
          "call": "Image.open(io.BytesIO(data)).convert"
        },
        {
          "line": 196,
          "call": "Image.open"
        },
        {
          "line": 199,
          "call": "Image.open"
        },
        {
          "line": 201,
          "call": "Image.open"
        }
      ],
      "top_level_nodes": [
        {
          "line": 12,
          "code": "try:\n    from mecord import VideoReader\nexcept ImportError:\n    VideoReader = None"
        },
        {
          "line": 41,
          "code": "MediaInput = ImageInput | VideoChunkInput"
        }
      ]
    },
    {
      "file": "modeling_deepseek.py",
      "sha256": "17e079e0a5e41114aabd2ae5ba924128ba6652bc6f9a00ea06efcd1230340406",
      "bytes": 78639,
      "imports": [
        {
          "line": 21,
          "statement": "import math"
        },
        {
          "line": 22,
          "statement": "import warnings"
        },
        {
          "line": 23,
          "statement": "from typing import List, Optional, Tuple, Union"
        },
        {
          "line": 25,
          "statement": "import numpy as np"
        },
        {
          "line": 26,
          "statement": "import torch"
        },
        {
          "line": 27,
          "statement": "import torch.distributed as dist"
        },
        {
          "line": 28,
          "statement": "import torch.nn.functional as F"
        },
        {
          "line": 29,
          "statement": "import torch.utils.checkpoint"
        },
        {
          "line": 30,
          "statement": "from torch import nn"
        },
        {
          "line": 31,
          "statement": "from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss"
        },
        {
          "line": 32,
          "statement": "from transformers.activations import ACT2FN"
        },
        {
          "line": 33,
          "statement": "from transformers.cache_utils import Cache, DynamicCache"
        },
        {
          "line": 34,
          "statement": "from transformers.modeling_attn_mask_utils import _prepare_4d_causal_attention_mask"
        },
        {
          "line": 36,
          "statement": "from transformers.modeling_outputs import BaseModelOutputWithPast, CausalLMOutputWithPast, SequenceClassifierOutputWithPast"
        },
        {
          "line": 39,
          "statement": "from transformers.modeling_utils import PreTrainedModel"
        },
        {
          "line": 40,
          "statement": "from transformers.pytorch_utils import ALL_LAYERNORM_LAYERS, is_torch_greater_or_equal_than_1_13"
        },
        {
          "line": 42,
          "statement": "from transformers.utils import add_start_docstrings, add_start_docstrings_to_model_forward, is_flash_attn_2_available, is_flash_attn_greater_or_equal_2_10, logging, replace_return_docstrings"
        },
        {
          "line": 56,
          "statement": "from .configuration_deepseek import DeepseekV3Config"
        },
        {
          "line": 49,
          "statement": "from transformers.utils.import_utils import is_torch_fx_available"
        },
        {
          "line": 59,
          "statement": "from flash_attn import flash_attn_func, flash_attn_varlen_func"
        },
        {
          "line": 60,
          "statement": "from flash_attn.bert_padding import pad_input"
        },
        {
          "line": 61,
          "statement": "from flash_attn.bert_padding import index_first_axis, unpad_input"
        },
        {
          "line": 67,
          "statement": "import torch.fx"
        },
        {
          "line": 444,
          "statement": "import torch.nn.init as init"
        }
      ],
      "effect_related_calls": [],
      "top_level_nodes": [
        {
          "line": 20,
          "code": "' PyTorch DeepSeek model.'"
        },
        {
          "line": 48,
          "code": "try:\n    from transformers.utils.import_utils import is_torch_fx_available\nexcept ImportError:\n\n    def is_torch_fx_available() -> bool:\n        return hasattr(torch, 'fx')"
        },
        {
          "line": 58,
          "code": "if is_flash_attn_2_available():\n    from flash_attn import flash_attn_func, flash_attn_varlen_func\n    from flash_attn.bert_padding import pad_input\n    from flash_attn.bert_padding import index_first_axis, unpad_input"
        },
        {
          "line": 65,
          "code": "if is_torch_fx_available():\n    if not is_torch_greater_or_equal_than_1_13:\n        import torch.fx\n    _prepare_4d_causal_attention_mask = torch.fx.wrap(_prepare_4d_causal_attention_mask)"
        },
        {
          "line": 72,
          "code": "logger = logging.get_logger(__name__)"
        },
        {
          "line": 74,
          "code": "_CONFIG_FOR_DOC = 'DeepseekV3Config'"
        },
        {
          "line": 120,
          "code": "ALL_LAYERNORM_LAYERS.append(DeepseekV3RMSNorm)"
        },
        {
          "line": 1135,
          "code": "ATTENTION_CLASSES = {'eager': DeepseekV3Attention, 'flash_attention_2': DeepseekV3FlashAttention2}"
        },
        {
          "line": 1222,
          "code": "DeepseekV3_START_DOCSTRING = '\\n    This model inherits from [`PreTrainedModel`]. Check the superclass documentation for the generic methods the\\n    library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads\\n    etc.)\\n\\n    This model is also a PyTorch [torch.nn.Module](https://pytorch.org/docs/stable/nn.html#torch.nn.Module) subclass.\\n    Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage\\n    and behavior.\\n\\n    Parameters:\\n        config ([`DeepseekV3Config`]):\\n            Model configuration class with all the parameters of the model. Initializing with a config file does not\\n            load the weights associated with the model, only the configuration. Check out the\\n            [`~PreTrainedModel.from_pretrained`] method to load the model weights.\\n'"
        },
        {
          "line": 1264,
          "code": "DeepseekV3_INPUTS_DOCSTRING = \"\\n    Args:\\n        input_ids (`torch.LongTensor` of shape `(batch_size, sequence_length)`):\\n            Indices of input sequence tokens in the vocabulary. Padding will be ignored by default should you provide\\n            it.\\n\\n            Indices can be obtained using [`AutoTokenizer`]. See [`PreTrainedTokenizer.encode`] and\\n            [`PreTrainedTokenizer.__call__`] for details.\\n\\n            [What are input IDs?](../glossary#input-ids)\\n        attention_mask (`torch.Tensor` of shape `(batch_size, sequence_length)`, *optional*):\\n            Mask to avoid performing attention on padding token indices. Mask values selected in `[0, 1]`:\\n\\n            - 1 for tokens that are **not masked**,\\n            - 0 for tokens that are **masked**.\\n\\n            [What are attention masks?](../glossary#attention-mask)\\n\\n            Indices can be obtained using [`AutoTokenizer`]. See [`PreTrainedTokenizer.encode`] and\\n            [`PreTrainedTokenizer.__call__`] for details.\\n\\n            If `past_key_values` is used, optionally only the last `input_ids` have to be input (see\\n            `past_key_values`).\\n\\n            If you want to change padding behavior, you should read [`modeling_opt._prepare_decoder_attention_mask`]\\n            and modify to your needs. See diagram 1 in [the paper](https://arxiv.org/abs/1910.13461) for more\\n            information on the default strategy.\\n\\n            - 1 indicates the head is **not masked**,\\n            - 0 indicates the head is **masked**.\\n        position_ids (`torch.LongTensor` of shape `(batch_size, sequence_length)`, *optional*):\\n            Indices of positions of each input sequence tokens in the position embeddings. Selected in the range `[0,\\n            config.n_positions - 1]`.\\n\\n            [What are position IDs?](../glossary#position-ids)\\n        past_key_values (`Cache` or `tuple(tuple(torch.FloatTensor))`, *optional*):\\n            Pre-computed hidden-states (key and values in the self-attention blocks and in the cross-attention\\n            blocks) that can be used to speed up sequential decoding. This typically consists in the `past_key_values`\\n            returned by the model at a previous stage of decoding, when `use_cache=True` or `config.use_cache=True`.\\n\\n            Two formats are allowed:\\n            - a [`~cache_utils.Cache`] instance;\\n            - Tuple of `tuple(torch.FloatTensor)` of length `config.n_layers`, with each tuple having 2 tensors of\\n            shape `(batch_size, num_heads, sequence_length, embed_size_per_head)`). This is also known as the legacy\\n            cache format.\\n\\n            The model will output the same cache format that is fed as input. If no `past_key_values` are passed, the\\n            legacy cache format will be returned.\\n\\n            If `past_key_values` are used, the user can optionally input only the last `input_ids` (those that don't\\n            have their past key value states given to this model) of shape `(batch_size, 1)` instead of all `input_ids`\\n            of shape `(batch_size, sequence_length)`.\\n        inputs_embeds (`torch.FloatTensor` of shape `(batch_size, sequence_length, hidden_size)`, *optional*):\\n            Optionally, instead of passing `input_ids` you can choose to directly pass an embedded representation. This\\n            is useful if you want more control over how to convert `input_ids` indices into associated vectors than the\\n            model's internal embedding lookup matrix.\\n        use_cache (`bool`, *optional*):\\n            If set to `True`, `past_key_values` key value states are returned and can be used to speed up decoding (see\\n            `past_key_values`).\\n        output_attentions (`bool`, *optional*):\\n            Whether or not to return the attentions tensors of all attention layers. See `attentions` under returned\\n            tensors for more detail.\\n        output_hidden_states (`bool`, *optional*):\\n            Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for\\n            more detail.\\n        return_dict (`bool`, *optional*):\\n            Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.\\n\""
        }
      ]
    },
    {
      "file": "modeling_kimi_k25.py",
      "sha256": "a1594f129ae8dc5fa3c9dbbc24e8e603b30d7caef1226669b4d95dc8f2a3e2dd",
      "bytes": 53045,
      "imports": [
        {
          "line": 41,
          "statement": "import math"
        },
        {
          "line": 42,
          "statement": "from collections.abc import Sequence"
        },
        {
          "line": 43,
          "statement": "from copy import deepcopy"
        },
        {
          "line": 44,
          "statement": "from typing import Optional"
        },
        {
          "line": 46,
          "statement": "import numpy as np"
        },
        {
          "line": 47,
          "statement": "import torch"
        },
        {
          "line": 48,
          "statement": "import torch.nn as nn"
        },
        {
          "line": 49,
          "statement": "import torch.nn.functional as F"
        },
        {
          "line": 50,
          "statement": "from transformers import activations"
        },
        {
          "line": 58,
          "statement": "from transformers.activations import PytorchGELUTanh"
        },
        {
          "line": 59,
          "statement": "from transformers.cache_utils import Cache"
        },
        {
          "line": 60,
          "statement": "from transformers.configuration_utils import PretrainedConfig"
        },
        {
          "line": 61,
          "statement": "from transformers.modeling_utils import PreTrainedModel"
        },
        {
          "line": 62,
          "statement": "from transformers.models.llava.modeling_llava import LlavaCausalLMOutputWithPast"
        },
        {
          "line": 64,
          "statement": "from transformers.utils import is_flash_attn_2_available"
        },
        {
          "line": 66,
          "statement": "from .configuration_kimi_k25 import KimiK25Config"
        },
        {
          "line": 67,
          "statement": "from .modeling_deepseek import DeepseekV3ForCausalLM"
        },
        {
          "line": 53,
          "statement": "from transformers.activations import PytorchGELUTanh"
        },
        {
          "line": 71,
          "statement": "from flash_attn import flash_attn_varlen_func"
        },
        {
          "line": 55,
          "statement": "from transformers.activations import GELUTanh"
        }
      ],
      "effect_related_calls": [
        {
          "line": 678,
          "call": "deepcopy"
        }
      ],
      "top_level_nodes": [
        {
          "line": 52,
          "code": "try:\n    from transformers.activations import PytorchGELUTanh\nexcept ImportError:\n    from transformers.activations import GELUTanh\n    activations.PytorchGELUTanh = GELUTanh\n    PytorchGELUTanh = GELUTanh"
        },
        {
          "line": 70,
          "code": "if is_flash_attn_2_available():\n    from flash_attn import flash_attn_varlen_func\nelse:\n    flash_attn_varlen_func = None"
        },
        {
          "line": 152,
          "code": "VL_VISION_ATTENTION_FUNCTIONS = {'flash_attention_2': multihead_attention, 'eager': eager_attention}"
        }
      ]
    },
    {
      "file": "tokenization_kimi.py",
      "sha256": "88394687bd081f55928849b2d140e190c70297660d3fb8b7c54c0e5633b177e3",
      "bytes": 14132,
      "imports": [
        {
          "line": 1,
          "statement": "import os"
        },
        {
          "line": 2,
          "statement": "from collections import OrderedDict"
        },
        {
          "line": 3,
          "statement": "from logging import getLogger"
        },
        {
          "line": 4,
          "statement": "from pathlib import Path"
        },
        {
          "line": 5,
          "statement": "from shutil import copyfile"
        },
        {
          "line": 6,
          "statement": "from typing import Any, Dict, Iterator, List, Optional, Tuple, Union, cast"
        },
        {
          "line": 8,
          "statement": "import tiktoken"
        },
        {
          "line": 9,
          "statement": "from tiktoken.load import load_tiktoken_bpe"
        },
        {
          "line": 10,
          "statement": "from tokenizers import AddedToken"
        },
        {
          "line": 11,
          "statement": "from transformers.convert_slow_tokenizer import bytes_to_unicode"
        },
        {
          "line": 12,
          "statement": "from transformers.tokenization_utils import PreTrainedTokenizer"
        },
        {
          "line": 14,
          "statement": "from .tool_declaration_ts import encode_tools_to_typescript_style"
        }
      ],
      "effect_related_calls": [
        {
          "line": 106,
          "call": "load_tiktoken_bpe"
        },
        {
          "line": 319,
          "call": "copyfile"
        }
      ],
      "top_level_nodes": [
        {
          "line": 16,
          "code": "logger = getLogger(__name__)"
        },
        {
          "line": 17,
          "code": "VOCAB_FILES_NAMES = {'vocab_file': 'tiktoken.model'}"
        }
      ]
    },
    {
      "file": "tool_declaration_ts.py",
      "sha256": "97e09ed262f1cd38f87584eaa46c5d4d5b3c9725dd299b21642f389040794ebc",
      "bytes": 16517,
      "imports": [
        {
          "line": 4,
          "statement": "import dataclasses"
        },
        {
          "line": 5,
          "statement": "import json"
        },
        {
          "line": 6,
          "statement": "import logging"
        },
        {
          "line": 7,
          "statement": "from collections.abc import Sequence"
        },
        {
          "line": 8,
          "statement": "from typing import Any"
        }
      ],
      "effect_related_calls": [
        {
          "line": 409,
          "call": "definitions_copy.items"
        },
        {
          "line": 463,
          "call": "_openai_function_to_typescript_style"
        }
      ],
      "top_level_nodes": [
        {
          "line": 1,
          "code": "'\\nEncode structured tool declaration to typescript style string.\\n'"
        },
        {
          "line": 10,
          "code": "logger = logging.getLogger(__name__)"
        },
        {
          "line": 12,
          "code": "_TS_INDENT = '  '"
        },
        {
          "line": 13,
          "code": "_TS_FIELD_DELIMITER = ',\\n'"
        },
        {
          "line": 308,
          "code": "_ParameterType = _ParameterTypeScalar | _ParameterTypeObject | _ParameterTypeArray | _ParameterTypeEnum | _ParameterTypeAnyOf | _ParameterTypeUnion | _ParameterTypeRef"
        }
      ]
    }
  ],
  "license": "Modified MIT, retained upstream/LICENSE; native runtime is Apache-2.0 Transformers 5.16.1",
  "import_time_effects": [
    "Imports Python/NumPy/Torch/Transformers; upstream K3 hard imports FLA and imports/registry-mutates ACT2FN and ALL_LAYERNORM_LAYERS.",
    "Upstream processor/tokenizer closure is not used by fixture: byte tokenizer is authored independently. tiktoken load_tiktoken_bpe can read local or remote vocabulary at tokenizer construction. media_utils reads image filenames/data on explicit invocation, not import.",
    "No subprocess, shell, eval/exec, socket, network request, or model-weight load found in upstream module import-time statements. Decorators and dependency imports execute library initialization. This is source review, not sandboxing."
  ],
  "runtime_scope": "Native installed Transformers Kimi_K25 complete wrapper, no upstream remote Python execution.",
  "network_policy": "No upstream model weights fetched. Custom capture explicitly permits pinned code metadata/download from the selected private model repo; local model weights. Not entirely offline capture. Comparison independent of code and GPU.",
  "patch_provenance": null,
  "review_limitations": "Static source review is not a security guarantee. Dependency implementations belong to the pinned environment. Main must run all runtime checks before release."
}