├── .gitignore ├── framework.jpeg ├── README.md ├── pipeline_I2V_noise_rectification.py └── LICENSE /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store -------------------------------------------------------------------------------- /framework.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimama-creative/Noise-Rectification/HEAD/framework.jpeg -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Tuning-Free Noise Rectification for High Fidelity Image-to-Video Generation 2 | 3 | 4 | 5 | Noise Rectification is a simple but effective method for image-to-video generation in open domains, and is tuning-free and plug-and-play. 6 |

7 | 8 |

9 | 10 | ## Core code 11 | Our I2V gneration is based on the recent T2V work [AnimateDiff](https://github.com/guoyww/AnimateDiff) and test on the **AnimateDiff v1** version. Here we provide the core code of our implementation. 12 | 13 | 1. Prepare the environment and download the required weights in the AnimateDiff. 14 | 2. Place the following script `pipeline_I2V_noise_rectification.py` under the `pipelines` folder. 15 | 16 | > Note: To achieve better results, you could adjust the input image and prompt, and noise rectification parameters (noise_rectification_period and noise_rectification_weight). 17 | 18 | ```python 19 | ## Core Code Explanation in the pipeline_I2V_noise_rectification.py 20 | 21 | ## Add noise to the input image, see the function: prepare_latents(**kwargs) 22 | def prepare_latents(input_image, **kwargs): 23 | ######################### 24 | # Omit: Code for sampling noise .. 25 | ######################### 26 | 27 | # Add noise to input image 28 | noise = latents.clone() 29 | if input_image is not None: 30 | input_image = preprocess_image(input_image, width, height) 31 | input_image = input_image.to(device=device, dtype=dtype) 32 | 33 | if isinstance(generator, list): 34 | init_latents = [ 35 | self.vae.encode(input_image[i : i + 1]).latent_dist.sample(generator[i]) for i in range(batch_size) 36 | ] 37 | init_latents = torch.cat(init_latents, dim=0) 38 | else: 39 | init_latents = self.vae.encode(input_image).latent_dist.sample(generator) 40 | else: 41 | init_latents = None 42 | 43 | if init_latents is not None: 44 | init_latents = rearrange(init_latents, '(b f) c h w -> b c f h w', b = batch_size, f = 1) 45 | init_latents = init_latents.repeat((1, 1, video_length, 1, 1)) * 0.18215 46 | noisy_latents = self.scheduler.add_noise(init_latents, noise, self.scheduler.timesteps[0]) 47 | 48 | return noisy_latents, noise 49 | 50 | ## Denoising from the noisy_latents and take noise rectification. 51 | def __call__(kwargs): 52 | ######################### 53 | # Omit: Code for preprocessing inputs check, prompt, timesteps, and other preparation... 54 | ######################### 55 | 56 | # denoising loop 57 | for i in timesteps: 58 | # Omit: other codes ... 59 | 60 | # predict the noise residual 61 | noise_pred = self.unet( 62 | latent_model_input, t, 63 | encoder_hidden_states=text_embeddings, 64 | down_block_additional_residuals = None, 65 | mid_block_additional_residual = None, 66 | ).sample.to(dtype=latents_dtype) 67 | 68 | # [The core code of our method.] 69 | # our method rectifies the predicted noise with the GT noise to realize image-to-video. 70 | if noise_rectification_period is not None: 71 | assert len(noise_rectification_period) == 2 72 | if noise_rectification_weight is None: 73 | noise_rectification_weight = torch.cat([torch.linspace(noise_rectification_weight_start_omega, noise_rectification_weight_end_omega, video_length//2), 74 | torch.linspace(noise_rectification_weight_end_omega, noise_rectification_weight_end_omega, video_length//2)]) 75 | noise_rectification_weight = noise_rectification_weight.view(1, 1, video_length, 1, 1) 76 | noise_rectification_weight = noise_rectification_weight.to(latent_model_input.dtype).to(latent_model_input.device) 77 | 78 | if i >= len(timesteps) * noise_rectification_period[0] and i < len(timesteps) * noise_rectification_period[1]: 79 | delta_frames = noise - noise_pred 80 | delta_noise_adjust = noise_rectification_weight * (delta_frames[:,:,[0],:,:].repeat((1, 1, video_length, 1, 1))) + \ 81 | (1 - noise_rectification_weight) * delta_frames 82 | noise_pred = noise_pred + delta_noise_adjust 83 | 84 | # compute the previous noisy sample x_t -> x_t-1 85 | noisy_latents = self.scheduler.step(noise_pred, t, noisy_latents, **extra_step_kwargs).prev_sample 86 | 87 | ``` 88 | 89 | 90 | ## Citation 91 | 92 | If this repo is useful to you, please cite our paper. 93 | 94 | ```bibtex 95 | @article{li2024tuningfree, 96 | title={Tuning-Free Noise Rectification for High Fidelity Image-to-Video Generation}, 97 | author={Weijie Li and Litong Gong and Yiran Zhu and Fanda Fan and Biao Wang and Tiezheng Ge and Bo Zheng}, 98 | year={2024}, 99 | eprint={2403.02827}, 100 | archivePrefix={arXiv}, 101 | primaryClass={cs.CV} 102 | } 103 | ``` 104 | ## Contact Us 105 | 106 | Please feel free to reach out to us: 107 | 108 | - Email: [weijie.lwj0@alibaba-inc.com](mailto:weijie.lwj0@alibaba-inc.com) 109 | 110 | ## **Acknowledgement** 111 | This repository is benefit from [AnimateDiff](https://github.com/guoyww/AnimateDiff). Thanks for the open-sourcing work! Any third-party packages are owned by their respective authors and must be used under their respective licenses. 112 | -------------------------------------------------------------------------------- /pipeline_I2V_noise_rectification.py: -------------------------------------------------------------------------------- 1 | from .pipeline_animation import * # Take from Animatediff: https://github.com/guoyww/AnimateDiff/tree/main 2 | import PIL.Image 3 | 4 | def preprocess_image(image, width, height): 5 | assert isinstance(image, PIL.Image.Image) 6 | image = np.array(image.resize((width, height))).astype(np.float32) / 255.0 7 | image = np.expand_dims(image, 0) 8 | image = image.transpose(0, 3, 1, 2) 9 | image = 2.0 * image - 1.0 10 | image = torch.from_numpy(image) 11 | return image 12 | 13 | class NoiseRectificationI2V_Pipeline(AnimationPipeline): 14 | def __init__( 15 | self, 16 | vae: AutoencoderKL, 17 | text_encoder: CLIPTextModel, 18 | tokenizer: CLIPTokenizer, 19 | unet: UNet3DConditionModel, 20 | scheduler: Union[ 21 | DDIMScheduler, 22 | PNDMScheduler, 23 | LMSDiscreteScheduler, 24 | EulerDiscreteScheduler, 25 | EulerAncestralDiscreteScheduler, 26 | DPMSolverMultistepScheduler, 27 | ], 28 | controlnet = None, 29 | ): 30 | super().__init__(vae, text_encoder, tokenizer, unet, scheduler, controlnet) 31 | 32 | def prepare_latents(self, input_image, batch_size, num_channels_latents, video_length, height, width, dtype, device, generator, latents=None): 33 | shape = (batch_size, num_channels_latents, video_length, height // self.vae_scale_factor, width // self.vae_scale_factor) 34 | 35 | if isinstance(generator, list) and len(generator) != batch_size: 36 | raise ValueError( 37 | f"You have passed a list of generators of length {len(generator)}, but requested an effective batch" 38 | f" size of {batch_size}. Make sure the batch size matches the length of the generators." 39 | ) 40 | if latents is None: 41 | rand_device = "cpu" if device.type == "mps" else device 42 | 43 | if isinstance(generator, list): 44 | shape = shape 45 | latents = [ 46 | torch.randn(shape, generator=generator[i], device=rand_device, dtype=dtype) 47 | for i in range(batch_size) 48 | ] 49 | latents = torch.cat(latents, dim=0).to(device) 50 | else: 51 | latents = torch.randn(shape, generator=generator, device=rand_device, dtype=dtype).to(device) 52 | else: 53 | if latents.shape != shape: 54 | raise ValueError(f"Unexpected latents shape, got {latents.shape}, expected {shape}") 55 | latents = latents.to(device) 56 | 57 | # scale the initial noise by the standard deviation required by the scheduler 58 | latents = latents * self.scheduler.init_noise_sigma 59 | 60 | # Our method first adds noise to the input image and keep the added noise for latter rectification. 61 | noise = latents.clone() 62 | if input_image is not None: 63 | input_image = preprocess_image(input_image, width, height) 64 | input_image = input_image.to(device=device, dtype=dtype) 65 | 66 | if isinstance(generator, list): 67 | init_latents = [ 68 | self.vae.encode(input_image[i : i + 1]).latent_dist.sample(generator[i]) for i in range(batch_size) 69 | ] 70 | init_latents = torch.cat(init_latents, dim=0) 71 | else: 72 | init_latents = self.vae.encode(input_image).latent_dist.sample(generator) 73 | else: 74 | init_latents = None 75 | 76 | if init_latents is not None: 77 | init_latents = rearrange(init_latents, '(b f) c h w -> b c f h w', b = batch_size, f = 1) 78 | init_latents = init_latents.repeat((1, 1, video_length, 1, 1)) * 0.18215 79 | noisy_latents = self.scheduler.add_noise(init_latents, noise, self.scheduler.timesteps[0]) 80 | 81 | return noisy_latents, noise 82 | 83 | @torch.no_grad() 84 | def __call__( 85 | self, 86 | prompt: Union[str, List[str]], 87 | video_length: Optional[int], 88 | height: Optional[int] = None, 89 | width: Optional[int] = None, 90 | num_inference_steps: int = 50, 91 | guidance_scale: float = 7.5, 92 | negative_prompt: Optional[Union[str, List[str]]] = None, 93 | num_videos_per_prompt: Optional[int] = 1, 94 | eta: float = 0.0, 95 | generator: Optional[Union[torch.Generator, List[torch.Generator]]] = None, 96 | latents: Optional[torch.FloatTensor] = None, 97 | output_type: Optional[str] = "tensor", 98 | return_dict: bool = True, 99 | callback: Optional[Callable[[int, int, torch.FloatTensor], None]] = None, 100 | callback_steps: Optional[int] = 1, 101 | 102 | input_image = None, 103 | noise_rectification_period: Optional[list] = None, 104 | noise_rectification_weight: Optional[torch.Tensor] = None, 105 | noise_rectification_weight_start_omega = 1.0, 106 | noise_rectification_weight_end_omega = 0.5, 107 | 108 | **kwargs, 109 | ): 110 | # Default height and width to unet 111 | height = height or self.unet.config.sample_size * self.vae_scale_factor 112 | width = width or self.unet.config.sample_size * self.vae_scale_factor 113 | 114 | # Check inputs. Raise error if not correct 115 | self.check_inputs(prompt, height, width, callback_steps) 116 | 117 | # Define call parameters 118 | # batch_size = 1 if isinstance(prompt, str) else len(prompt) 119 | batch_size = 1 120 | if latents is not None: 121 | batch_size = latents.shape[0] 122 | if isinstance(prompt, list): 123 | batch_size = len(prompt) 124 | 125 | device = self._execution_device 126 | # here `guidance_scale` is defined analog to the guidance weight `w` of equation (2) 127 | # of the Imagen paper: https://arxiv.org/pdf/2205.11487.pdf . `guidance_scale = 1` 128 | # corresponds to doing no classifier free guidance. 129 | do_classifier_free_guidance = guidance_scale > 1.0 130 | 131 | # Encode input prompt 132 | prompt = prompt if isinstance(prompt, list) else [prompt] * batch_size 133 | if negative_prompt is not None: 134 | negative_prompt = negative_prompt if isinstance(negative_prompt, list) else [negative_prompt] * batch_size 135 | text_embeddings = self._encode_prompt( 136 | prompt, device, num_videos_per_prompt, do_classifier_free_guidance, negative_prompt 137 | ) 138 | 139 | # Prepare timesteps 140 | self.scheduler.set_timesteps(num_inference_steps, device=device) 141 | timesteps = self.scheduler.timesteps 142 | 143 | # Prepare latent variables 144 | num_channels_latents = self.unet.in_channels 145 | noisy_latents, noise = self.prepare_latents( 146 | input_image, 147 | batch_size * num_videos_per_prompt, 148 | num_channels_latents, 149 | video_length, 150 | height, 151 | width, 152 | text_embeddings.dtype, 153 | device, 154 | generator, 155 | latents, 156 | ) 157 | latents_dtype = noisy_latents.dtype 158 | 159 | # Prepare extra step kwargs. 160 | extra_step_kwargs = self.prepare_extra_step_kwargs(generator, eta) 161 | 162 | # Denoising loop 163 | num_warmup_steps = len(timesteps) - num_inference_steps * self.scheduler.order 164 | with self.progress_bar(total=num_inference_steps) as progress_bar: 165 | for i, t in enumerate(timesteps): 166 | # expand the latents if we are doing classifier free guidance 167 | latent_model_input = torch.cat([noisy_latents] * 2) if do_classifier_free_guidance else noisy_latents 168 | latent_model_input = self.scheduler.scale_model_input(latent_model_input, t) 169 | 170 | # predict the noise residual 171 | noise_pred = self.unet( 172 | latent_model_input, t, 173 | encoder_hidden_states=text_embeddings, 174 | down_block_additional_residuals = None, 175 | mid_block_additional_residual = None, 176 | ).sample.to(dtype=latents_dtype) 177 | 178 | # perform guidance 179 | if do_classifier_free_guidance: 180 | noise_pred_uncond, noise_pred_text = noise_pred.chunk(2) 181 | noise_pred = noise_pred_uncond + guidance_scale * (noise_pred_text - noise_pred_uncond) 182 | 183 | # [The core code of our method.] 184 | # our method rectifies the predicted noise with the GT noise to realize image-to-video. 185 | if noise_rectification_period is not None: 186 | assert len(noise_rectification_period) == 2 187 | if noise_rectification_weight is None: 188 | noise_rectification_weight = torch.cat([torch.linspace(noise_rectification_weight_start_omega, noise_rectification_weight_end_omega, video_length//2), 189 | torch.linspace(noise_rectification_weight_end_omega, noise_rectification_weight_end_omega, video_length//2)]) 190 | noise_rectification_weight = noise_rectification_weight.view(1, 1, video_length, 1, 1) 191 | noise_rectification_weight = noise_rectification_weight.to(latent_model_input.dtype).to(latent_model_input.device) 192 | 193 | if i >= len(timesteps) * noise_rectification_period[0] and i < len(timesteps) * noise_rectification_period[1]: 194 | delta_frames = noise - noise_pred 195 | delta_noise_adjust = noise_rectification_weight * (delta_frames[:,:,[0],:,:].repeat((1, 1, video_length, 1, 1))) + \ 196 | (1 - noise_rectification_weight) * delta_frames 197 | noise_pred = noise_pred + delta_noise_adjust 198 | 199 | # compute the previous noisy sample x_t -> x_t-1 200 | noisy_latents = self.scheduler.step(noise_pred, t, noisy_latents, **extra_step_kwargs).prev_sample 201 | 202 | # call the callback, if provided 203 | if i == len(timesteps) - 1 or ((i + 1) > num_warmup_steps and (i + 1) % self.scheduler.order == 0): 204 | progress_bar.update() 205 | if callback is not None and i % callback_steps == 0: 206 | callback(i, t, noisy_latents) 207 | 208 | # Post-processing 209 | video = self.decode_latents(noisy_latents) 210 | 211 | # Convert to tensor 212 | if output_type == "tensor": 213 | video = torch.from_numpy(video) 214 | 215 | if not return_dict: 216 | return video 217 | 218 | return AnimationPipelineOutput(videos=video) 219 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | --------------------------------------------------------------------------------