- Removed unused Python imports (#683)

- bert/model.py:10: tree_unflatten
  - bert/model.py:2: dataclass
  - bert/model.py:8: numpy
  - cifar/resnet.py:6: Any
  - clip/model.py:15: tree_flatten
  - clip/model.py:9: Union
  - gcn/main.py:8: download_cora
  - gcn/main.py:9: cross_entropy
  - llms/gguf_llm/models.py:12: tree_flatten, tree_unflatten
  - llms/gguf_llm/models.py:9: numpy
  - llms/mixtral/mixtral.py:12: tree_map
  - llms/mlx_lm/models/dbrx.py:2: Dict, Union
  - llms/mlx_lm/tuner/trainer.py:5: partial
  - llms/speculative_decoding/decoder.py:1: dataclass, field
  - llms/speculative_decoding/decoder.py:2: Optional
  - llms/speculative_decoding/decoder.py:5: mlx.nn
  - llms/speculative_decoding/decoder.py:6: numpy
  - llms/speculative_decoding/main.py:2: glob
  - llms/speculative_decoding/main.py:3: json
  - llms/speculative_decoding/main.py:5: Path
  - llms/speculative_decoding/main.py:8: mlx.nn
  - llms/speculative_decoding/model.py:6: tree_unflatten
  - llms/speculative_decoding/model.py:7: AutoTokenizer
  - llms/tests/test_lora.py:13: yaml_loader
  - lora/lora.py:14: tree_unflatten
  - lora/models.py:11: numpy
  - lora/models.py:3: glob
  - speechcommands/kwt.py:1: Any
  - speechcommands/main.py:7: mlx.data
  - stable_diffusion/stable_diffusion/model_io.py:4: partial
  - whisper/benchmark.py:5: sys
  - whisper/test.py:5: subprocess
  - whisper/whisper/audio.py:6: Optional
  - whisper/whisper/decoding.py:8: mlx.nn
This commit is contained in:
dmdaksh 2024-04-16 10:50:32 -04:00 committed by GitHub
parent e55a9e8cb4
commit 7d7e236061
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
21 changed files with 9 additions and 36 deletions

View File

@ -1,12 +1,9 @@
import argparse import argparse
from dataclasses import dataclass
from pathlib import Path from pathlib import Path
from typing import List, Optional, Tuple from typing import List, Optional, Tuple
import mlx.core as mx import mlx.core as mx
import mlx.nn as nn import mlx.nn as nn
import numpy
import numpy as np
from mlx.utils import tree_unflatten from mlx.utils import tree_unflatten
from transformers import AutoConfig, AutoTokenizer, PreTrainedTokenizerBase from transformers import AutoConfig, AutoTokenizer, PreTrainedTokenizerBase

View File

@ -3,8 +3,6 @@ Implementation of ResNets for CIFAR-10 as per the original paper [https://arxiv.
Configurations include ResNet-20, ResNet-32, ResNet-44, ResNet-56, ResNet-110, ResNet-1202. Configurations include ResNet-20, ResNet-32, ResNet-44, ResNet-56, ResNet-110, ResNet-1202.
""" """
from typing import Any
import mlx.core as mx import mlx.core as mx
import mlx.nn as nn import mlx.nn as nn
from mlx.utils import tree_flatten from mlx.utils import tree_flatten

View File

@ -6,13 +6,12 @@ import logging
import math import math
from dataclasses import dataclass from dataclasses import dataclass
from pathlib import Path from pathlib import Path
from typing import Optional, Union from typing import Optional
import mlx.core as mx import mlx.core as mx
import mlx.nn as nn import mlx.nn as nn
from mlx.core import linalg as LA from mlx.core import linalg as LA
from mlx.nn.losses import cross_entropy from mlx.nn.losses import cross_entropy
from mlx.utils import tree_flatten
@dataclass @dataclass

View File

@ -5,8 +5,7 @@ from functools import partial
import mlx.core as mx import mlx.core as mx
import mlx.nn as nn import mlx.nn as nn
import mlx.optimizers as optim import mlx.optimizers as optim
from datasets import download_cora, load_data, train_val_test_mask from datasets import load_data, train_val_test_mask
from mlx.nn.losses import cross_entropy
from mlx.utils import tree_flatten from mlx.utils import tree_flatten
from gcn import GCN from gcn import GCN

View File

@ -6,10 +6,8 @@ from typing import Dict, List, Optional, Tuple, Union
import mlx.core as mx import mlx.core as mx
import mlx.nn as nn import mlx.nn as nn
import numpy as np
import utils import utils
from huggingface_hub import snapshot_download from huggingface_hub import snapshot_download
from mlx.utils import tree_flatten, tree_unflatten
@dataclass @dataclass

View File

@ -9,7 +9,7 @@ from typing import List, Optional, Tuple
import mlx.core as mx import mlx.core as mx
import mlx.nn as nn import mlx.nn as nn
from mlx.utils import tree_map, tree_unflatten from mlx.utils import tree_unflatten
from sentencepiece import SentencePieceProcessor from sentencepiece import SentencePieceProcessor

View File

@ -1,5 +1,5 @@
from dataclasses import dataclass from dataclasses import dataclass
from typing import Dict, Optional, Tuple, Union from typing import Optional, Tuple
import mlx.core as mx import mlx.core as mx
import mlx.nn as nn import mlx.nn as nn

View File

@ -2,7 +2,6 @@
import time import time
from dataclasses import dataclass, field from dataclasses import dataclass, field
from functools import partial
from pathlib import Path from pathlib import Path
from typing import Union from typing import Union

View File

@ -1,9 +1,6 @@
from dataclasses import dataclass, field from typing import List
from typing import List, Optional
import mlx.core as mx import mlx.core as mx
import mlx.nn as nn
import numpy as np
import transformers import transformers
from model import Model from model import Model

View File

@ -1,11 +1,7 @@
import argparse import argparse
import glob
import json
import time import time
from pathlib import Path
import mlx.core as mx import mlx.core as mx
import mlx.nn as nn
from decoder import SpeculativeDecoder from decoder import SpeculativeDecoder
from mlx.utils import tree_unflatten from mlx.utils import tree_unflatten
from model import Model from model import Model

View File

@ -3,8 +3,8 @@ from typing import List, Optional, Tuple
import mlx.core as mx import mlx.core as mx
import mlx.nn as nn import mlx.nn as nn
import numpy as np import numpy as np
from mlx.utils import tree_map, tree_unflatten from mlx.utils import tree_map
from transformers import AutoTokenizer, T5Config from transformers import T5Config
def _relative_position_bucket( def _relative_position_bucket(

View File

@ -10,7 +10,6 @@ import mlx.nn as nn
import mlx.optimizers as opt import mlx.optimizers as opt
from mlx.utils import tree_flatten from mlx.utils import tree_flatten
from mlx_lm import lora, tuner from mlx_lm import lora, tuner
from mlx_lm.lora import yaml_loader
from mlx_lm.tuner.lora import LoRALinear from mlx_lm.tuner.lora import LoRALinear
from mlx_lm.tuner.utils import build_schedule from mlx_lm.tuner.utils import build_schedule

View File

@ -11,7 +11,7 @@ import mlx.nn as nn
import mlx.optimizers as optim import mlx.optimizers as optim
import numpy as np import numpy as np
import utils as lora_utils import utils as lora_utils
from mlx.utils import tree_flatten, tree_unflatten from mlx.utils import tree_flatten
from models import LoRALinear from models import LoRALinear

View File

@ -1,6 +1,5 @@
# Copyright © 2023 Apple Inc. # Copyright © 2023 Apple Inc.
import glob
import inspect import inspect
import math import math
from dataclasses import dataclass from dataclasses import dataclass
@ -8,7 +7,6 @@ from typing import Dict, Optional, Tuple, Union
import mlx.core as mx import mlx.core as mx
import mlx.nn as nn import mlx.nn as nn
import numpy as np
@dataclass @dataclass

View File

@ -1,5 +1,3 @@
from typing import Any
import mlx.core as mx import mlx.core as mx
import mlx.nn as nn import mlx.nn as nn
from mlx.utils import tree_flatten from mlx.utils import tree_flatten

View File

@ -4,7 +4,6 @@ from functools import partial
import kwt import kwt
import mlx.core as mx import mlx.core as mx
import mlx.data as dx
import mlx.nn as nn import mlx.nn as nn
import mlx.optimizers as optim import mlx.optimizers as optim
from mlx.data.datasets import load_speechcommands from mlx.data.datasets import load_speechcommands

View File

@ -1,7 +1,6 @@
# Copyright © 2023-2024 Apple Inc. # Copyright © 2023-2024 Apple Inc.
import json import json
from functools import partial
from typing import Optional from typing import Optional
import mlx.core as mx import mlx.core as mx

View File

@ -2,7 +2,6 @@
import argparse import argparse
import os import os
import subprocess import subprocess
import sys
import time import time
import mlx.core as mx import mlx.core as mx

View File

@ -2,7 +2,6 @@
import json import json
import os import os
import subprocess
import unittest import unittest
from dataclasses import asdict from dataclasses import asdict
from pathlib import Path from pathlib import Path

View File

@ -3,7 +3,7 @@
import os import os
from functools import lru_cache from functools import lru_cache
from subprocess import CalledProcessError, run from subprocess import CalledProcessError, run
from typing import Optional, Union from typing import Union
import mlx.core as mx import mlx.core as mx
import numpy as np import numpy as np

View File

@ -5,7 +5,6 @@ from dataclasses import dataclass, field, replace
from typing import Dict, Iterable, List, Optional, Sequence, Tuple, Union from typing import Dict, Iterable, List, Optional, Sequence, Tuple, Union
import mlx.core as mx import mlx.core as mx
import mlx.nn as nn
import numpy as np import numpy as np
from mlx.utils import tree_map from mlx.utils import tree_map