justinblalock87 commited on
Commit
dedff96
·
1 Parent(s): eb851d8
.DS_Store ADDED
Binary file (6.15 kB). View file
 
__pycache__/app.cpython-38.pyc CHANGED
Binary files a/__pycache__/app.cpython-38.pyc and b/__pycache__/app.cpython-38.pyc differ
 
__pycache__/quantize.cpython-38.pyc CHANGED
Binary files a/__pycache__/quantize.cpython-38.pyc and b/__pycache__/quantize.cpython-38.pyc differ
 
app.py CHANGED
@@ -1,26 +1,15 @@
1
- import csv
2
- from datetime import datetime
3
  import os
4
  from typing import Optional
5
  import gradio as gr
6
 
7
  import quantize
8
- from huggingface_hub import HfApi, Repository, login
9
-
10
-
11
- DATASET_REPO_URL = "https://huggingface.co/datasets/safetensors/conversions"
12
- DATA_FILENAME = "data.csv"
13
- DATA_FILE = os.path.join("data", DATA_FILENAME)
14
 
15
  HF_TOKEN = os.environ.get("HF_TOKEN")
16
 
17
  def run(model_id: str, model_version: str, additional_args: str, is_private: bool, token: Optional[str] = None) -> str:
18
  if model_id == "":
19
- return """
20
- ### Invalid input 🐞
21
-
22
- Please fill a token and model_id.
23
- """
24
  login(token=token)
25
  if is_private:
26
  api = HfApi(token=token)
@@ -28,8 +17,6 @@ def run(model_id: str, model_version: str, additional_args: str, is_private: boo
28
  api = HfApi(token=HF_TOKEN)
29
  hf_is_private = api.model_info(repo_id=model_id).private
30
  if is_private and not hf_is_private:
31
- # This model is NOT private
32
- # Change the token so we make the PR on behalf of the bot.
33
  api = HfApi(token=HF_TOKEN)
34
 
35
  print("is_private", is_private)
@@ -38,12 +25,7 @@ def run(model_id: str, model_version: str, additional_args: str, is_private: boo
38
 
39
 
40
  DESCRIPTION = """
41
- The steps are the following:
42
- - Paste a read-access token from hf.co/settings/tokens. Read access is enough given that we will open a PR against the source repo.
43
- - Input a model id from the Hub
44
- - Click "Submit"
45
- - That's it! You'll get feedback if it works or not, and if it worked, you'll get the URL of the opened PR 🔥
46
- ⚠️ For now only `pytorch_model.bin` files are supported but we'll extend in the future.
47
  """
48
 
49
  title="Quantize model and convert to CoreML"
 
 
 
1
  import os
2
  from typing import Optional
3
  import gradio as gr
4
 
5
  import quantize
6
+ from huggingface_hub import HfApi, login
 
 
 
 
 
7
 
8
  HF_TOKEN = os.environ.get("HF_TOKEN")
9
 
10
  def run(model_id: str, model_version: str, additional_args: str, is_private: bool, token: Optional[str] = None) -> str:
11
  if model_id == "":
12
+ return "Please fill a token and model_id."
 
 
 
 
13
  login(token=token)
14
  if is_private:
15
  api = HfApi(token=token)
 
17
  api = HfApi(token=HF_TOKEN)
18
  hf_is_private = api.model_info(repo_id=model_id).private
19
  if is_private and not hf_is_private:
 
 
20
  api = HfApi(token=HF_TOKEN)
21
 
22
  print("is_private", is_private)
 
25
 
26
 
27
  DESCRIPTION = """
28
+ Simple utility tool to convert automatically quantize diffusion models and convert them to CoreML.
 
 
 
 
 
29
  """
30
 
31
  title="Quantize model and convert to CoreML"