Diffusers documentation

RFD4ProteinaAutoencoder

You are viewing main version, which requires installation from source. If you'd like regular pip install, checkout the latest stable version (v0.42.1).
Hugging Face's logo
Join the Hugging Face community

and get access to the augmented documentation experience

to get started

RFD4ProteinaAutoencoder

RFD4-Proteína의 오토인코더입니다. encode는 atom37 좌표를 토큰별 로컬 잠재 변수(latents)로 매핑하고, decode는 잠재 변수와 백본 위치를 다시 atom37 구조와 잔기(residue) 동일성으로 변환합니다. 파이프라인에서는 vae로 등록됩니다.

from diffusers import RFD4ProteinaAutoencoder

vae = RFD4ProteinaAutoencoder.from_pretrained("nvidia/RFD4-Proteina-Diffusers", subfolder="vae")

RFD4ProteinaAutoencoder

class diffusers.RFD4ProteinaAutoencoder

< >

( atom37_mask: Sequenceallowed_residue_types: Sequencelatent_dim: int = 32n_residue_types: int = 147num_token_types: int = 7nlayers: int = 12token_dim: int = 768nheads: int = 12dim_cond: int = 128pair_repr_dim: int = 256token_type_emb_dim: int = 32encoder_feats_seq: tuple = ('token_type', 'x1_a37coors_nm', 'x1_a37coors_nm_rel', 'chain_idx_seq', 'incident_bond_type_counts', 'atom37_element_charge_embedding')decoder_feats_seq: tuple = ('ca_coors_nm', 'z_latent_seq', 'token_type', 'cond_residue_type') )

매개변수

  • latent_dim (int, 기본값 32) — 토큰별 로컬 잠재 변수의 폭입니다.
  • n_residue_types (int, 기본값 147) — 잔기 어휘 크기.
  • num_token_types (int, 기본값 7) — 토큰 유형 어휘의 크기: 단백질, RNA, DNA, 원자화, 미지, 당류 및 비정형 아미노산.
  • allowed_residue_types (list[list[bool]]) — 각 토큰 유형이 디코딩할 수 있는 잔류 클래스의 (num_token_types, n_residue_types) 테이블
  • nlayers (int, 기본값 12) — 인코더와 디코더 각각의 트렁크 레이어 수.
  • token_dim (int, 기본값 768) — 토큰 표현의 폭입니다.
  • nheads (int, 기본값 12) — 레이어당 어텐션 헤드 수.
  • dim_cond (int, 기본값 128) — (사용되지 않는, 0인) 조건 벡터의 폭입니다.
  • pair_repr_dim (int, 기본값 256) — trunk 레이어를 구성할 때 사용하는 pair의 폭입니다. 공개된 autoencoder는 pair bias를 사용하지 않으므로 이 매개변수는 파라미터를 포함하지 않습니다.
  • token_type_emb_dim (int, 기본값 32) — 토큰 유형 임베딩의 차원입니다.
  • encoder_feats_seq, decoder_feats_seq (list[str]) — 인코더와 디코더 입력으로 투영된 특징.
  • atom37_mask (list[list[bool]]) — 각 잔기 유형에 대한 유효한 atom37 슬롯으로, 형태는 (n_residue_types, 37)입니다.

Paired molecular encoder와 atom37 decoder.

이 모델에 공급되고 반환되는 좌표는 나노미터(nm) 단위입니다.

encode

< >

( coords_nm: Tensorpadding_mask: Tensortoken_type: typing.Optional[torch.Tensor] = Noneatom37_mask: typing.Optional[torch.Tensor] = Noneconditioning: dict[str, typing.Any] | None = Nonegenerator: typing.Union[torch.Generator, list[torch.Generator], NoneType] = Nonereturn_dict: bool = True ) → RFD4ProteinaEncoderOutput or tuple

매개변수

  • coords_nm (torch.Tensor) — 나노미터 단위의 atom37 좌표, (batch, tokens, 37, 3).
  • padding_mask (torch.Tensor) — (batch, tokens), 토큰이 패딩이 아닌 실제 토큰인 위치에서 true입니다.
  • token_type (torch.Tensor, 선택 사항) — (batch, tokens) 토큰 유형 코드.
  • atom37_mask (torch.Tensor, 선택 사항) — (batch, tokens, 37), 원자 슬롯이 사용된 위치에서 true입니다.
  • conditioning (dict[str, Any], 선택 사항) — preprocessor가 출력하는 키 아래에 있는 나머지 topology 및 conditioning 텐서
  • generator (torch.Generator 또는 list[torch.Generator], 선택 사항) — 독립적인 확률적 잠재 샘플을 위해 배치 행마다 하나의 생성기. 생성기가 없으면 샘플링은 전역 스트림에서 추출됩니다.
  • return_dict (bool, 기본값 True) — 타입이 지정된 출력을 반환하거나, 해당 필드의 튜플을 반환합니다.

반환값

RFD4ProteinaEncoderOutput 또는 tuple

(batch, tokens, latent_dim) 모양의 Latent, mean, log-scale 텐서.

준비된 좌표와 조건을 샘플링된 토큰별 로컬 잠재 변수로 인코딩합니다.

decode

< >

