diff --git a/pkg/config/compatibility.go b/pkg/config/compatibility.go index 2048333782..cb88e3ba31 100644 --- a/pkg/config/compatibility.go +++ b/pkg/config/compatibility.go @@ -151,6 +151,11 @@ func cudaVersionFromTorchPlusVersion(ver string) (string, string) { } func cudasFromTorch(ver string) ([]string, error) { + if ver == "" { + return nil, fmt.Errorf( + "torch version must be specified when using CUDA", + ) + } cudas := []string{} // Check the version modifier on torch (such as +cu118) diff --git a/python/cog/types.py b/python/cog/types.py index cc240a0647..0c01680569 100644 --- a/python/cog/types.py +++ b/python/cog/types.py @@ -380,7 +380,14 @@ def __wrapped__(self) -> Any: except AttributeError: pass url = object.__getattribute__(self, "__url__") - resp = requests.get(url, stream=True, timeout=10) + + headers = {} + ua = os.getenv("COG_USER_AGENT") + if ua: + headers["User-Agent"] = ua + + resp = requests.get(url, stream=True, timeout=10,headers=headers) + resp.raise_for_status() resp.raw.decode_content = True object.__setattr__(self, "__target__", resp.raw)