unifyai / models Goto Github PK
View Code? Open in Web Editor NEWOff-the-shelf models for a variety of domains
Home Page: https://unify.ai
License: Apache License 2.0
Off-the-shelf models for a variety of domains
Home Page: https://unify.ai
License: Apache License 2.0
saving weights and config works fine, but gives this "dump " error while saving the model
model_name = "efficientnet_b0"
โ
imported_model1.push_to_huggingface(
repo_id=f"unifyai/{model_name}",
config_path = "config.json",
model_path = "model.pkl",
weights_path = "weights.hdf5",
repo_type = "model",
token = "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",
private = False,
revision = None,
commit_message = "adds {model_name} model",
commit_description = "Adding {model_name} model, config(specs), and weights",
create_pr= False,
safe_serialization = False,
push_config = True,
push_model = True,
push_weights = True,
)
TypeError Traceback (most recent call last)
Cell In[19], line 3
1 model_name = "efficientnet_b0"
----> 3 imported_model1.push_to_huggingface(
4 repo_id=f"unifyai/{model_name}",
5 config_path = "config.json",
6 model_path = "model.pkl",
7 weights_path = "weights.hdf5",
8 repo_type = "model",
9 token = "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",
10 private = False,
11 revision = None,
12 commit_message = "adds {model_name} model",
13 commit_description = "Adding {model_name} model, config(specs), and weights",
14 create_pr= False,
15 safe_serialization = False,
16 push_config = True,
17 push_model = True,
18 push_weights = True,
19 )
File /opt/conda/lib/python3.10/site-packages/ivy_models/base/model.py:72, in BaseModel.push_to_huggingface(self, repo_id, config_path, model_path, weights_path, repo_type, token, private, revision, commit_message, commit_description, create_pr, safe_serialization, push_config, push_model, push_weights)
70 if push_config:
71 print("Pushing config to Hugging Face...")
---> 72 self.spec.to_json_file()
73 api.upload_file(
74 path_or_fileobj=config_path,
75 repo_id=repo_id,
76 path_in_repo=config_path,
77 repo_type=repo_type,
78 )
79 os.remove(config_path)
File /opt/conda/lib/python3.10/site-packages/ivy_models/base/spec.py:77, in BaseSpec.to_json_file(self, save_directory)
75 os.makedirs(save_directory, exist_ok=True)
76 with open(os.path.join(save_directory, "config.json"), "w") as f:
---> 77 json.dump(self.dict, f)
78 print("Saved to directory:", save_directory)
File /opt/conda/lib/python3.10/json/init.py:179, in dump(obj, fp, skipkeys, ensure_ascii, check_circular, allow_nan, cls, indent, separators, default, sort_keys, **kw)
173 iterable = cls(skipkeys=skipkeys, ensure_ascii=ensure_ascii,
174 check_circular=check_circular, allow_nan=allow_nan, indent=indent,
175 separators=separators,
176 default=default, sort_keys=sort_keys, **kw).iterencode(obj)
177 # could accelerate with writelines in some versions of Python, at
178 # a debuggability cost
--> 179 for chunk in iterable:
180 fp.write(chunk)
File /opt/conda/lib/python3.10/json/encoder.py:431, in _make_iterencode.._iterencode(o, _current_indent_level)
429 yield from _iterencode_list(o, _current_indent_level)
430 elif isinstance(o, dict):
--> 431 yield from _iterencode_dict(o, _current_indent_level)
432 else:
433 if markers is not None:
File /opt/conda/lib/python3.10/json/encoder.py:405, in _make_iterencode.._iterencode_dict(dct, _current_indent_level)
403 else:
404 chunks = _iterencode(value, _current_indent_level)
--> 405 yield from chunks
406 if newline_indent is not None:
407 _current_indent_level -= 1
File /opt/conda/lib/python3.10/json/encoder.py:325, in _make_iterencode.._iterencode_list(lst, _current_indent_level)
323 else:
324 chunks = _iterencode(value, _current_indent_level)
--> 325 yield from chunks
326 if newline_indent is not None:
327 _current_indent_level -= 1
File /opt/conda/lib/python3.10/json/encoder.py:438, in _make_iterencode.._iterencode(o, _current_indent_level)
436 raise ValueError("Circular reference detected")
437 markers[markerid] = o
--> 438 o = _default(o)
439 yield from _iterencode(o, _current_indent_level)
440 if markers is not None:
File /opt/conda/lib/python3.10/json/encoder.py:179, in JSONEncoder.default(self, o)
160 def default(self, o):
161 """Implement this method in a subclass such that it returns
162 a serializable object for o
, or calls the base implementation
163 (to raise a TypeError
).
(...)
177
178 """
--> 179 raise TypeError(f'Object of type {o.class.name} '
180 f'is not JSON serializable')
TypeError: Object of type MBConvConfig is not JSON serializable
These errors are coming on master branch state of the densenet and
after setting batchnorm(training=False), both cases.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.