Instructions to use camenduru/text2video-zero with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use camenduru/text2video-zero with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("camenduru/text2video-zero", dtype=torch.bfloat16, device_map="cuda") prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" image = pipe(prompt).images[0] - Notebooks
- Google Colab
- Kaggle
Download node-gyp/14.16.0/include/node/cppgc/internal/persistent-node.h from camenduru/text2video-zero: direct link, hf CLI and curl.
- Browser
- Download file 2.65 kB
-
https://huggingface.co/camenduru/text2video-zero/resolve/main/node-gyp/14.16.0/include/node/cppgc/internal/persistent-node.h
- Command line
-
hf download hf://camenduru/text2video-zero/node-gyp/14.16.0/include/node/cppgc/internal/persistent-node.h
-
curl -L -o persistent-node.h https://huggingface.co/camenduru/text2video-zero/resolve/main/node-gyp/14.16.0/include/node/cppgc/internal/persistent-node.h
2.65 kB
| // Copyright 2020 the V8 project authors. All rights reserved. | |
| // Use of this source code is governed by a BSD-style license that can be | |
| // found in the LICENSE file. | |
| namespace cppgc { | |
| class Visitor; | |
| namespace internal { | |
| // PersistentNode represesents a variant of two states: | |
| // 1) traceable node with a back pointer to the Persistent object; | |
| // 2) freelist entry. | |
| class PersistentNode final { | |
| public: | |
| PersistentNode() = default; | |
| PersistentNode(const PersistentNode&) = delete; | |
| PersistentNode& operator=(const PersistentNode&) = delete; | |
| void InitializeAsUsedNode(void* owner, TraceCallback trace) { | |
| owner_ = owner; | |
| trace_ = trace; | |
| } | |
| void InitializeAsFreeNode(PersistentNode* next) { | |
| next_ = next; | |
| trace_ = nullptr; | |
| } | |
| void UpdateOwner(void* owner) { | |
| CPPGC_DCHECK(IsUsed()); | |
| owner_ = owner; | |
| } | |
| PersistentNode* FreeListNext() const { | |
| CPPGC_DCHECK(!IsUsed()); | |
| return next_; | |
| } | |
| void Trace(Visitor* visitor) const { | |
| CPPGC_DCHECK(IsUsed()); | |
| trace_(visitor, owner_); | |
| } | |
| bool IsUsed() const { return trace_; } | |
| private: | |
| // PersistentNode acts as a designated union: | |
| // If trace_ != nullptr, owner_ points to the corresponding Persistent handle. | |
| // Otherwise, next_ points to the next freed PersistentNode. | |
| union { | |
| void* owner_ = nullptr; | |
| PersistentNode* next_; | |
| }; | |
| TraceCallback trace_ = nullptr; | |
| }; | |
| class V8_EXPORT PersistentRegion { | |
| using PersistentNodeSlots = std::array<PersistentNode, 256u>; | |
| public: | |
| PersistentRegion() = default; | |
| PersistentRegion(const PersistentRegion&) = delete; | |
| PersistentRegion& operator=(const PersistentRegion&) = delete; | |
| PersistentNode* AllocateNode(void* owner, TraceCallback trace) { | |
| if (!free_list_head_) { | |
| EnsureNodeSlots(); | |
| } | |
| PersistentNode* node = free_list_head_; | |
| free_list_head_ = free_list_head_->FreeListNext(); | |
| node->InitializeAsUsedNode(owner, trace); | |
| return node; | |
| } | |
| void FreeNode(PersistentNode* node) { | |
| node->InitializeAsFreeNode(free_list_head_); | |
| free_list_head_ = node; | |
| } | |
| void Trace(Visitor*); | |
| size_t NodesInUse() const; | |
| private: | |
| void EnsureNodeSlots(); | |
| std::vector<std::unique_ptr<PersistentNodeSlots>> nodes_; | |
| PersistentNode* free_list_head_ = nullptr; | |
| }; | |
| } // namespace internal | |
| } // namespace cppgc | |