( z_latent: Tensorca_coors_nm: Tensorpadding_mask: Tensortoken_type: typing.Optional[torch.Tensor] = Noneatom37_mask: typing.Optional[torch.Tensor] = Noneconditioning: dict[str, typing.Any] | None = Nonereturn_dict: bool = True ) → RFD4ProteinaDecoderOutput or tuple

매개변수

  • z_latent (torch.Tensor) — (batch, tokens, latent_dim) 토큰별 로컬 잠재 변수.
  • ca_coors_nm (torch.Tensor) — 나노미터 단위의 backbone CA 좌표, (batch, tokens, 3).
  • padding_mask (torch.Tensor) — (batch, tokens), 토큰이 패딩이 아닌 실제 토큰인 위치에서 true입니다.
  • token_type (torch.Tensor, 선택 사항) — (batch, tokens) 토큰 유형 코드.
  • atom37_mask (torch.Tensor, 선택 사항) — (batch, tokens, 37), 원자 슬롯이 사용된 위치에서 true입니다.
  • conditioning (dict[str, Any], 선택 사항) — preprocessor가 출력하는 키 아래에 있는 나머지 topology 및 conditioning 텐서입니다. 시퀀스 조건은 여기서 읽힙니다.
  • return_dict (bool, 기본값 True) — 타입이 지정된 출력을 반환하거나, 해당 필드의 튜플을 반환합니다.

반환값

RFD4ProteinaDecoderOutput 또는 tuple

나노미터 단위의 좌표 (batch, tokens, 37, 3), 잔기 유형 (batch, tokens), 방출 마스크 (batch, tokens) 및 원자 마스크 (batch, tokens, 37)입니다. 방출되지 않은 원자의 좌표는 0입니다.

토큰별 잠재 변수(latents)와 백본(backbone) 위치를 atom37 구조로 디코딩합니다.

forward

< >

( z_latent: Tensorca_coors_nm: Tensorpadding_mask: Tensortoken_type: typing.Optional[torch.Tensor] = Noneatom37_mask: typing.Optional[torch.Tensor] = Noneconditioning: dict[str, typing.Any] | None = Nonereturn_dict: bool = True ) → RFD4ProteinaDecoderOutput or tuple

매개변수

  • z_latent (torch.Tensor) — (batch, tokens, latent_dim) 토큰별 로컬 잠재 변수.
  • ca_coors_nm (torch.Tensor) — 나노미터 단위의 backbone CA 좌표, (batch, tokens, 3).
  • padding_mask (torch.Tensor) — (batch, tokens), 토큰이 패딩이 아닌 실제 토큰인 위치에서 true입니다.
  • token_type (torch.Tensor, 선택 사항) — (batch, tokens) 토큰 유형 코드.
  • atom37_mask (torch.Tensor, 선택 사항) — (batch, tokens, 37), 원자 슬롯이 사용된 위치에서 true입니다.
  • conditioning (dict[str, Any], 선택 사항) — 나머지 토폴로지 및 conditioning 텐서입니다.
  • return_dict (bool, 기본값 True) — 타입이 지정된 출력을 반환하거나, 해당 필드의 튜플을 반환합니다.

반환값

RFD4ProteinaDecoderOutput 또는 tuple

디코딩된 좌표, 잔기 유형 및 원자/발생 마스크.

토큰별 latents와 backbone 위치를 디코딩합니다. decode()를 호출하는 것과 동일합니다.

RFD4ProteinaEncoderOutput

class diffusers.models.autoencoders.autoencoder_rfd4_proteina.RFD4ProteinaEncoderOutput

< >

( latent: Tensormean: typing.Optional[torch.Tensor] = Nonelog_scale: typing.Optional[torch.Tensor] = None )

매개변수

  • latent (torch.Tensor) — mean + noise * exp(log_scale) 샘플, 출력된 latent 토큰 외부는 0.
  • mean (torch.Tensor) — Gaussian 평균, 출력된 latent 토큰 외부에서는 0입니다.
  • log_scale (torch.Tensor) — 로그 표준편차. 출력된 잠재 토큰 외부의 값은 0입니다.

각각 (batch, tokens, latent_dim) 모양인 샘플링된 잠재 변수와 가우시안 매개변수입니다.

RFD4ProteinaDecoderOutput

class diffusers.models.autoencoders.autoencoder_rfd4_proteina.RFD4ProteinaDecoderOutput

< >

( coordinates: Tensorresidue_type: typing.Optional[torch.Tensor] = Noneemit_mask: typing.Optional[torch.Tensor] = Noneatom_mask: typing.Optional[torch.Tensor] = None )

매개변수

  • coordinates (torch.Tensor) — 나노미터 단위의 좌표 (batch, tokens, 37, 3). 출력되지 않는 원자는 0입니다.
  • residue_type (torch.Tensor) — (batch, tokens) 모양의 잔기 어휘 인덱스.
  • emit_mask (torch.Tensor) — (batch, tokens) 모양의 Boolean emitted-token mask.
  • atom_mask (torch.Tensor) — (batch, tokens, 37) 모양의 Boolean 유효 원자 마스크.

디코딩된 분자 좌표 및 이산 atom37 위상.

Update on GitHub