Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
renzhc
diffusers_dcu
Commits
ef3fcbb6
"docs/vscode:/vscode.git/clone" did not exist on "5e6417e9887be8f02ab5b4f5c548dff7f3a4c8f6"
Unverified
Commit
ef3fcbb6
authored
Dec 14, 2022
by
Anton Lozhkov
Committed by
GitHub
Dec 14, 2022
Browse files
Remove all local telemetry (#1702)
parent
7c823c2e
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
5 additions
and
60 deletions
+5
-60
docs/source/installation.mdx
docs/source/installation.mdx
+2
-1
src/diffusers/hub_utils.py
src/diffusers/hub_utils.py
+1
-23
src/diffusers/modeling_flax_utils.py
src/diffusers/modeling_flax_utils.py
+0
-9
src/diffusers/modeling_utils.py
src/diffusers/modeling_utils.py
+0
-9
src/diffusers/pipeline_flax_utils.py
src/diffusers/pipeline_flax_utils.py
+1
-9
src/diffusers/pipeline_utils.py
src/diffusers/pipeline_utils.py
+1
-9
No files found.
docs/source/installation.mdx
View file @
ef3fcbb6
...
@@ -127,7 +127,8 @@ Our library gathers telemetry information during `from_pretrained()` requests.
...
@@ -127,7 +127,8 @@ Our library gathers telemetry information during `from_pretrained()` requests.
This data includes the version of Diffusers and PyTorch/Flax, the requested model or pipeline class,
This data includes the version of Diffusers and PyTorch/Flax, the requested model or pipeline class,
and the path to a pretrained checkpoint if it is hosted on the Hub.
and the path to a pretrained checkpoint if it is hosted on the Hub.
This usage data helps us debug issues and prioritize new features.
This usage data helps us debug issues and prioritize new features.
No private data, such as paths to models saved locally on disk, is ever collected.
Telemetry is only sent when loading models and pipelines from the HuggingFace Hub,
and is not collected during local usage.
We understand that not everyone wants to share additional information, and we respect your privacy,
We understand that not everyone wants to share additional information, and we respect your privacy,
so you can disable telemetry collection by setting the `DISABLE_TELEMETRY` environment variable from your terminal:
so you can disable telemetry collection by setting the `DISABLE_TELEMETRY` environment variable from your terminal:
...
...
src/diffusers/hub_utils.py
View file @
ef3fcbb6
...
@@ -20,7 +20,6 @@ from pathlib import Path
...
@@ -20,7 +20,6 @@ from pathlib import Path
from
typing
import
Dict
,
Optional
,
Union
from
typing
import
Dict
,
Optional
,
Union
from
uuid
import
uuid4
from
uuid
import
uuid4
import
requests
from
huggingface_hub
import
HfFolder
,
whoami
from
huggingface_hub
import
HfFolder
,
whoami
from
.
import
__version__
from
.
import
__version__
...
@@ -56,7 +55,7 @@ def http_user_agent(user_agent: Union[Dict, str, None] = None) -> str:
...
@@ -56,7 +55,7 @@ def http_user_agent(user_agent: Union[Dict, str, None] = None) -> str:
Formats a user-agent string with basic info about a request.
Formats a user-agent string with basic info about a request.
"""
"""
ua
=
f
"diffusers/
{
__version__
}
; python/
{
sys
.
version
.
split
()[
0
]
}
; session_id/
{
SESSION_ID
}
"
ua
=
f
"diffusers/
{
__version__
}
; python/
{
sys
.
version
.
split
()[
0
]
}
; session_id/
{
SESSION_ID
}
"
if
DISABLE_TELEMETRY
:
if
DISABLE_TELEMETRY
or
HF_HUB_OFFLINE
:
return
ua
+
"; telemetry/off"
return
ua
+
"; telemetry/off"
if
is_torch_available
():
if
is_torch_available
():
ua
+=
f
"; torch/
{
_torch_version
}
"
ua
+=
f
"; torch/
{
_torch_version
}
"
...
@@ -75,27 +74,6 @@ def http_user_agent(user_agent: Union[Dict, str, None] = None) -> str:
...
@@ -75,27 +74,6 @@ def http_user_agent(user_agent: Union[Dict, str, None] = None) -> str:
return
ua
return
ua
def
send_telemetry
(
data
:
Dict
,
name
:
str
):
"""
Sends logs to the Hub telemetry endpoint.
Args:
data: the fields to track, e.g. {"example_name": "dreambooth"}
name: a unique name to differentiate the telemetry logs, e.g. "diffusers_examples" or "diffusers_notebooks"
"""
if
DISABLE_TELEMETRY
or
HF_HUB_OFFLINE
:
return
headers
=
{
"user-agent"
:
http_user_agent
(
data
)}
endpoint
=
HUGGINGFACE_CO_TELEMETRY
+
name
try
:
r
=
requests
.
head
(
endpoint
,
headers
=
headers
)
r
.
raise_for_status
()
except
Exception
:
# We don't want to error in case of connection errors of any kind.
pass
def
get_full_repo_name
(
model_id
:
str
,
organization
:
Optional
[
str
]
=
None
,
token
:
Optional
[
str
]
=
None
):
def
get_full_repo_name
(
model_id
:
str
,
organization
:
Optional
[
str
]
=
None
,
token
:
Optional
[
str
]
=
None
):
if
token
is
None
:
if
token
is
None
:
token
=
HfFolder
.
get_token
()
token
=
HfFolder
.
get_token
()
...
...
src/diffusers/modeling_flax_utils.py
View file @
ef3fcbb6
...
@@ -28,7 +28,6 @@ from huggingface_hub.utils import EntryNotFoundError, RepositoryNotFoundError, R
...
@@ -28,7 +28,6 @@ from huggingface_hub.utils import EntryNotFoundError, RepositoryNotFoundError, R
from
requests
import
HTTPError
from
requests
import
HTTPError
from
.
import
__version__
,
is_torch_available
from
.
import
__version__
,
is_torch_available
from
.hub_utils
import
send_telemetry
from
.modeling_flax_pytorch_utils
import
convert_pytorch_state_dict_to_flax
from
.modeling_flax_pytorch_utils
import
convert_pytorch_state_dict_to_flax
from
.utils
import
(
from
.utils
import
(
CONFIG_NAME
,
CONFIG_NAME
,
...
@@ -340,10 +339,6 @@ class FlaxModelMixin:
...
@@ -340,10 +339,6 @@ class FlaxModelMixin:
f
"Error no file named
{
FLAX_WEIGHTS_NAME
}
or
{
WEIGHTS_NAME
}
found in directory "
f
"Error no file named
{
FLAX_WEIGHTS_NAME
}
or
{
WEIGHTS_NAME
}
found in directory "
f
"
{
pretrained_path_with_subfolder
}
."
f
"
{
pretrained_path_with_subfolder
}
."
)
)
send_telemetry
(
{
"model_class"
:
cls
.
__name__
,
"model_path"
:
"local"
,
"framework"
:
"flax"
},
name
=
"diffusers_from_pretrained"
,
)
else
:
else
:
try
:
try
:
model_file
=
hf_hub_download
(
model_file
=
hf_hub_download
(
...
@@ -359,10 +354,6 @@ class FlaxModelMixin:
...
@@ -359,10 +354,6 @@ class FlaxModelMixin:
subfolder
=
subfolder
,
subfolder
=
subfolder
,
revision
=
revision
,
revision
=
revision
,
)
)
send_telemetry
(
{
"model_class"
:
cls
.
__name__
,
"model_path"
:
"hub"
,
"framework"
:
"flax"
},
name
=
"diffusers_from_pretrained"
,
)
except
RepositoryNotFoundError
:
except
RepositoryNotFoundError
:
raise
EnvironmentError
(
raise
EnvironmentError
(
...
...
src/diffusers/modeling_utils.py
View file @
ef3fcbb6
...
@@ -26,7 +26,6 @@ from huggingface_hub.utils import EntryNotFoundError, RepositoryNotFoundError, R
...
@@ -26,7 +26,6 @@ from huggingface_hub.utils import EntryNotFoundError, RepositoryNotFoundError, R
from
requests
import
HTTPError
from
requests
import
HTTPError
from
.
import
__version__
from
.
import
__version__
from
.hub_utils
import
send_telemetry
from
.utils
import
(
from
.utils
import
(
CONFIG_NAME
,
CONFIG_NAME
,
DIFFUSERS_CACHE
,
DIFFUSERS_CACHE
,
...
@@ -594,10 +593,6 @@ class ModelMixin(torch.nn.Module):
...
@@ -594,10 +593,6 @@ class ModelMixin(torch.nn.Module):
raise
EnvironmentError
(
raise
EnvironmentError
(
f
"Error no file named
{
weights_name
}
found in directory
{
pretrained_model_name_or_path
}
."
f
"Error no file named
{
weights_name
}
found in directory
{
pretrained_model_name_or_path
}
."
)
)
send_telemetry
(
{
"model_class"
:
cls
.
__name__
,
"model_path"
:
"local"
,
"framework"
:
"pytorch"
},
name
=
"diffusers_from_pretrained"
,
)
return
model_file
return
model_file
else
:
else
:
try
:
try
:
...
@@ -615,10 +610,6 @@ class ModelMixin(torch.nn.Module):
...
@@ -615,10 +610,6 @@ class ModelMixin(torch.nn.Module):
subfolder
=
subfolder
,
subfolder
=
subfolder
,
revision
=
revision
,
revision
=
revision
,
)
)
send_telemetry
(
{
"model_class"
:
cls
.
__name__
,
"model_path"
:
"hub"
,
"framework"
:
"pytorch"
},
name
=
"diffusers_from_pretrained"
,
)
return
model_file
return
model_file
except
RepositoryNotFoundError
:
except
RepositoryNotFoundError
:
...
...
src/diffusers/pipeline_flax_utils.py
View file @
ef3fcbb6
...
@@ -29,7 +29,7 @@ from PIL import Image
...
@@ -29,7 +29,7 @@ from PIL import Image
from
tqdm.auto
import
tqdm
from
tqdm.auto
import
tqdm
from
.configuration_utils
import
ConfigMixin
from
.configuration_utils
import
ConfigMixin
from
.hub_utils
import
http_user_agent
,
send_telemetry
from
.hub_utils
import
http_user_agent
from
.modeling_flax_utils
import
FLAX_WEIGHTS_NAME
,
FlaxModelMixin
from
.modeling_flax_utils
import
FLAX_WEIGHTS_NAME
,
FlaxModelMixin
from
.schedulers.scheduling_utils_flax
import
SCHEDULER_CONFIG_NAME
,
FlaxSchedulerMixin
from
.schedulers.scheduling_utils_flax
import
SCHEDULER_CONFIG_NAME
,
FlaxSchedulerMixin
from
.utils
import
CONFIG_NAME
,
DIFFUSERS_CACHE
,
BaseOutput
,
is_transformers_available
,
logging
from
.utils
import
CONFIG_NAME
,
DIFFUSERS_CACHE
,
BaseOutput
,
is_transformers_available
,
logging
...
@@ -346,16 +346,8 @@ class FlaxDiffusionPipeline(ConfigMixin):
...
@@ -346,16 +346,8 @@ class FlaxDiffusionPipeline(ConfigMixin):
ignore_patterns
=
ignore_patterns
,
ignore_patterns
=
ignore_patterns
,
user_agent
=
user_agent
,
user_agent
=
user_agent
,
)
)
send_telemetry
(
{
"pipeline_class"
:
requested_pipeline_class
,
"pipeline_path"
:
"hub"
,
"framework"
:
"flax"
},
name
=
"diffusers_from_pretrained"
,
)
else
:
else
:
cached_folder
=
pretrained_model_name_or_path
cached_folder
=
pretrained_model_name_or_path
send_telemetry
(
{
"pipeline_class"
:
cls
.
__name__
,
"pipeline_path"
:
"local"
,
"framework"
:
"flax"
},
name
=
"diffusers_from_pretrained"
,
)
config_dict
=
cls
.
load_config
(
cached_folder
)
config_dict
=
cls
.
load_config
(
cached_folder
)
...
...
src/diffusers/pipeline_utils.py
View file @
ef3fcbb6
...
@@ -33,7 +33,7 @@ from tqdm.auto import tqdm
...
@@ -33,7 +33,7 @@ from tqdm.auto import tqdm
from
.configuration_utils
import
ConfigMixin
from
.configuration_utils
import
ConfigMixin
from
.dynamic_modules_utils
import
get_class_from_dynamic_module
from
.dynamic_modules_utils
import
get_class_from_dynamic_module
from
.hub_utils
import
http_user_agent
,
send_telemetry
from
.hub_utils
import
http_user_agent
from
.modeling_utils
import
_LOW_CPU_MEM_USAGE_DEFAULT
from
.modeling_utils
import
_LOW_CPU_MEM_USAGE_DEFAULT
from
.schedulers.scheduling_utils
import
SCHEDULER_CONFIG_NAME
from
.schedulers.scheduling_utils
import
SCHEDULER_CONFIG_NAME
from
.utils
import
(
from
.utils
import
(
...
@@ -509,16 +509,8 @@ class DiffusionPipeline(ConfigMixin):
...
@@ -509,16 +509,8 @@ class DiffusionPipeline(ConfigMixin):
ignore_patterns
=
ignore_patterns
,
ignore_patterns
=
ignore_patterns
,
user_agent
=
user_agent
,
user_agent
=
user_agent
,
)
)
send_telemetry
(
{
"pipeline_class"
:
requested_pipeline_class
,
"pipeline_path"
:
"hub"
,
"framework"
:
"pytorch"
},
name
=
"diffusers_from_pretrained"
,
)
else
:
else
:
cached_folder
=
pretrained_model_name_or_path
cached_folder
=
pretrained_model_name_or_path
send_telemetry
(
{
"pipeline_class"
:
cls
.
__name__
,
"pipeline_path"
:
"local"
,
"framework"
:
"pytorch"
},
name
=
"diffusers_from_pretrained"
,
)
config_dict
=
cls
.
load_config
(
cached_folder
)
config_dict
=
cls
.
load_config
(
cached_folder
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment