Skip to content

Commit

Permalink
chore: Update IPFS-related code to use ES6 import/export syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
endomorphosis committed Jun 24, 2024
1 parent 48eaa97 commit fd71672
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
4 changes: 2 additions & 2 deletions example.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

model = AutoModel.from_auto_download("bge-small-en-v1.5")
print(dir(model))
model = AutoModel.from_ipfs("QmccfbkWLYs9K3yucc6b3eSt8s8fKcyRRt24e3CDaeRhM1")
print(dir(model))
# model = AutoModel.from_ipfs("QmccfbkWLYs9K3yucc6b3eSt8s8fKcyRRt24e3CDaeRhM1")
# print(dir(model))


## OPTIONAL S3 Caching ##
Expand Down
11 changes: 7 additions & 4 deletions ipfs_transformers/ipfs_transformers.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os
# TODO: Make template match updates from ipfs_transformers.py
import asyncio

class AutoDownloadModel():
def __init__(self, collection=None, meta=None):
if os.getuid() == 0:
Expand Down Expand Up @@ -66,8 +67,9 @@ def __init__(self, collection=None, meta=None):

import ipfs_model_manager
self.model_manager = ipfs_model_manager.ipfs_model_manager(resources=collection, meta=meta)
self.model_manager.load_collection_cache()
self.model_manager.state()
self.model_manager.load_collection_cache()
self.model_manager.load_collection()
# self.model_manager.state()

def download(self, **kwargs):
# NOTE: Add kwarg for output directory where downloads are stored
Expand All @@ -76,7 +78,8 @@ def download(self, **kwargs):
# if "ipfs_path" in kwargs:
# self.ipfs_path = kwargs["ipfs_path"]


# self.model_manager.run_once()
asyncio.run(self.model_manager.run_once())
model_name = None
cid = None
if "model_name" in kwargs:
Expand Down

0 comments on commit fd71672

Please sign in to comment.