Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions pkg/config/compatibility.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
9 changes: 8 additions & 1 deletion python/cog/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down