(x, prefix)
| 127 | return layers |
| 128 | |
| 129 | def append_str_prefix(x, prefix): |
| 130 | if isinstance(x, str): |
| 131 | return prefix + x |
| 132 | elif isinstance(x, tuple): |
| 133 | return tuple([append_str_prefix(y, prefix) for y in x]) |
| 134 | elif isinstance(x, list): |
| 135 | return [append_str_prefix(y, prefix) for y in x] |
| 136 | else: |
| 137 | return x |
| 138 | |
| 139 | def move_embed(model, device): |
| 140 | if isinstance(model, LlamaForCausalLM): |